Skip to content

Commit

Permalink
chore(avm-context): implement Empty (#6303)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed May 9, 2024
1 parent 0238254 commit 27534ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion noir-projects/aztec-nr/aztec/src/context/avm_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dep::protocol_types::{
address::{AztecAddress, EthAddress},
constants::{L1_TO_L2_MESSAGE_LENGTH, NESTED_CALL_L2_GAS_BUFFER}, header::Header
};
use dep::protocol_types::traits::Serialize;
use dep::protocol_types::traits::{Deserialize, Serialize, Empty};
use dep::protocol_types::abis::function_selector::FunctionSelector;
use dep::protocol_types::abis::public_circuit_public_inputs::PublicCircuitPublicInputs;
use crate::context::inputs::avm_context_inputs::AvmContextInputs;
Expand Down Expand Up @@ -191,6 +191,12 @@ impl ContextInterface for AvmContext {
}
}

impl Empty for AvmContext {
fn empty() -> Self {
AvmContext::new(AvmContextInputs::empty())
}
}

// Helper functions
fn gas_for_call(user_gas: GasOpts) -> [Field; 2] {
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
use dep::protocol_types::traits::Empty;

struct AvmContextInputs {
selector: Field,
args_hash: Field,
}

impl Empty for AvmContextInputs {
fn empty() -> Self {
AvmContextInputs {
selector: 0,
args_hash: 0,
}
}
}

0 comments on commit 27534ac

Please sign in to comment.