From d319e431df11443f21a8e66378a495875fc4be11 Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Thu, 9 May 2024 13:41:57 +0000 Subject: [PATCH] chore(avm-context): implement Empty --- .../aztec-nr/aztec/src/context/avm_context.nr | 8 +++++++- .../aztec/src/context/inputs/avm_context_inputs.nr | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/noir-projects/aztec-nr/aztec/src/context/avm_context.nr b/noir-projects/aztec-nr/aztec/src/context/avm_context.nr index d7180bd8338..d87c5e92c9b 100644 --- a/noir-projects/aztec-nr/aztec/src/context/avm_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/avm_context.nr @@ -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; @@ -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] { [ diff --git a/noir-projects/aztec-nr/aztec/src/context/inputs/avm_context_inputs.nr b/noir-projects/aztec-nr/aztec/src/context/inputs/avm_context_inputs.nr index ffd16b268ac..0000b903f6d 100644 --- a/noir-projects/aztec-nr/aztec/src/context/inputs/avm_context_inputs.nr +++ b/noir-projects/aztec-nr/aztec/src/context/inputs/avm_context_inputs.nr @@ -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, + } + } +}