diff --git a/yarn-project/aztec-nr/authwit/src/entrypoint.nr b/yarn-project/aztec-nr/authwit/src/entrypoint.nr index 98987d49e362..13407a40eccc 100644 --- a/yarn-project/aztec-nr/authwit/src/entrypoint.nr +++ b/yarn-project/aztec-nr/authwit/src/entrypoint.nr @@ -1,13 +1,6 @@ -use dep::aztec::abi; use dep::aztec::context::PrivateContext; use dep::aztec::protocol_types::{ - abis::{ - call_stack_item::{ - PrivateCallStackItem, - PublicCallStackItem, - }, - function_selector::FunctionSelector, - }, + abis::function_selector::FunctionSelector, address::AztecAddress, constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, diff --git a/yarn-project/aztec-nr/aztec/src/context.nr b/yarn-project/aztec-nr/aztec/src/context.nr index c1e8bd5404c6..43ded219403c 100644 --- a/yarn-project/aztec-nr/aztec/src/context.nr +++ b/yarn-project/aztec-nr/aztec/src/context.nr @@ -24,10 +24,10 @@ use dep::protocol_types::{ function_data::FunctionData, function_selector::FunctionSelector, nullifier_key_validation_request::NullifierKeyValidationRequest, + private_call_stack_item::PrivateCallStackItem, private_circuit_public_inputs::PrivateCircuitPublicInputs, + public_call_stack_item::PublicCallStackItem, public_circuit_public_inputs::PublicCircuitPublicInputs, - call_stack_item::PrivateCallStackItem, - call_stack_item::PublicCallStackItem, side_effect::{SideEffect, SideEffectLinkedToNoteHash}, }, address::{ diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/common.nr b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/common.nr index 879295866260..10991a2d2e56 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/common.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/common.nr @@ -1,7 +1,7 @@ use dep::types::{ abis::{ call_request::CallRequest, - call_stack_item::PublicCallStackItem, + public_call_stack_item::PublicCallStackItem, combined_accumulated_data::{CombinedAccumulatedData, CombinedAccumulatedDataBuilder}, kernel_circuit_public_inputs::KernelCircuitPublicInputsBuilder, new_contract_data::NewContractData, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis.nr index 47605e17f6c5..a6edd512cebd 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis.nr @@ -25,7 +25,8 @@ mod kernel_circuit_public_inputs; mod previous_kernel_data; mod call_request; -mod call_stack_item; +mod private_call_stack_item; +mod public_call_stack_item; mod call_context; mod public_call_data; diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_call_stack_item.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_call_stack_item.nr new file mode 100644 index 000000000000..1f72d1063449 --- /dev/null +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_call_stack_item.nr @@ -0,0 +1,30 @@ +use crate::abis::{ + function_data::FunctionData, + private_circuit_public_inputs::PrivateCircuitPublicInputs, +}; +use crate::address::AztecAddress; +use crate::constants::GENERATOR_INDEX__CALL_STACK_ITEM; +use crate::traits::Hash; + +struct PrivateCallStackItem { + // This is the _actual_ contract address relating to where this function's code resides in the + // contract tree. Regardless of whether this is a call or delegatecall, this + // `contract_address` _does not change_. Amongst other things, it's used as a lookup for + // getting the correct code from the tree. There is a separate `storage_contract_address` + // within a CallStackItem which varies depending on whether this is a call or delegatecall. + contract_address: AztecAddress, + public_inputs: PrivateCircuitPublicInputs, + function_data: FunctionData, + // Not really needed for PrivateCallStackItem. + is_execution_request: bool, +} + +impl Hash for PrivateCallStackItem { + fn hash(self) -> Field { + dep::std::hash::pedersen_hash_with_separator([ + self.contract_address.to_field(), + self.function_data.hash(), + self.public_inputs.hash(), + ], GENERATOR_INDEX__CALL_STACK_ITEM) + } +} diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_kernel/private_call_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_kernel/private_call_data.nr index fb7bde97e681..b0365bbdb400 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_kernel/private_call_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_kernel/private_call_data.nr @@ -1,6 +1,6 @@ use crate::abis::{ call_request::CallRequest, - call_stack_item::PrivateCallStackItem, + private_call_stack_item::PrivateCallStackItem, membership_witness::{ ContractLeafMembershipWitness, FunctionLeafMembershipWitness, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_data.nr index bc59e74e109b..fc57026db5b5 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_data.nr @@ -1,7 +1,7 @@ use crate::{ abis::{ call_request::CallRequest, - call_stack_item::PublicCallStackItem, + public_call_stack_item::PublicCallStackItem, }, address::EthAddress, mocked::Proof, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_stack_item.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_stack_item.nr similarity index 58% rename from yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_stack_item.nr rename to yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_stack_item.nr index 45ebceaf0105..879b5e7d768f 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_stack_item.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_call_stack_item.nr @@ -1,37 +1,11 @@ use crate::abis::{ function_data::FunctionData, - private_circuit_public_inputs::PrivateCircuitPublicInputs, public_circuit_public_inputs::PublicCircuitPublicInputs, }; use crate::address::AztecAddress; -use crate::constants::{ - GENERATOR_INDEX__CALL_STACK_ITEM, -}; +use crate::constants::GENERATOR_INDEX__CALL_STACK_ITEM; use crate::traits::Hash; -struct PrivateCallStackItem { - // This is the _actual_ contract address relating to where this function's code resides in the - // contract tree. Regardless of whether this is a call or delegatecall, this - // `contract_address` _does not change_. Amongst other things, it's used as a lookup for - // getting the correct code from the tree. There is a separate `storage_contract_address` - // within a CallStackItem which varies depending on whether this is a call or delegatecall. - contract_address: AztecAddress, - public_inputs: PrivateCircuitPublicInputs, - function_data: FunctionData, - // Not really needed for PrivateCallStackItem. - is_execution_request: bool, -} - -impl Hash for PrivateCallStackItem { - fn hash(self) -> Field { - dep::std::hash::pedersen_hash_with_separator([ - self.contract_address.to_field(), - self.function_data.hash(), - self.public_inputs.hash(), - ], GENERATOR_INDEX__CALL_STACK_ITEM) - } -} - struct PublicCallStackItem { contract_address: AztecAddress, public_inputs: PublicCircuitPublicInputs, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/interop_testing.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/interop_testing.nr index e5d28d3eb487..7e80d5268f52 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/interop_testing.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/interop_testing.nr @@ -7,7 +7,7 @@ use crate::abis::function_leaf_preimage::FunctionLeafPreimage; use crate::contrakt::deployment_data::ContractDeploymentData; use crate::abis::function_selector::FunctionSelector; use crate::hash::{compute_l2_to_l1_hash, sha256_to_field}; -use crate::abis::call_stack_item::PublicCallStackItem; +use crate::abis::public_call_stack_item::PublicCallStackItem; use crate::abis::public_circuit_public_inputs::PublicCircuitPublicInputs; use crate::abis::side_effect::SideEffect; use crate::contract_class::ContractClassId; diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_call_data_builder.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_call_data_builder.nr index 4bfa514397a3..94053da6cd1d 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_call_data_builder.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_call_data_builder.nr @@ -1,7 +1,7 @@ use crate::{ abis::{ call_request::{CallerContext, CallRequest}, - call_stack_item::PrivateCallStackItem, + private_call_stack_item::PrivateCallStackItem, function_data::FunctionData, membership_witness::{ ContractLeafMembershipWitness, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_call_data_builder.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_call_data_builder.nr index 48dd0bb62e10..77f9c6164cb1 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_call_data_builder.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_call_data_builder.nr @@ -2,9 +2,9 @@ use crate::{ abis::{ call_context::CallContext, call_request::{CallerContext, CallRequest}, - call_stack_item::PublicCallStackItem, function_data::FunctionData, public_call_data::PublicCallData, + public_call_stack_item::PublicCallStackItem, public_circuit_public_inputs::PublicCircuitPublicInputs, }, address::{AztecAddress, EthAddress},