From 6bff1ccf5289bdfb7e3d5e1d329c9808fe7390fe Mon Sep 17 00:00:00 2001 From: Philippe Laferriere Date: Thu, 7 Nov 2024 10:38:27 -0500 Subject: [PATCH] refactor: remove unused `push_smtget` and `push_smtset` from `AdviceProvider` trait --- assembly/src/ast/instruction/advice.rs | 6 ------ assembly/src/ast/tests.rs | 3 +-- assembly/src/ast/visit.rs | 4 ---- assembly/src/parser/grammar.lalrpop | 6 ------ core/src/mast/serialization/decorator.rs | 12 ------------ core/src/mast/serialization/tests.rs | 4 ---- core/src/operations/decorators/advice.rs | 8 -------- processor/src/host/advice/injectors/smt.rs | 16 ---------------- processor/src/host/advice/mod.rs | 16 ---------------- processor/src/lib.rs | 2 -- 10 files changed, 1 insertion(+), 76 deletions(-) diff --git a/assembly/src/ast/instruction/advice.rs b/assembly/src/ast/instruction/advice.rs index c0f13cbeb..d917686ed 100644 --- a/assembly/src/ast/instruction/advice.rs +++ b/assembly/src/ast/instruction/advice.rs @@ -16,8 +16,6 @@ use crate::{ast::ImmU8, Felt, ZERO}; pub enum AdviceInjectorNode { PushU64Div, PushExt2intt, - PushSmtGet, - PushSmtSet, PushSmtPeek, PushMapVal, PushMapValImm { offset: ImmU8 }, @@ -37,8 +35,6 @@ impl From<&AdviceInjectorNode> for AdviceInjector { match value { PushU64Div => Self::U64Div, PushExt2intt => Self::Ext2Intt, - PushSmtGet => Self::SmtGet, - PushSmtSet => Self::SmtSet, PushSmtPeek => Self::SmtPeek, PushMapVal => Self::MapValueToStack { include_len: false, key_offset: 0 }, PushMapValImm { offset: ImmU8::Value(offset) } => Self::MapValueToStack { @@ -76,8 +72,6 @@ impl fmt::Display for AdviceInjectorNode { match self { Self::PushU64Div => write!(f, "push_u64div"), Self::PushExt2intt => write!(f, "push_ext2intt"), - Self::PushSmtGet => write!(f, "push_smtget"), - Self::PushSmtSet => write!(f, "push_smtset"), Self::PushSmtPeek => write!(f, "push_smtpeek"), Self::PushMapVal => write!(f, "push_mapval"), Self::PushMapValImm { offset } => write!(f, "push_mapval.{offset}"), diff --git a/assembly/src/ast/tests.rs b/assembly/src/ast/tests.rs index 7fff35c58..a289a6525 100644 --- a/assembly/src/ast/tests.rs +++ b/assembly/src/ast/tests.rs @@ -472,12 +472,11 @@ fn test_ast_parsing_adv_injection() -> Result<(), Report> { let context = TestContext::new(); let source = source_file!( &context, - "begin adv.push_u64div adv.push_mapval adv.push_smtget adv.insert_mem end" + "begin adv.push_u64div adv.push_mapval adv.insert_mem end" ); let forms = module!(begin!( inst!(AdvInject(PushU64Div)), inst!(AdvInject(PushMapVal)), - inst!(AdvInject(PushSmtGet)), inst!(AdvInject(InsertMem)) )); assert_eq!(context.parse_forms(source)?, forms); diff --git a/assembly/src/ast/visit.rs b/assembly/src/ast/visit.rs index ecd11fb86..637a82f81 100644 --- a/assembly/src/ast/visit.rs +++ b/assembly/src/ast/visit.rs @@ -361,8 +361,6 @@ where }, AdviceInjectorNode::PushU64Div | AdviceInjectorNode::PushExt2intt - | AdviceInjectorNode::PushSmtGet - | AdviceInjectorNode::PushSmtSet | AdviceInjectorNode::PushSmtPeek | AdviceInjectorNode::PushMapVal | AdviceInjectorNode::PushMapValN @@ -813,8 +811,6 @@ where }, AdviceInjectorNode::PushU64Div | AdviceInjectorNode::PushExt2intt - | AdviceInjectorNode::PushSmtGet - | AdviceInjectorNode::PushSmtSet | AdviceInjectorNode::PushSmtPeek | AdviceInjectorNode::PushMapVal | AdviceInjectorNode::PushMapValN diff --git a/assembly/src/parser/grammar.lalrpop b/assembly/src/parser/grammar.lalrpop index 65b78ae42..dcb469d47 100644 --- a/assembly/src/parser/grammar.lalrpop +++ b/assembly/src/parser/grammar.lalrpop @@ -54,8 +54,6 @@ extern { "push_mtnode" => Token::PushMtnode, "push_sig" => Token::PushSig, "push_smtpeek" => Token::PushSmtpeek, - "push_smtget" => Token::PushSmtget, - "push_smtset" => Token::PushSmtset, "push_u64div" => Token::PushU64Div, "and" => Token::And, "assert" => Token::Assert, @@ -685,8 +683,6 @@ AdviceInjector: Instruction = { "adv" "." "push_mtnode" => Instruction::AdvInject(AdviceInjectorNode::PushMtNode), "adv" "." "push_sig" "." => Instruction::AdvInject(AdviceInjectorNode::PushSignature { kind }), "adv" "." "push_smtpeek" => Instruction::AdvInject(AdviceInjectorNode::PushSmtPeek), - "adv" "." "push_smtget" => Instruction::AdvInject(AdviceInjectorNode::PushSmtGet), - "adv" "." "push_smtset" => Instruction::AdvInject(AdviceInjectorNode::PushSmtSet), "adv" "." "push_u64div" => Instruction::AdvInject(AdviceInjectorNode::PushU64Div), } @@ -1681,9 +1677,7 @@ Opcode: &'static str = { "movdnw" => "movdnw", "movup" => "movup", "movupw" => "movupw", - "mtree_get" => "mtree_get", "mtree_merge" => "mtree_merge", - "mtree_set" => "mtree_set", "mtree_verify" => "mtree_verify", "mul" => "mul", "neg" => "neg", diff --git a/core/src/mast/serialization/decorator.rs b/core/src/mast/serialization/decorator.rs index a8b2041e3..5dfed28d3 100644 --- a/core/src/mast/serialization/decorator.rs +++ b/core/src/mast/serialization/decorator.rs @@ -72,12 +72,6 @@ impl DecoratorInfo { EncodedDecoratorVariant::AdviceInjectorExt2Intt => { Ok(Decorator::Advice(AdviceInjector::Ext2Intt)) }, - EncodedDecoratorVariant::AdviceInjectorSmtGet => { - Ok(Decorator::Advice(AdviceInjector::SmtGet)) - }, - EncodedDecoratorVariant::AdviceInjectorSmtSet => { - Ok(Decorator::Advice(AdviceInjector::SmtSet)) - }, EncodedDecoratorVariant::AdviceInjectorSmtPeek => { Ok(Decorator::Advice(AdviceInjector::SmtPeek)) }, @@ -222,8 +216,6 @@ pub enum EncodedDecoratorVariant { AdviceInjectorU64Div, AdviceInjectorExt2Inv, AdviceInjectorExt2Intt, - AdviceInjectorSmtGet, - AdviceInjectorSmtSet, AdviceInjectorSmtPeek, AdviceInjectorU32Clz, AdviceInjectorU32Ctz, @@ -271,8 +263,6 @@ impl From<&Decorator> for EncodedDecoratorVariant { AdviceInjector::U64Div => Self::AdviceInjectorU64Div, AdviceInjector::Ext2Inv => Self::AdviceInjectorExt2Inv, AdviceInjector::Ext2Intt => Self::AdviceInjectorExt2Intt, - AdviceInjector::SmtGet => Self::AdviceInjectorSmtGet, - AdviceInjector::SmtSet => Self::AdviceInjectorSmtSet, AdviceInjector::SmtPeek => Self::AdviceInjectorSmtPeek, AdviceInjector::U32Clz => Self::AdviceInjectorU32Clz, AdviceInjector::U32Ctz => Self::AdviceInjectorU32Ctz, @@ -366,8 +356,6 @@ impl DecoratorDataBuilder { | AdviceInjector::U64Div | AdviceInjector::Ext2Inv | AdviceInjector::Ext2Intt - | AdviceInjector::SmtGet - | AdviceInjector::SmtSet | AdviceInjector::SmtPeek | AdviceInjector::U32Clz | AdviceInjector::U32Ctz diff --git a/core/src/mast/serialization/tests.rs b/core/src/mast/serialization/tests.rs index cb6e9e2c0..2e8b8a30c 100644 --- a/core/src/mast/serialization/tests.rs +++ b/core/src/mast/serialization/tests.rs @@ -117,8 +117,6 @@ fn confirm_operation_and_decorator_structure() { AdviceInjector::U64Div => (), AdviceInjector::Ext2Inv => (), AdviceInjector::Ext2Intt => (), - AdviceInjector::SmtGet => (), - AdviceInjector::SmtSet => (), AdviceInjector::SmtPeek => (), AdviceInjector::U32Clz => (), AdviceInjector::U32Ctz => (), @@ -256,8 +254,6 @@ fn serialize_deserialize_all_nodes() { (1, Decorator::Advice(AdviceInjector::U64Div)), (3, Decorator::Advice(AdviceInjector::Ext2Inv)), (5, Decorator::Advice(AdviceInjector::Ext2Intt)), - (5, Decorator::Advice(AdviceInjector::SmtGet)), - (5, Decorator::Advice(AdviceInjector::SmtSet)), (5, Decorator::Advice(AdviceInjector::SmtPeek)), (5, Decorator::Advice(AdviceInjector::U32Clz)), (10, Decorator::Advice(AdviceInjector::U32Ctz)), diff --git a/core/src/operations/decorators/advice.rs b/core/src/operations/decorators/advice.rs index bc70906c3..916ffec3c 100644 --- a/core/src/operations/decorators/advice.rs +++ b/core/src/operations/decorators/advice.rs @@ -142,12 +142,6 @@ pub enum AdviceInjector { /// degree coefficients are located at the top of the advice stack. Ext2Intt, - /// Currently unimplemented - SmtGet, - - /// Currently unimplemented - SmtSet, - /// Pushes onto the advice stack the value associated with the specified key in a Sparse /// Merkle Tree defined by the specified root. /// @@ -303,8 +297,6 @@ impl fmt::Display for AdviceInjector { Self::U64Div => write!(f, "div_u64"), Self::Ext2Inv => write!(f, "ext2_inv"), Self::Ext2Intt => write!(f, "ext2_intt"), - Self::SmtGet => write!(f, "smt_get"), - Self::SmtSet => write!(f, "smt_set"), Self::SmtPeek => write!(f, "smt_peek"), Self::U32Clz => write!(f, "u32clz"), Self::U32Ctz => write!(f, "u32ctz"), diff --git a/processor/src/host/advice/injectors/smt.rs b/processor/src/host/advice/injectors/smt.rs index 544c8ee4b..e3ba8ec6a 100644 --- a/processor/src/host/advice/injectors/smt.rs +++ b/processor/src/host/advice/injectors/smt.rs @@ -67,22 +67,6 @@ pub(crate) fn push_smtpeek_result( Ok(HostResponse::None) } -/// Currently unimplemented -pub(crate) fn push_smtget_inputs( - _advice_provider: &mut A, - _process: ProcessState, -) -> Result { - unimplemented!() -} - -/// Currently unimplemented -pub(crate) fn push_smtset_inputs( - _advice_provider: &mut A, - _process: ProcessState, -) -> Result { - unimplemented!() -} - // HELPER METHODS // -------------------------------------------------------------------------------------------- diff --git a/processor/src/host/advice/mod.rs b/processor/src/host/advice/mod.rs index 978c9982b..b78d404e3 100644 --- a/processor/src/host/advice/mod.rs +++ b/processor/src/host/advice/mod.rs @@ -613,22 +613,6 @@ pub trait AdviceProvider: Sized { ) -> Result { injectors::smt::push_smtpeek_result(self, process) } - - /// Currently unimplemented - fn push_smtget_inputs( - &mut self, - process: ProcessState, - ) -> Result { - injectors::smt::push_smtget_inputs(self, process) - } - - /// Currently unimplemented - fn push_smtset_inputs( - &mut self, - process: ProcessState, - ) -> Result { - injectors::smt::push_smtset_inputs(self, process) - } } impl AdviceProvider for &mut T diff --git a/processor/src/lib.rs b/processor/src/lib.rs index 6d3aad210..65020bc6f 100644 --- a/processor/src/lib.rs +++ b/processor/src/lib.rs @@ -606,8 +606,6 @@ impl Process { AdviceInjector::Ext2Intt => { advice_provider.push_ext2_intt_result(process_state)? }, - AdviceInjector::SmtGet => advice_provider.push_smtget_inputs(process_state)?, - AdviceInjector::SmtSet => advice_provider.push_smtset_inputs(process_state)?, AdviceInjector::SmtPeek => { advice_provider.push_smtpeek_result(process_state)? },