From a6108323d7ba9c81bd18d596668894884edb2180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Laferri=C3=A8re?= Date: Thu, 8 Feb 2024 17:12:44 -0500 Subject: [PATCH] Removes any remnants of `TieredSmt` (#1237) --- air/src/constraints/chiplets/hasher/mod.rs | 4 ++ air/src/constraints/chiplets/memory/mod.rs | 4 ++ air/src/constraints/stack/mod.rs | 2 + core/src/lib.rs | 3 +- core/src/operations/decorators/advice.rs | 57 +----------------- processor/src/host/advice/injectors/smt.rs | 16 ++--- processor/src/host/advice/mod.rs | 69 +++------------------- 7 files changed, 31 insertions(+), 124 deletions(-) diff --git a/air/src/constraints/chiplets/hasher/mod.rs b/air/src/constraints/chiplets/hasher/mod.rs index dde05fc5c8..46d3a794af 100644 --- a/air/src/constraints/chiplets/hasher/mod.rs +++ b/air/src/constraints/chiplets/hasher/mod.rs @@ -344,9 +344,11 @@ trait EvaluationFrameExt { // --- Flags ---------------------------------------------------------------------------------- /// Set to 1 on the first 7 steps of every 8-step cycle. This flag is degree 1. + #[allow(dead_code)] fn f_rpr(&self, k: &[E]) -> E; /// Set to 1 when selector flags are (1,0,0) on rows which are multiples of 8. This flag is /// degree 4. + #[allow(dead_code)] fn f_bp(&self, k: &[E]) -> E; /// Set to 1 when selector flags are (1,0,1) on rows which are multiples of 8. This flag is /// degree 4. @@ -359,9 +361,11 @@ trait EvaluationFrameExt { fn f_mu(&self, k: &[E]) -> E; /// Set to 1 when selector flags are (0,0,0) on rows which are 1 less than a multiple of 8. This /// flag is degree 4. + #[allow(dead_code)] fn f_hout(&self, k: &[E]) -> E; /// Set to 1 when selector flags are (0,0,1) on rows which are 1 less than a multiple of 8. This /// flag is degree 4. + #[allow(dead_code)] fn f_sout(&self, k: &[E]) -> E; /// This flag will be set to 1 when either f_hout=1 or f_sout=1 in the current row. This flag is /// degree 3. diff --git a/air/src/constraints/chiplets/memory/mod.rs b/air/src/constraints/chiplets/memory/mod.rs index e0120aa758..850aed2f35 100644 --- a/air/src/constraints/chiplets/memory/mod.rs +++ b/air/src/constraints/chiplets/memory/mod.rs @@ -174,12 +174,16 @@ trait EvaluationFrameExt { /// Gets the value of the specified selector column in the next row. fn selector_next(&self, idx: usize) -> E; /// The current context value. + #[allow(dead_code)] fn ctx(&self) -> E; /// The current address. + #[allow(dead_code)] fn addr(&self) -> E; /// The current clock cycle. + #[allow(dead_code)] fn clk(&self) -> E; /// The next clock cycle. + #[allow(dead_code)] fn clk_next(&self) -> E; /// The value from the specified index of the values (0, 1, 2, 3) in the current row. fn v(&self, index: usize) -> E; diff --git a/air/src/constraints/stack/mod.rs b/air/src/constraints/stack/mod.rs index 41ddbbcfec..5279392aae 100644 --- a/air/src/constraints/stack/mod.rs +++ b/air/src/constraints/stack/mod.rs @@ -337,12 +337,14 @@ trait EvaluationFrameExt { fn stack_overflow_addr_next(&self) -> E; /// Returns the current value of stack helper column `h0`. + #[allow(dead_code)] fn stack_helper(&self) -> E; /// Gets the current element of the clk register in the trace. fn clk(&self) -> E; /// Gets the next element of the clk register in the trace. + #[allow(dead_code)] fn clk_next(&self) -> E; /// Gets the current element of the fmp register in the trace. diff --git a/core/src/lib.rs b/core/src/lib.rs index 0c73929703..3653452e4d 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -13,8 +13,7 @@ pub mod crypto { pub use miden_crypto::merkle::{ DefaultMerkleStore, EmptySubtreeRoots, InnerNodeInfo, LeafIndex, MerkleError, MerklePath, MerkleStore, MerkleTree, Mmr, MmrPeaks, NodeIndex, PartialMerkleTree, - RecordingMerkleStore, SimpleSmt, Smt, SmtProof, SmtProofError, StoreNode, TieredSmt, - SMT_DEPTH, + RecordingMerkleStore, SimpleSmt, Smt, SmtProof, SmtProofError, StoreNode, SMT_DEPTH, }; } diff --git a/core/src/operations/decorators/advice.rs b/core/src/operations/decorators/advice.rs index 0a8011d4e5..e84c5ae7f8 100644 --- a/core/src/operations/decorators/advice.rs +++ b/core/src/operations/decorators/advice.rs @@ -144,63 +144,10 @@ pub enum AdviceInjector { /// degree coefficients are located at the top of the advice stack. Ext2Intt, - /// Pushes values onto the advice stack which are required for successful retrieval of a - /// value from a Sparse Merkle Tree data structure. - /// - /// The Sparse Merkle Tree is tiered, meaning it will have leaf depths in `{16, 32, 48, 64}`. - /// The depth flags define the tier on which the leaf is located. - /// - /// Inputs: - /// Operand stack: [KEY, ROOT, ...] - /// Advice stack: [...] - /// - /// Outputs: - /// Operand stack: [KEY, ROOT, ...] - /// Advice stack: [f0, f1, K, V, f2] - /// - /// Where: - /// - f0 is a boolean flag set to `1` if the depth is `16` or `48`. - /// - f1 is a boolean flag set to `1` if the depth is `16` or `32`. - /// - K is the remaining key word; will be zeroed if the tree don't contain a mapped value - /// for the key. - /// - V is the value word; will be zeroed if the tree don't contain a mapped value for the key. - /// - f2 is a boolean flag set to `1` if a remaining key is not zero. + /// Currently unimplemented SmtGet, - /// Pushes values onto the advice stack which are required for successful insertion of a - /// key-value pair into a Sparse Merkle Tree data structure. - /// - /// The Sparse Merkle Tree is tiered, meaning it will have leaf depths in `{16, 32, 48, 64}`. - /// - /// Inputs: - /// Operand stack: [VALUE, KEY, ROOT, ...] - /// Advice stack: [...] - /// - /// Outputs: - /// Operand stack: [OLD_VALUE, NEW_ROOT, ...] - /// Advice stack depends on the type of insert operation as follows: - /// - Update of an existing leaf: [ZERO (padding), d0, d1, ONE (is_update), OLD_VALUE] - /// - Simple insert at depth 16: [d0, d1, ONE (is_simple_insert), ZERO (is_update)] - /// - Simple insert at depth 32 or 48: [d0, d1, ONE (is_simple_insert), ZERO (is_update), P_NODE] - /// - Complex insert: [f0, f1, ZERO (is_simple_insert), ZERO (is_update), E_KEY, E_VALUE] - /// - Delete against an empty subtree: [d0, d1, ZERO (is_leaf), ONE (key_not_set)] - /// - Delete against another leaf: [d0, d1, ONE (is_leaf), ONE (key_not_set), KEY, VALUE] - /// - Delete against own leaf: [ZERO, ZERO, ZERO, ZERO (key_not_set), NEW_ROOT, OLD_VALUE] - /// - /// Where: - /// - ROOT and NEW_ROOT are the roots of the TSMT before and after the insert respectively. - /// - VALUE is the value to be inserted. - /// - OLD_VALUE is the value previously associated with the specified KEY. - /// - d0 is a boolean flag set to `1` if the depth is `16` or `48`. - /// - d1 is a boolean flag set to `1` if the depth is `16` or `32`. - /// - P_NODE is an internal node located at the tier above the insert tier. - /// - f0 and f1 are boolean flags a combination of which determines the source and the target - /// tiers as follows: - /// - (0, 0): depth 16 -> 32 - /// - (0, 1): depth 16 -> 48 - /// - (1, 0): depth 32 -> 48 - /// - (1, 1): depth 16, 32, or 48 -> 64 - /// - E_KEY and E_VALUE are the key-value pair for a leaf which is to be replaced by a subtree. + /// Currently unimplemented SmtSet, /// Pushes onto the advice stack the value associated with the specified key in a Sparse diff --git a/processor/src/host/advice/injectors/smt.rs b/processor/src/host/advice/injectors/smt.rs index 151b344723..46a1cb3a43 100644 --- a/processor/src/host/advice/injectors/smt.rs +++ b/processor/src/host/advice/injectors/smt.rs @@ -12,13 +12,6 @@ use vm_core::{ // SMT INJECTORS // ================================================================================================ -pub(crate) fn push_smtget_inputs( - _advice_provider: &mut A, - _process: &S, -) -> Result { - unimplemented!() -} - /// Pushes onto the advice stack the value associated with the specified key in a Sparse /// Merkle Tree defined by the specified root. /// @@ -72,6 +65,15 @@ pub(crate) fn push_smtpeek_result( Ok(HostResponse::None) } +/// Currently unimplemented +pub(crate) fn push_smtget_inputs( + _advice_provider: &mut A, + _process: &S, +) -> Result { + unimplemented!() +} + +/// Currently unimplemented pub(crate) fn push_smtset_inputs( _advice_provider: &mut A, _process: &S, diff --git a/processor/src/host/advice/mod.rs b/processor/src/host/advice/mod.rs index f7bb0e2579..cd80ca5874 100644 --- a/processor/src/host/advice/mod.rs +++ b/processor/src/host/advice/mod.rs @@ -424,39 +424,6 @@ pub trait AdviceProvider: Sized { // DEFAULT SMT INJECTORS // -------------------------------------------------------------------------------------------- - /// Pushes values onto the advice stack which are required for successful retrieval of a - /// value from a Sparse Merkle Tree data structure. - /// - /// The Sparse Merkle Tree is tiered, meaning it will have leaf depths in `{16, 32, 48, 64}`. - /// The depth flags define the tier on which the leaf is located. - /// - /// Inputs: - /// Operand stack: [KEY, ROOT, ...] - /// Advice stack: [...] - /// - /// Outputs: - /// Operand stack: [KEY, ROOT, ...] - /// Advice stack: [f0, f1, K, V, f2] - /// - /// Where: - /// - f0 is a boolean flag set to `1` if the depth is `16` or `48`. - /// - f1 is a boolean flag set to `1` if the depth is `16` or `32`. - /// - K is the key; will be zeroed if the tree don't contain a mapped value for the key. - /// - V is the value word; will be zeroed if the tree don't contain a mapped value for the key. - /// - f2 is a boolean flag set to `1` if the key is not zero. - /// - /// # Errors - /// Returns an error if the provided Merkle root doesn't exist on the advice provider. - /// - /// # Panics - /// Will panic as unimplemented if the target depth is `64`. - fn push_smtget_inputs( - &mut self, - process: &S, - ) -> Result { - injectors::smt::push_smtget_inputs(self, process) - } - /// Pushes onto the advice stack the value associated with the specified key in a Sparse /// Merkle Tree defined by the specified root. /// @@ -483,33 +450,15 @@ pub trait AdviceProvider: Sized { injectors::smt::push_smtpeek_result(self, process) } - /// Pushes values onto the advice stack which are required for successful insertion of a - /// key-value pair into a Sparse Merkle Tree data structure. - /// - /// The Sparse Merkle Tree is tiered, meaning it will have leaf depths in `{16, 32, 48, 64}`. - /// - /// Inputs: - /// Operand stack: [VALUE, KEY, ROOT, ...] - /// Advice stack: [...] - /// - /// Outputs: - /// Operand stack: [OLD_VALUE, NEW_ROOT, ...] - /// Advice stack: see comments for specialized handlers below. - /// - /// Where: - /// - ROOT and NEW_ROOT are the roots of the TSMT before and after the insert respectively. - /// - VALUE is the value to be inserted. - /// - OLD_VALUE is the value previously associated with the specified KEY. - /// - /// # Errors - /// Returns an error if: - /// - The Merkle store does not contain a node with the specified root. - /// - The Merkle store does not contain all nodes needed to validate the path between the root - /// and the relevant TSMT nodes. - /// - The advice map does not contain required data about TSMT leaves to be modified. - /// - /// # Panics - /// Will panic as unimplemented if the target depth is `64`. + /// Currently unimplemented + fn push_smtget_inputs( + &mut self, + process: &S, + ) -> Result { + injectors::smt::push_smtget_inputs(self, process) + } + + /// Currently unimplemented fn push_smtset_inputs( &mut self, process: &S,