diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis.nr index 3dc638eca95..e422dd6436d 100644 --- a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis.nr +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis.nr @@ -29,6 +29,7 @@ mod call_request; mod private_call_stack_item; mod public_call_stack_item; mod call_context; +mod caller_context; mod public_call_data; diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr index 2f177ee4b0a..330e003ceb9 100644 --- a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr @@ -4,7 +4,7 @@ use crate::{ public_accumulated_non_revertible_data::PublicAccumulatedNonRevertibleData, public_accumulated_revertible_data::PublicAccumulatedRevertibleData }, - call_request::CallRequest, new_contract_data::NewContractData, + call_request::CallRequest, caller_context::CallerContext, new_contract_data::NewContractData, nullifier_key_validation_request::NullifierKeyValidationRequestContext, public_data_read::PublicDataRead, public_data_update_request::PublicDataUpdateRequest, side_effect::{SideEffect, SideEffectLinkedToNoteHash} @@ -94,7 +94,7 @@ impl CombinedAccumulatedData { mod tests { use crate::abis::{ accumulated_data::combined_accumulated_data_builder::CombinedAccumulatedDataBuilder, - call_request::{CallRequest, CallerContext}, new_contract_data::NewContractData, + call_request::CallRequest, caller_context::CallerContext, new_contract_data::NewContractData, nullifier_key_validation_request::NullifierKeyValidationRequestContext, public_data_read::PublicDataRead, public_data_update_request::PublicDataUpdateRequest, side_effect::{SideEffect, SideEffectLinkedToNoteHash} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/call_request.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/call_request.nr index 9d6f71fa5dd..8eca6227d7c 100644 --- a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/call_request.nr +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/call_request.nr @@ -1,33 +1,7 @@ use crate::address::AztecAddress; use dep::std::cmp::Eq; use crate::traits::Empty; - -struct CallerContext { - msg_sender: AztecAddress, - storage_contract_address: AztecAddress, -} - -impl Eq for CallerContext { - fn eq(self, caller_context: CallerContext) -> bool { - caller_context.msg_sender.eq(self.msg_sender) - & caller_context.storage_contract_address.eq(self.storage_contract_address) - } -} - -impl Empty for CallerContext { - fn empty() -> Self { - CallerContext { - msg_sender: AztecAddress::zero(), - storage_contract_address: AztecAddress::zero(), - } - } -} - -impl CallerContext { - pub fn is_empty(self) -> bool { - self.msg_sender.is_zero() & self.storage_contract_address.is_zero() - } -} +use crate::abis::caller_context::CallerContext; struct CallRequest { hash: Field, diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/caller_context.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/caller_context.nr new file mode 100644 index 00000000000..829429e4e9e --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/caller_context.nr @@ -0,0 +1,30 @@ +use crate::address::AztecAddress; +use dep::std::cmp::Eq; +use crate::traits::Empty; + +struct CallerContext { + msg_sender: AztecAddress, + storage_contract_address: AztecAddress, +} + +impl Eq for CallerContext { + fn eq(self, caller_context: CallerContext) -> bool { + caller_context.msg_sender.eq(self.msg_sender) + & caller_context.storage_contract_address.eq(self.storage_contract_address) + } +} + +impl Empty for CallerContext { + fn empty() -> Self { + CallerContext { + msg_sender: AztecAddress::zero(), + storage_contract_address: AztecAddress::zero(), + } + } +} + +impl CallerContext { + pub fn is_empty(self) -> bool { + self.msg_sender.is_zero() & self.storage_contract_address.is_zero() + } +}