From 1286cbdd740a4760657c0e86eade37c50844d5d1 Mon Sep 17 00:00:00 2001 From: Andrey Khmuro Date: Mon, 4 Mar 2024 23:29:55 +0200 Subject: [PATCH] refactor: remove unused find_lone_leaf function (#1262) --- CHANGELOG.md | 5 +++++ air/src/constraints/stack/mod.rs | 8 ++++---- assembly/src/ast/imports.rs | 2 +- processor/src/host/advice/mod.rs | 24 ------------------------ processor/src/host/advice/providers.rs | 20 -------------------- 5 files changed, 10 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b62c58497..4d0918efe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/air/src/constraints/stack/mod.rs b/air/src/constraints/stack/mod.rs index 00dbb4f2b2..e3fc571a2f 100644 --- a/air/src/constraints/stack/mod.rs +++ b/air/src/constraints/stack/mod.rs @@ -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( +pub fn get_aux_assertions_first_step( result: &mut Vec>, alphas: &AuxTraceRandElements, stack_inputs: &[Felt], @@ -245,7 +245,7 @@ pub fn get_aux_assertions_first_step( } /// Returns the stack's boundary assertions for auxiliary columns at the last step. -pub fn get_aux_assertions_last_step( +pub fn get_aux_assertions_last_step( result: &mut Vec>, alphas: &AuxTraceRandElements, stack_outputs: &StackOutputs, @@ -269,7 +269,7 @@ pub fn get_aux_assertions_last_step( /// 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(alphas: &[E], init_values: &[Felt]) -> E +fn get_overflow_table_init(alphas: &[E], init_values: &[Felt]) -> E where E: FieldElement, { @@ -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(alphas: &[E], stack_outputs: &StackOutputs) -> E +fn get_overflow_table_final(alphas: &[E], stack_outputs: &StackOutputs) -> E where E: FieldElement, { diff --git a/assembly/src/ast/imports.rs b/assembly/src/ast/imports.rs index 70912ee7b1..4a275e45cd 100644 --- a/assembly/src/ast/imports.rs +++ b/assembly/src/ast/imports.rs @@ -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], diff --git a/processor/src/host/advice/mod.rs b/processor/src/host/advice/mod.rs index 6e29825ec7..a217462f0a 100644 --- a/processor/src/host/advice/mod.rs +++ b/processor/src/host/advice/mod.rs @@ -675,21 +675,6 @@ pub trait AdviceProvider: Sized { index: &Felt, ) -> Result; - /// 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, 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. /// @@ -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, ExecutionError> { - T::find_lone_leaf(self, root, root_index, tree_depth) - } - fn update_merkle_node( &mut self, root: Word, diff --git a/processor/src/host/advice/providers.rs b/processor/src/host/advice/providers.rs index 3088d90526..6453f7d1da 100644 --- a/processor/src/host/advice/providers.rs +++ b/processor/src/host/advice/providers.rs @@ -185,18 +185,6 @@ where .map_err(ExecutionError::MerkleStoreLookupFailed) } - fn find_lone_leaf( - &self, - root: Word, - root_index: NodeIndex, - tree_depth: u8, - ) -> Result, 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, @@ -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, 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) } @@ -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, 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) }