Skip to content

Commit

Permalink
refactor: remove unused push_smtget and push_smtset from `AdviceP…
Browse files Browse the repository at this point in the history
…rovider` trait
  • Loading branch information
plafer committed Nov 19, 2024
1 parent 99ad892 commit 6bff1cc
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 76 deletions.
6 changes: 0 additions & 6 deletions assembly/src/ast/instruction/advice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use crate::{ast::ImmU8, Felt, ZERO};
pub enum AdviceInjectorNode {
PushU64Div,
PushExt2intt,
PushSmtGet,
PushSmtSet,
PushSmtPeek,
PushMapVal,
PushMapValImm { offset: ImmU8 },
Expand All @@ -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 {
Expand Down Expand Up @@ -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}"),
Expand Down
3 changes: 1 addition & 2 deletions assembly/src/ast/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions assembly/src/ast/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,6 @@ where
},
AdviceInjectorNode::PushU64Div
| AdviceInjectorNode::PushExt2intt
| AdviceInjectorNode::PushSmtGet
| AdviceInjectorNode::PushSmtSet
| AdviceInjectorNode::PushSmtPeek
| AdviceInjectorNode::PushMapVal
| AdviceInjectorNode::PushMapValN
Expand Down Expand Up @@ -813,8 +811,6 @@ where
},
AdviceInjectorNode::PushU64Div
| AdviceInjectorNode::PushExt2intt
| AdviceInjectorNode::PushSmtGet
| AdviceInjectorNode::PushSmtSet
| AdviceInjectorNode::PushSmtPeek
| AdviceInjectorNode::PushMapVal
| AdviceInjectorNode::PushMapValN
Expand Down
6 changes: 0 additions & 6 deletions assembly/src/parser/grammar.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -685,8 +683,6 @@ AdviceInjector: Instruction = {
"adv" "." "push_mtnode" => Instruction::AdvInject(AdviceInjectorNode::PushMtNode),
"adv" "." "push_sig" "." <kind:SignatureKind> => 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),
}

Expand Down Expand Up @@ -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",
Expand Down
12 changes: 0 additions & 12 deletions core/src/mast/serialization/decorator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
},
Expand Down Expand Up @@ -222,8 +216,6 @@ pub enum EncodedDecoratorVariant {
AdviceInjectorU64Div,
AdviceInjectorExt2Inv,
AdviceInjectorExt2Intt,
AdviceInjectorSmtGet,
AdviceInjectorSmtSet,
AdviceInjectorSmtPeek,
AdviceInjectorU32Clz,
AdviceInjectorU32Ctz,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -366,8 +356,6 @@ impl DecoratorDataBuilder {
| AdviceInjector::U64Div
| AdviceInjector::Ext2Inv
| AdviceInjector::Ext2Intt
| AdviceInjector::SmtGet
| AdviceInjector::SmtSet
| AdviceInjector::SmtPeek
| AdviceInjector::U32Clz
| AdviceInjector::U32Ctz
Expand Down
4 changes: 0 additions & 4 deletions core/src/mast/serialization/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (),
Expand Down Expand Up @@ -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)),
Expand Down
8 changes: 0 additions & 8 deletions core/src/operations/decorators/advice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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"),
Expand Down
16 changes: 0 additions & 16 deletions processor/src/host/advice/injectors/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ pub(crate) fn push_smtpeek_result<A: AdviceProvider>(
Ok(HostResponse::None)
}

/// Currently unimplemented
pub(crate) fn push_smtget_inputs<A: AdviceProvider>(
_advice_provider: &mut A,
_process: ProcessState,
) -> Result<HostResponse, ExecutionError> {
unimplemented!()
}

/// Currently unimplemented
pub(crate) fn push_smtset_inputs<A: AdviceProvider>(
_advice_provider: &mut A,
_process: ProcessState,
) -> Result<HostResponse, ExecutionError> {
unimplemented!()
}

// HELPER METHODS
// --------------------------------------------------------------------------------------------

Expand Down
16 changes: 0 additions & 16 deletions processor/src/host/advice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,22 +613,6 @@ pub trait AdviceProvider: Sized {
) -> Result<HostResponse, ExecutionError> {
injectors::smt::push_smtpeek_result(self, process)
}

/// Currently unimplemented
fn push_smtget_inputs(
&mut self,
process: ProcessState,
) -> Result<HostResponse, ExecutionError> {
injectors::smt::push_smtget_inputs(self, process)
}

/// Currently unimplemented
fn push_smtset_inputs(
&mut self,
process: ProcessState,
) -> Result<HostResponse, ExecutionError> {
injectors::smt::push_smtset_inputs(self, process)
}
}

impl<T> AdviceProvider for &mut T
Expand Down
2 changes: 0 additions & 2 deletions processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
},
Expand Down

0 comments on commit 6bff1cc

Please sign in to comment.