Skip to content

Commit

Permalink
refactor: remove unused find_lone_leaf function (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran authored Mar 4, 2024
1 parent 8a9af02 commit 1286cbd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 49 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.9.0

#### VM Internals
- Removed unused `find_lone_leaf()` function from the Advice Provider (#1262).

## 0.8.0 (02-26-2024)

#### Assembly
Expand Down
8 changes: 4 additions & 4 deletions air/src/constraints/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub fn get_assertions_last_step(
// --- AUXILIARY COLUMNS --------------------------------------------------------------------------

/// Returns the stack's boundary assertions for auxiliary columns at the first step.
pub fn get_aux_assertions_first_step<E: FieldElement>(
pub fn get_aux_assertions_first_step<E>(
result: &mut Vec<Assertion<E>>,
alphas: &AuxTraceRandElements<E>,
stack_inputs: &[Felt],
Expand All @@ -245,7 +245,7 @@ pub fn get_aux_assertions_first_step<E: FieldElement>(
}

/// Returns the stack's boundary assertions for auxiliary columns at the last step.
pub fn get_aux_assertions_last_step<E: FieldElement>(
pub fn get_aux_assertions_last_step<E>(
result: &mut Vec<Assertion<E>>,
alphas: &AuxTraceRandElements<E>,
stack_outputs: &StackOutputs,
Expand All @@ -269,7 +269,7 @@ pub fn get_aux_assertions_last_step<E: FieldElement>(

/// Gets the initial value of the overflow table auxiliary column from the provided sets of initial
/// values and random elements.
fn get_overflow_table_init<E: FieldElement>(alphas: &[E], init_values: &[Felt]) -> E
fn get_overflow_table_init<E>(alphas: &[E], init_values: &[Felt]) -> E
where
E: FieldElement<BaseField = Felt>,
{
Expand All @@ -293,7 +293,7 @@ where

/// Gets the final value of the overflow table auxiliary column from the provided program outputs
/// and random elements.
fn get_overflow_table_final<E: FieldElement>(alphas: &[E], stack_outputs: &StackOutputs) -> E
fn get_overflow_table_final<E>(alphas: &[E], stack_outputs: &StackOutputs) -> E
where
E: FieldElement<BaseField = Felt>,
{
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/ast/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl ModuleImports {

/// Look up the path of the imported module with the given name.
pub fn get_module_path(&self, module_name: &str) -> Option<&LibraryPath> {
self.imports.get(&module_name.to_string())
self.imports.get(module_name)
}

/// Look up the actual procedure name and module path associated with the given [ProcedureId],
Expand Down
24 changes: 0 additions & 24 deletions processor/src/host/advice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,21 +675,6 @@ pub trait AdviceProvider: Sized {
index: &Felt,
) -> Result<u8, ExecutionError>;

/// Returns node value and index of a leaf node in the subtree of the specified root, if and
/// only if this is the only leaf in the entire subtree. Otherwise, None is returned.
///
/// The root itself is assumed to be located at the specified index in a tree with the provided
/// depth.
///
/// # Errors
/// Returns an error if a three for the specified root does not exist in the advice provider.
fn find_lone_leaf(
&self,
root: Word,
root_index: NodeIndex,
tree_depth: u8,
) -> Result<Option<(NodeIndex, Word)>, ExecutionError>;

/// Updates a node at the specified depth and index in a Merkle tree with the specified root;
/// returns the Merkle path from the updated node to the new root, together with the new root.
///
Expand Down Expand Up @@ -798,15 +783,6 @@ where
T::get_leaf_depth(self, root, tree_depth, index)
}

fn find_lone_leaf(
&self,
root: Word,
root_index: NodeIndex,
tree_depth: u8,
) -> Result<Option<(NodeIndex, Word)>, ExecutionError> {
T::find_lone_leaf(self, root, root_index, tree_depth)
}

fn update_merkle_node(
&mut self,
root: Word,
Expand Down
20 changes: 0 additions & 20 deletions processor/src/host/advice/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,6 @@ where
.map_err(ExecutionError::MerkleStoreLookupFailed)
}

fn find_lone_leaf(
&self,
root: Word,
root_index: NodeIndex,
tree_depth: u8,
) -> Result<Option<(NodeIndex, Word)>, ExecutionError> {
self.store
.find_lone_leaf(root.into(), root_index, tree_depth)
.map(|leaf| leaf.map(|(index, leaf)| (index, leaf.into())))
.map_err(ExecutionError::MerkleStoreLookupFailed)
}

fn update_merkle_node(
&mut self,
root: Word,
Expand Down Expand Up @@ -317,10 +305,6 @@ impl AdviceProvider for MemAdviceProvider {
self.provider.get_leaf_depth(root, tree_depth, index)
}

fn find_lone_leaf(&self, root: Word, root_index: NodeIndex, tree_depth: u8) -> Result<Option<(NodeIndex, Word)>, ExecutionError> {
self.provider.find_lone_leaf(root, root_index, tree_depth)
}

fn update_merkle_node(&mut self, root: Word, depth: &Felt, index: &Felt, value: Word) -> Result<(MerklePath, Word), ExecutionError> {
self.provider.update_merkle_node(root, depth, index, value)
}
Expand Down Expand Up @@ -442,10 +426,6 @@ impl AdviceProvider for RecAdviceProvider {
self.provider.get_leaf_depth(root, tree_depth, index)
}

fn find_lone_leaf(&self, root: Word, root_index: NodeIndex, tree_depth: u8) -> Result<Option<(NodeIndex, Word)>, ExecutionError> {
self.provider.find_lone_leaf(root, root_index, tree_depth)
}

fn update_merkle_node(&mut self, root: Word, depth: &Felt, index: &Felt, value: Word) -> Result<(MerklePath, Word), ExecutionError> {
self.provider.update_merkle_node(root, depth, index, value)
}
Expand Down

0 comments on commit 1286cbd

Please sign in to comment.