From 301335479f45837e61e1b434566dff98a0867a37 Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Wed, 6 Dec 2023 08:13:08 +0000 Subject: [PATCH] refactor: Make noir-circuit independent of aztec-nr (#3591) Fixes #3589 by adding constants to `protocol-circuits` and removing them from `aztec-nr`. The importing looks a bit clunky after since reexports of modules did not seem to work in noir #3590. --- .../dev_docs/contracts/syntax/storage/main.md | 4 +- .../docs/dev_docs/debugging/sandbox-errors.md | 2 +- docs/docs/dev_docs/limitations/main.md | 2 +- .../writing_private_voting_contract.md | 2 +- .../src/core/libraries/ConstantsGen.sol | 2 + yarn-project/aztec-nr/authwit/Nargo.toml | 3 +- yarn-project/aztec-nr/authwit/src/auth.nr | 2 +- .../aztec-nr/authwit/src/entrypoint.nr | 2 +- yarn-project/aztec-nr/aztec/Nargo.toml | 3 +- yarn-project/aztec-nr/aztec/src/abi.nr | 2 +- yarn-project/aztec-nr/aztec/src/address.nr | 2 +- yarn-project/aztec-nr/aztec/src/context.nr | 2 +- yarn-project/aztec-nr/aztec/src/hash.nr | 2 +- yarn-project/aztec-nr/aztec/src/lib.nr | 1 - .../aztec/src/messaging/l1_to_l2_message.nr | 2 +- .../messaging/l1_to_l2_message_getter_data.nr | 2 +- .../aztec-nr/aztec/src/note/lifecycle.nr | 2 +- .../aztec-nr/aztec/src/note/note_getter.nr | 2 +- .../aztec/src/note/note_getter_options.nr | 2 +- .../aztec-nr/aztec/src/note/note_hash.nr | 2 +- .../aztec/src/note/note_viewer_options.nr | 2 +- yarn-project/aztec-nr/aztec/src/note/utils.nr | 2 +- .../aztec/src/oracle/call_private_function.nr | 2 +- .../aztec/src/oracle/get_block_header.nr | 9 +- .../aztec/src/oracle/get_l1_to_l2_message.nr | 2 +- .../src/oracle/get_membership_witness.nr | 2 +- .../get_nullifier_membership_witness.nr | 2 +- .../aztec/src/oracle/get_sibling_path.nr | 2 +- .../aztec-nr/aztec/src/oracle/logs.nr | 2 +- .../aztec-nr/aztec/src/oracle/public_call.nr | 2 +- .../aztec/src/private_call_stack_item.nr | 2 +- .../aztec/src/public_call_stack_item.nr | 2 +- .../src/state_vars/immutable_singleton.nr | 2 +- .../aztec-nr/aztec/src/state_vars/set.nr | 2 +- .../aztec/src/state_vars/singleton.nr | 2 +- yarn-project/aztec-nr/value-note/Nargo.toml | 3 +- .../aztec-nr/value-note/src/filter.nr | 2 +- .../boxes/token/src/contracts/Nargo.toml | 3 +- .../src/contracts/src/types/balance_set.nr | 2 +- .../src/contracts/src/types/token_note.nr | 2 +- yarn-project/circuits.js/src/constants.gen.ts | 2 + .../circuits.js/src/scripts/constants.in.ts | 2 +- .../src/__snapshots__/index.test.ts.snap | 4 +- .../src/contract-interface-gen/noir.ts | 2 +- .../contracts/card_game_contract/Nargo.toml | 1 + .../contracts/card_game_contract/src/cards.nr | 2 +- .../contracts/card_game_contract/src/main.nr | 2 +- .../docs_example_contract/Nargo.toml | 3 +- .../docs_example_contract/src/actions.nr | 2 +- .../docs_example_contract/src/options.nr | 2 +- .../easy_private_voting_contract/Nargo.toml | 3 +- .../easy_private_voting_contract/src/main.nr | 2 +- .../contracts/import_test_contract/Nargo.toml | 3 +- .../inclusion_proofs_contract/Nargo.toml | 3 +- .../inclusion_proofs_contract/src/main.nr | 11 +-- .../src/contracts/lending_contract/Nargo.toml | 3 +- .../lending_contract/src/interfaces.nr | 2 +- .../src/contracts/test_contract/Nargo.toml | 1 + .../contracts/test_contract/src/interface.nr | 2 +- .../src/contracts/test_contract/src/main.nr | 3 +- .../token_blacklist_contract/Nargo.toml | 3 +- .../src/types/balance_set.nr | 2 +- .../src/types/token_note.nr | 2 +- .../src/contracts/token_contract/Nargo.toml | 3 +- .../token_contract/src/types/balance_set.nr | 2 +- .../token_contract/src/types/token_note.nr | 2 +- .../src/crates/private-kernel-lib/Nargo.toml | 1 - .../crates/private-kernel-lib/src/common.nr | 16 ++-- .../src/private_kernel_init.nr | 4 +- .../src/private_kernel_inner.nr | 2 +- .../src/private_kernel_ordering.nr | 14 ++-- .../src/crates/public-kernel-lib/Nargo.toml | 1 - .../crates/public-kernel-lib/src/common.nr | 21 +++-- .../src/crates/public-kernel-lib/src/hash.nr | 9 +- .../src/public_kernel_private_previous.nr | 2 +- .../src/public_kernel_public_previous.nr | 2 +- .../Nargo.toml | 1 - .../public-kernel-private-previous/Nargo.toml | 1 - .../Nargo.toml | 1 - .../public-kernel-public-previous/Nargo.toml | 1 - .../src/crates/rollup-lib/Nargo.toml | 1 - .../base_or_merge_rollup_public_inputs.nr | 2 +- .../rollup-lib/src/abis/global_variables.nr | 4 +- .../src/abis/previous_rollup_data.nr | 2 +- .../rollup-lib/src/base/base_rollup_inputs.nr | 5 +- .../src/crates/rollup-lib/src/components.nr | 2 +- .../src/crates/rollup-lib/src/hash.nr | 4 +- .../src/crates/rollup-lib/src/root.nr | 2 +- .../rollup-lib/src/root/root_rollup_inputs.nr | 2 +- .../src/root/root_rollup_public_inputs.nr | 2 +- .../src/tests/root_rollup_inputs.nr | 2 +- .../src/crates/types/Nargo.toml | 1 - .../src/crates/types/src/abis/call_context.nr | 4 +- .../crates/types/src/abis/call_stack_item.nr | 2 +- .../src/abis/combined_accumulated_data.nr | 2 +- .../crates/types/src/abis/function_data.nr | 4 +- .../types/src/abis/function_leaf_preimage.nr | 4 +- .../types/src/abis/membership_witness.nr | 2 +- .../types/src/abis/new_contract_data.nr | 4 +- .../types/src/abis/previous_kernel_data.nr | 2 +- .../src/abis/private_circuit_public_inputs.nr | 13 ++- .../abis/private_kernel/private_call_data.nr | 2 +- .../crates/types/src/abis/public_call_data.nr | 2 +- .../src/abis/public_circuit_public_inputs.nr | 11 +-- .../crates/types/src/abis/public_data_read.nr | 4 +- .../src/abis/public_data_update_request.nr | 2 +- .../src/crates/types/src/block.nr | 4 +- .../src/crates/types/src/constants.nr} | 3 + .../types/src/contrakt/deployment_data.nr | 4 +- .../crates/types/src/contrakt/storage_read.nr | 4 +- .../src/contrakt/storage_update_request.nr | 2 +- .../src/crates/types/src/hash.nr | 83 ++++++++++++++++--- .../src/crates/types/src/interop_testing.nr | 3 +- .../src/crates/types/src/lib.nr | 1 + .../types/src/tests/fixtures/read_requests.nr | 4 +- .../src/tests/previous_kernel_data_builder.nr | 4 +- .../src/tests/private_call_data_builder.nr | 4 +- .../private_circuit_public_inputs_builder.nr | 7 +- .../src/tests/public_call_data_builder.nr | 2 +- .../public_circuit_public_inputs_builder.nr | 2 +- .../crates/types/src/transaction/context.nr | 5 +- .../crates/types/src/transaction/request.nr | 4 +- 122 files changed, 259 insertions(+), 201 deletions(-) rename yarn-project/{aztec-nr/aztec/src/constants_gen.nr => noir-protocol-circuits/src/crates/types/src/constants.nr} (99%) diff --git a/docs/docs/dev_docs/contracts/syntax/storage/main.md b/docs/docs/dev_docs/contracts/syntax/storage/main.md index 4d0ca41e3a3..da66458882f 100644 --- a/docs/docs/dev_docs/contracts/syntax/storage/main.md +++ b/docs/docs/dev_docs/contracts/syntax/storage/main.md @@ -416,7 +416,7 @@ An example of how to use this operation is visible in the `easy_private_state`: This function returns the notes the account has access to. -The kernel circuits are constrained to a maximum number of notes this function can return at a time. Check [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec-nr/aztec/src/constants_gen.nr) and look for `MAX_READ_REQUESTS_PER_CALL` for the up-to-date number. +The kernel circuits are constrained to a maximum number of notes this function can return at a time. Check [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr) and look for `MAX_READ_REQUESTS_PER_CALL` for the up-to-date number. Because of this limit, we should always consider using the second argument `NoteGetterOptions` to limit the number of notes we need to read and constrain in our programs. This is quite important as every extra call increases the time used to prove the program and we don't want to spend more time than necessary. @@ -430,7 +430,7 @@ Functionally similar to [`get_notes`](#get_notes), but executed unconstrained an #include_code view_notes /yarn-project/aztec-nr/value-note/src/balance_utils.nr rust -There's also a limit on the maximum number of notes that can be returned in one go. To find the current limit, refer to [this file](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec-nr/aztec/src/constants_gen.nr) and look for `MAX_NOTES_PER_PAGE`. +There's also a limit on the maximum number of notes that can be returned in one go. To find the current limit, refer to [this file](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr) and look for `MAX_NOTES_PER_PAGE`. The key distinction is that this method is unconstrained. It does not perform a check to verify if the notes actually exist, which is something the [`get_notes`](#get_notes) method does under the hood. Therefore, it should only be used in an unconstrained contract function. diff --git a/docs/docs/dev_docs/debugging/sandbox-errors.md b/docs/docs/dev_docs/debugging/sandbox-errors.md index c7c2879eef3..f95925a4da2 100644 --- a/docs/docs/dev_docs/debugging/sandbox-errors.md +++ b/docs/docs/dev_docs/debugging/sandbox-errors.md @@ -160,7 +160,7 @@ Circuits work by having a fixed size array. As such, we have limits on how many - too many transient read requests in one tx - too many transient read request membership witnesses in one tx -You can have a look at our current constants/limitations in [constants.nr](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec-nr/aztec/src/constants_gen.nr) +You can have a look at our current constants/limitations in [constants.nr](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr) #### 7008 - MEMBERSHIP_CHECK_FAILED diff --git a/docs/docs/dev_docs/limitations/main.md b/docs/docs/dev_docs/limitations/main.md index c697898a6f7..bc28d3fd480 100644 --- a/docs/docs/dev_docs/limitations/main.md +++ b/docs/docs/dev_docs/limitations/main.md @@ -189,7 +189,7 @@ Due to the rigidity of zk-SNARK circuits, there are upper bounds on the amount o Here are the current constants: -#include_code constants /yarn-project/aztec-nr/aztec/src/constants_gen.nr rust +#include_code constants /yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr rust #### What are the consequences? diff --git a/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md b/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md index a541e3abf5d..24ba1d18515 100644 --- a/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md +++ b/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md @@ -75,7 +75,7 @@ We are using various utils within the Aztec library: * `state_vars::{ map::Map, public_state::PublicState, }` - we will use a Map to store the votes (key = voteId, value = number of votes), and PublicState to hold our public values that we mentioned earlier * `types::type_serialization::{..}` - various serialization methods for defining how to use these types * `types::address::{AztecAddress},` - our admin will be held as an address -* `constants_gen::EMPTY_NULLIFIED_COMMITMENT,` - this will come in useful when creating our nullifier +* `constants::EMPTY_NULLIFIED_COMMITMENT,` - this will come in useful when creating our nullifier ## Set up storage diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 9c54ac10619..e033fc779a5 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -63,6 +63,8 @@ library Constants { uint256 internal constant FUNCTION_SELECTOR_NUM_BYTES = 4; uint256 internal constant MAPPING_SLOT_PEDERSEN_SEPARATOR = 4; uint256 internal constant NUM_FIELDS_PER_SHA256 = 2; + uint256 internal constant ARGS_HASH_CHUNK_LENGTH = 32; + uint256 internal constant ARGS_HASH_CHUNK_COUNT = 16; uint256 internal constant L1_TO_L2_MESSAGE_LENGTH = 8; uint256 internal constant L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 26; uint256 internal constant MAX_NOTE_FIELDS_LENGTH = 20; diff --git a/yarn-project/aztec-nr/authwit/Nargo.toml b/yarn-project/aztec-nr/authwit/Nargo.toml index ab4e80b840a..e2259943251 100644 --- a/yarn-project/aztec-nr/authwit/Nargo.toml +++ b/yarn-project/aztec-nr/authwit/Nargo.toml @@ -5,4 +5,5 @@ compiler_version = ">=0.18.0" type = "lib" [dependencies] -aztec = { path = "../aztec" } \ No newline at end of file +aztec = { path = "../aztec" } +protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/aztec-nr/authwit/src/auth.nr b/yarn-project/aztec-nr/authwit/src/auth.nr index 61952330832..bcf2cad5bca 100644 --- a/yarn-project/aztec-nr/authwit/src/auth.nr +++ b/yarn-project/aztec-nr/authwit/src/auth.nr @@ -1,6 +1,6 @@ +use dep::protocol_types::constants::{EMPTY_NULLIFIED_COMMITMENT, GENERATOR_INDEX__SIGNATURE_PAYLOAD}; use dep::aztec::{ context::{PrivateContext, PublicContext, Context}, - constants_gen::{EMPTY_NULLIFIED_COMMITMENT, GENERATOR_INDEX__SIGNATURE_PAYLOAD}, types::address::AztecAddress, abi::hash_args, hash::pedersen_hash, diff --git a/yarn-project/aztec-nr/authwit/src/entrypoint.nr b/yarn-project/aztec-nr/authwit/src/entrypoint.nr index 227be7d17fc..aac0f72f66c 100644 --- a/yarn-project/aztec-nr/authwit/src/entrypoint.nr +++ b/yarn-project/aztec-nr/authwit/src/entrypoint.nr @@ -4,7 +4,7 @@ use dep::aztec::hash::pedersen_hash; use dep::aztec::context::PrivateContext; use dep::aztec::private_call_stack_item::PrivateCallStackItem; use dep::aztec::public_call_stack_item::PublicCallStackItem; -use dep::aztec::constants_gen::GENERATOR_INDEX__SIGNATURE_PAYLOAD; +use dep::protocol_types::constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD; global ACCOUNT_MAX_CALLS: Field = 4; // 1 (ARGS_HASH) + 1 (FUNCTION_SELECTOR) + 1 (TARGET_ADDRESS) + 1 (IS_PUBLIC) diff --git a/yarn-project/aztec-nr/aztec/Nargo.toml b/yarn-project/aztec-nr/aztec/Nargo.toml index 1928f6137cd..8fb5e972533 100644 --- a/yarn-project/aztec-nr/aztec/Nargo.toml +++ b/yarn-project/aztec-nr/aztec/Nargo.toml @@ -4,4 +4,5 @@ authors = ["aztec-labs"] compiler_version = ">=0.18.0" type = "lib" -[dependencies] \ No newline at end of file +[dependencies] +protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/aztec-nr/aztec/src/abi.nr b/yarn-project/aztec-nr/aztec/src/abi.nr index 9d9f8a79321..b484842dc2d 100644 --- a/yarn-project/aztec-nr/aztec/src/abi.nr +++ b/yarn-project/aztec-nr/aztec/src/abi.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::{ +use dep::protocol_types::constants::{ RETURN_VALUES_LENGTH, MAX_READ_REQUESTS_PER_CALL, MAX_PENDING_READ_REQUESTS_PER_CALL, diff --git a/yarn-project/aztec-nr/aztec/src/address.nr b/yarn-project/aztec-nr/aztec/src/address.nr index f1f4224513c..d569f33eea5 100644 --- a/yarn-project/aztec-nr/aztec/src/address.nr +++ b/yarn-project/aztec-nr/aztec/src/address.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::GENERATOR_INDEX__CONTRACT_ADDRESS; +use dep::protocol_types::constants::GENERATOR_INDEX__CONTRACT_ADDRESS; use crate::hash::pedersen_hash; pub fn compute_address(pub_key_x: Field, pub_key_y: Field, partial_address: Field) -> Field { diff --git a/yarn-project/aztec-nr/aztec/src/context.nr b/yarn-project/aztec-nr/aztec/src/context.nr index b259558b3fb..c7609942d4c 100644 --- a/yarn-project/aztec-nr/aztec/src/context.nr +++ b/yarn-project/aztec-nr/aztec/src/context.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::{ +use dep::protocol_types::constants::{ EMPTY_NULLIFIED_COMMITMENT, MAX_NEW_COMMITMENTS_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, diff --git a/yarn-project/aztec-nr/aztec/src/hash.nr b/yarn-project/aztec-nr/aztec/src/hash.nr index f8d3abb51aa..eb9fb57aff0 100644 --- a/yarn-project/aztec-nr/aztec/src/hash.nr +++ b/yarn-project/aztec-nr/aztec/src/hash.nr @@ -1,5 +1,5 @@ use dep::std::hash::{pedersen_hash_with_separator, sha256}; -use crate::constants_gen::{ +use dep::protocol_types::constants::{ GENERATOR_INDEX__SIGNATURE_PAYLOAD, GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET, }; diff --git a/yarn-project/aztec-nr/aztec/src/lib.nr b/yarn-project/aztec-nr/aztec/src/lib.nr index d1080f9056f..99c087b0075 100644 --- a/yarn-project/aztec-nr/aztec/src/lib.nr +++ b/yarn-project/aztec-nr/aztec/src/lib.nr @@ -1,6 +1,5 @@ mod abi; mod address; -mod constants_gen; mod context; mod hash; mod log; diff --git a/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr b/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr index 2e2a254577c..0be0fc4b3ac 100644 --- a/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr +++ b/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::{ +use dep::protocol_types::constants::{ L1_TO_L2_MESSAGE_LENGTH, GENERATOR_INDEX__NULLIFIER, GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET, diff --git a/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message_getter_data.nr b/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message_getter_data.nr index 396d758006a..fbf194d76d1 100644 --- a/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message_getter_data.nr +++ b/yarn-project/aztec-nr/aztec/src/messaging/l1_to_l2_message_getter_data.nr @@ -1,5 +1,5 @@ use crate::messaging::l1_to_l2_message::L1ToL2Message; -use crate::constants_gen::{ +use dep::protocol_types::constants::{ L1_TO_L2_MSG_TREE_HEIGHT, L1_TO_L2_MESSAGE_LENGTH, }; diff --git a/yarn-project/aztec-nr/aztec/src/note/lifecycle.nr b/yarn-project/aztec-nr/aztec/src/note/lifecycle.nr index f44d8ab31ec..b36d7e3fc06 100644 --- a/yarn-project/aztec-nr/aztec/src/note/lifecycle.nr +++ b/yarn-project/aztec-nr/aztec/src/note/lifecycle.nr @@ -9,7 +9,7 @@ use crate::note::{ utils::compute_inner_note_hash, }; use crate::oracle::notes::{notify_created_note, notify_nullified_note}; -use crate::constants_gen::EMPTY_NULLIFIED_COMMITMENT; +use dep::protocol_types::constants::EMPTY_NULLIFIED_COMMITMENT; pub fn create_note( context: &mut PrivateContext, diff --git a/yarn-project/aztec-nr/aztec/src/note/note_getter.nr b/yarn-project/aztec-nr/aztec/src/note/note_getter.nr index 1e5131a22ae..3827e4641e7 100644 --- a/yarn-project/aztec-nr/aztec/src/note/note_getter.nr +++ b/yarn-project/aztec-nr/aztec/src/note/note_getter.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use crate::constants_gen::{ +use dep::protocol_types::constants::{ MAX_READ_REQUESTS_PER_CALL, GET_NOTE_ORACLE_RETURN_LENGTH, GET_NOTES_ORACLE_RETURN_LENGTH, diff --git a/yarn-project/aztec-nr/aztec/src/note/note_getter_options.nr b/yarn-project/aztec-nr/aztec/src/note/note_getter_options.nr index c43fd996850..67dabe8593d 100644 --- a/yarn-project/aztec-nr/aztec/src/note/note_getter_options.nr +++ b/yarn-project/aztec-nr/aztec/src/note/note_getter_options.nr @@ -1,6 +1,6 @@ use dep::std::option::Option; use crate::types::vec::BoundedVec; -use crate::constants_gen::MAX_READ_REQUESTS_PER_CALL; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; struct Select { field_index: u8, diff --git a/yarn-project/aztec-nr/aztec/src/note/note_hash.nr b/yarn-project/aztec-nr/aztec/src/note/note_hash.nr index 4e3618fa650..dc2c6c2c8b3 100644 --- a/yarn-project/aztec-nr/aztec/src/note/note_hash.nr +++ b/yarn-project/aztec-nr/aztec/src/note/note_hash.nr @@ -1,5 +1,5 @@ use crate::hash::pedersen_hash; -use crate::constants_gen::{GENERATOR_INDEX__UNIQUE_COMMITMENT, GENERATOR_INDEX__SILOED_COMMITMENT}; +use dep::protocol_types::constants::{GENERATOR_INDEX__UNIQUE_COMMITMENT, GENERATOR_INDEX__SILOED_COMMITMENT}; pub fn compute_inner_hash(storage_slot: Field, note_hash: Field) -> Field { // TODO(#1205) Do we need a generator index here? diff --git a/yarn-project/aztec-nr/aztec/src/note/note_viewer_options.nr b/yarn-project/aztec-nr/aztec/src/note/note_viewer_options.nr index 709237c4437..15d445d2c02 100644 --- a/yarn-project/aztec-nr/aztec/src/note/note_viewer_options.nr +++ b/yarn-project/aztec-nr/aztec/src/note/note_viewer_options.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use crate::constants_gen::MAX_NOTES_PER_PAGE; +use dep::protocol_types::constants::MAX_NOTES_PER_PAGE; use crate::note::note_getter_options::{Select, Sort}; use crate::types::vec::BoundedVec; diff --git a/yarn-project/aztec-nr/aztec/src/note/utils.nr b/yarn-project/aztec-nr/aztec/src/note/utils.nr index cf40eaeba9b..685c565d538 100644 --- a/yarn-project/aztec-nr/aztec/src/note/utils.nr +++ b/yarn-project/aztec-nr/aztec/src/note/utils.nr @@ -1,5 +1,5 @@ +use dep::protocol_types::constants::GENERATOR_INDEX__OUTER_NULLIFIER; use crate::{ - constants_gen::GENERATOR_INDEX__OUTER_NULLIFIER, note::{ note_hash::{compute_inner_hash, compute_siloed_hash, compute_unique_hash}, note_header::NoteHeader, diff --git a/yarn-project/aztec-nr/aztec/src/oracle/call_private_function.nr b/yarn-project/aztec-nr/aztec/src/oracle/call_private_function.nr index a5ab1eb95f3..ac687b1d2a3 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/call_private_function.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/call_private_function.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::CALL_PRIVATE_FUNCTION_RETURN_SIZE; +use dep::protocol_types::constants::CALL_PRIVATE_FUNCTION_RETURN_SIZE; #[oracle(callPrivateFunction)] fn call_private_function_oracle(_contract_address: Field, _function_selector: Field, _args_hash: Field) -> [Field; CALL_PRIVATE_FUNCTION_RETURN_SIZE] {} diff --git a/yarn-project/aztec-nr/aztec/src/oracle/get_block_header.nr b/yarn-project/aztec-nr/aztec/src/oracle/get_block_header.nr index d3281e671da..9d15d693393 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/get_block_header.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/get_block_header.nr @@ -1,10 +1,11 @@ use dep::std::merkle::compute_merkle_root; +use dep::protocol_types::constants::{ + BLOCK_HEADER_LENGTH, + ARCHIVE_HEIGHT, +}; + use crate::{ abi::BlockHeader, - constants_gen::{ - BLOCK_HEADER_LENGTH, - ARCHIVE_HEIGHT, - }, context::PrivateContext, oracle::get_membership_witness::{ get_membership_witness, diff --git a/yarn-project/aztec-nr/aztec/src/oracle/get_l1_to_l2_message.nr b/yarn-project/aztec-nr/aztec/src/oracle/get_l1_to_l2_message.nr index 358511db402..27f6722ae1b 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/get_l1_to_l2_message.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/get_l1_to_l2_message.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH; +use dep::protocol_types::constants::L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH; // Checks if a msg is within the l1ToL2Msg tree #[oracle(getL1ToL2Message)] diff --git a/yarn-project/aztec-nr/aztec/src/oracle/get_membership_witness.nr b/yarn-project/aztec-nr/aztec/src/oracle/get_membership_witness.nr index 5122e685d3e..1f43ae52f57 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/get_membership_witness.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/get_membership_witness.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::NOTE_HASH_TREE_HEIGHT; +use dep::protocol_types::constants::NOTE_HASH_TREE_HEIGHT; use crate::utils::arr_copy_slice; // Note: We have M here because we need to somehow set it when calling get_membership_witness function and one way to diff --git a/yarn-project/aztec-nr/aztec/src/oracle/get_nullifier_membership_witness.nr b/yarn-project/aztec-nr/aztec/src/oracle/get_nullifier_membership_witness.nr index 64d073d42cb..2cc493d7966 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/get_nullifier_membership_witness.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/get_nullifier_membership_witness.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::NULLIFIER_TREE_HEIGHT; +use dep::protocol_types::constants::NULLIFIER_TREE_HEIGHT; use crate::utils::arr_copy_slice; use crate::hash::pedersen_hash; diff --git a/yarn-project/aztec-nr/aztec/src/oracle/get_sibling_path.nr b/yarn-project/aztec-nr/aztec/src/oracle/get_sibling_path.nr index 076a4748d69..7fbe0936997 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/get_sibling_path.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/get_sibling_path.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::NOTE_HASH_TREE_HEIGHT; +use dep::protocol_types::constants::NOTE_HASH_TREE_HEIGHT; use crate::utils::arr_copy_slice; #[oracle(getSiblingPath)] diff --git a/yarn-project/aztec-nr/aztec/src/oracle/logs.nr b/yarn-project/aztec-nr/aztec/src/oracle/logs.nr index caab7b2a13c..6690243c9f5 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/logs.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/logs.nr @@ -1,5 +1,5 @@ use crate::types::point::Point; -use crate::constants_gen::NUM_FIELDS_PER_SHA256; +use dep::protocol_types::constants::NUM_FIELDS_PER_SHA256; // TODO: Should take encrypted data. #[oracle(emitEncryptedLog)] diff --git a/yarn-project/aztec-nr/aztec/src/oracle/public_call.nr b/yarn-project/aztec-nr/aztec/src/oracle/public_call.nr index cda65354018..e8190c49dd3 100644 --- a/yarn-project/aztec-nr/aztec/src/oracle/public_call.nr +++ b/yarn-project/aztec-nr/aztec/src/oracle/public_call.nr @@ -1,4 +1,4 @@ -use crate::constants_gen::RETURN_VALUES_LENGTH; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH; #[oracle(callPublicFunction)] fn call_public_function_oracle(_contract_address: Field, _function_selector: Field, _args_hash: Field) -> [Field; RETURN_VALUES_LENGTH] {} diff --git a/yarn-project/aztec-nr/aztec/src/private_call_stack_item.nr b/yarn-project/aztec-nr/aztec/src/private_call_stack_item.nr index 9742106c152..73fedb091ff 100644 --- a/yarn-project/aztec-nr/aztec/src/private_call_stack_item.nr +++ b/yarn-project/aztec-nr/aztec/src/private_call_stack_item.nr @@ -1,6 +1,6 @@ use crate::abi::FunctionData; use crate::abi::PrivateCircuitPublicInputs; -use crate::constants_gen::GENERATOR_INDEX__CALL_STACK_ITEM; +use dep::protocol_types::constants::GENERATOR_INDEX__CALL_STACK_ITEM; use crate::hash::pedersen_hash; struct PrivateCallStackItem { diff --git a/yarn-project/aztec-nr/aztec/src/public_call_stack_item.nr b/yarn-project/aztec-nr/aztec/src/public_call_stack_item.nr index 6c557b9aa57..734d7ea7ee4 100644 --- a/yarn-project/aztec-nr/aztec/src/public_call_stack_item.nr +++ b/yarn-project/aztec-nr/aztec/src/public_call_stack_item.nr @@ -6,7 +6,7 @@ use crate::{ FunctionData, }, }; -use crate::constants_gen::{ +use dep::protocol_types::constants::{ RETURN_VALUES_LENGTH, GENERATOR_INDEX__CALL_STACK_ITEM, }; diff --git a/yarn-project/aztec-nr/aztec/src/state_vars/immutable_singleton.nr b/yarn-project/aztec-nr/aztec/src/state_vars/immutable_singleton.nr index 1084fb5a865..48537a552b9 100644 --- a/yarn-project/aztec-nr/aztec/src/state_vars/immutable_singleton.nr +++ b/yarn-project/aztec-nr/aztec/src/state_vars/immutable_singleton.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use crate::constants_gen::EMPTY_NULLIFIED_COMMITMENT; +use dep::protocol_types::constants::EMPTY_NULLIFIED_COMMITMENT; use crate::context::{PrivateContext, Context}; use crate::note::{ lifecycle::create_note, diff --git a/yarn-project/aztec-nr/aztec/src/state_vars/set.nr b/yarn-project/aztec-nr/aztec/src/state_vars/set.nr index 66a39382f47..1c9a317fb28 100644 --- a/yarn-project/aztec-nr/aztec/src/state_vars/set.nr +++ b/yarn-project/aztec-nr/aztec/src/state_vars/set.nr @@ -1,6 +1,6 @@ use dep::std::option::Option; use crate::abi::PublicContextInputs; -use crate::constants_gen::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}; +use dep::protocol_types::constants::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}; use crate::context::{PrivateContext, PublicContext, Context}; use crate::note::{ lifecycle::{create_note, create_note_hash_from_public, destroy_note}, diff --git a/yarn-project/aztec-nr/aztec/src/state_vars/singleton.nr b/yarn-project/aztec-nr/aztec/src/state_vars/singleton.nr index 9f64faf3c82..99ad829f1f5 100644 --- a/yarn-project/aztec-nr/aztec/src/state_vars/singleton.nr +++ b/yarn-project/aztec-nr/aztec/src/state_vars/singleton.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use crate::constants_gen::{EMPTY_NULLIFIED_COMMITMENT, GENERATOR_INDEX__INITIALIZATION_NULLIFIER}; +use dep::protocol_types::constants::{EMPTY_NULLIFIED_COMMITMENT, GENERATOR_INDEX__INITIALIZATION_NULLIFIER}; use crate::context::{PrivateContext, PublicContext, Context}; use crate::note::{ lifecycle::{create_note, destroy_note}, diff --git a/yarn-project/aztec-nr/value-note/Nargo.toml b/yarn-project/aztec-nr/value-note/Nargo.toml index b1f4a276738..7f87db94351 100644 --- a/yarn-project/aztec-nr/value-note/Nargo.toml +++ b/yarn-project/aztec-nr/value-note/Nargo.toml @@ -5,4 +5,5 @@ compiler_version = ">=0.18.0" type = "lib" [dependencies] -aztec = { path = "../aztec" } \ No newline at end of file +aztec = { path = "../aztec" } +protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/aztec-nr/value-note/src/filter.nr b/yarn-project/aztec-nr/value-note/src/filter.nr index 8657358cf10..bd0d3025772 100644 --- a/yarn-project/aztec-nr/value-note/src/filter.nr +++ b/yarn-project/aztec-nr/value-note/src/filter.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use dep::aztec::constants_gen::MAX_READ_REQUESTS_PER_CALL; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use crate::value_note::ValueNote; pub fn filter_notes_min_sum(notes: [Option; MAX_READ_REQUESTS_PER_CALL], min_sum: Field) -> [Option; MAX_READ_REQUESTS_PER_CALL] { diff --git a/yarn-project/boxes/token/src/contracts/Nargo.toml b/yarn-project/boxes/token/src/contracts/Nargo.toml index 469bf27dcc3..a69d8c878a0 100644 --- a/yarn-project/boxes/token/src/contracts/Nargo.toml +++ b/yarn-project/boxes/token/src/contracts/Nargo.toml @@ -8,4 +8,5 @@ type = "contract" aztec = { path = "../../../../aztec-nr/aztec" } value_note = { path = "../../../../aztec-nr/value-note"} safe_math = { path = "../../../../aztec-nr/safe-math" } -authwit = { path = "../../../../aztec-nr/authwit" } \ No newline at end of file +authwit = { path = "../../../../aztec-nr/authwit" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/boxes/token/src/contracts/src/types/balance_set.nr b/yarn-project/boxes/token/src/contracts/src/types/balance_set.nr index 37dbcd4ddbe..9be83b78710 100644 --- a/yarn-project/boxes/token/src/contracts/src/types/balance_set.nr +++ b/yarn-project/boxes/token/src/contracts/src/types/balance_set.nr @@ -1,8 +1,8 @@ use dep::std::option::Option; use dep::safe_math::SafeU120; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ context::Context, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, types::address::AztecAddress, }; diff --git a/yarn-project/boxes/token/src/contracts/src/types/token_note.nr b/yarn-project/boxes/token/src/contracts/src/types/token_note.nr index fac2b5eeca3..a524d08c9e4 100644 --- a/yarn-project/boxes/token/src/contracts/src/types/token_note.nr +++ b/yarn-project/boxes/token/src/contracts/src/types/token_note.nr @@ -1,3 +1,4 @@ +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ note::{ note_header::NoteHeader, @@ -6,7 +7,6 @@ use dep::aztec::{ }, hash::pedersen_hash, context::PrivateContext, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, log::emit_encrypted_log, }; diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 9f1d1464080..f0cfac323a9 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -49,6 +49,8 @@ export const L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH = 12; export const FUNCTION_SELECTOR_NUM_BYTES = 4; export const MAPPING_SLOT_PEDERSEN_SEPARATOR = 4; export const NUM_FIELDS_PER_SHA256 = 2; +export const ARGS_HASH_CHUNK_LENGTH = 32; +export const ARGS_HASH_CHUNK_COUNT = 16; export const L1_TO_L2_MESSAGE_LENGTH = 8; export const L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 26; export const MAX_NOTE_FIELDS_LENGTH = 20; diff --git a/yarn-project/circuits.js/src/scripts/constants.in.ts b/yarn-project/circuits.js/src/scripts/constants.in.ts index 123bea6ffce..14892b1e1fe 100644 --- a/yarn-project/circuits.js/src/scripts/constants.in.ts +++ b/yarn-project/circuits.js/src/scripts/constants.in.ts @@ -3,7 +3,7 @@ import { fileURLToPath } from '@aztec/foundation/url'; import * as fs from 'fs'; import { dirname, join } from 'path'; -const NOIR_CONSTANTS_FILE = '../../../aztec-nr/aztec/src/constants_gen.nr'; +const NOIR_CONSTANTS_FILE = '../../../noir-protocol-circuits/src/crates/types/src/constants.nr'; const TS_CONSTANTS_FILE = '../constants.gen.ts'; const SOLIDITY_CONSTANTS_FILE = '../../../../l1-contracts/src/core/libraries/ConstantsGen.sol'; diff --git a/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap b/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap index 1c00e7c76f5..b9e79a46077 100644 --- a/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap +++ b/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap @@ -47,7 +47,7 @@ exports[`noir-compiler using nargo generates Aztec.nr external interface 1`] = ` use dep::std; use dep::aztec::context::{ PrivateContext, PublicContext }; -use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH; @@ -240,7 +240,7 @@ exports[`noir-compiler using wasm binary generates Aztec.nr external interface 1 use dep::std; use dep::aztec::context::{ PrivateContext, PublicContext }; -use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH; diff --git a/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts b/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts index ab91b78d8d6..ecc5ffb771d 100644 --- a/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts +++ b/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts @@ -167,7 +167,7 @@ ${callStatement} function generateStaticImports() { return `use dep::std; use dep::aztec::context::{ PrivateContext, PublicContext }; -use dep::aztec::constants_gen::RETURN_VALUES_LENGTH;`; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH;`; } /** diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml index 03bfe065166..32e7ab21040 100644 --- a/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml @@ -7,3 +7,4 @@ type = "contract" [dependencies] aztec = { path = "../../../../aztec-nr/aztec" } value_note = { path = "../../../../aztec-nr/value-note"} +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr b/yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr index f5f5636132b..560dc4fb8e9 100644 --- a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr +++ b/yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr @@ -1,6 +1,6 @@ +use dep::protocol_types::constants::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}; use dep::aztec::{ context::{PrivateContext, PublicContext, Context}, - constants_gen::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}, note::{ note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr index 2792859e9b4..9edea67a00c 100644 --- a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr @@ -2,6 +2,7 @@ mod cards; mod game; contract CardGame { + use dep::protocol_types::constants::MAX_NOTES_PER_PAGE; use dep::aztec::{ context::Context, hash::pedersen_hash, @@ -22,7 +23,6 @@ contract CardGame { use dep::aztec::{ abi, - constants_gen::{MAX_NOTES_PER_PAGE}, abi::{ Hasher, PrivateContextInputs, }, diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml index 4fa0ca7d4e2..5eccd21c042 100644 --- a/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml @@ -5,4 +5,5 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } \ No newline at end of file +aztec = { path = "../../../../aztec-nr/aztec" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr b/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr index 474fb20c6fc..9e3234812f9 100644 --- a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr +++ b/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}; +use dep::protocol_types::constants::{MAX_NOTES_PER_PAGE, MAX_READ_REQUESTS_PER_CALL}; use dep::aztec::note::{ note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, }; diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr b/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr index c225942b9fb..6ac7442ea2f 100644 --- a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr +++ b/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr @@ -1,5 +1,5 @@ use crate::types::card_note::{CardNote, CARD_NOTE_LEN}; -use dep::aztec::constants_gen::MAX_READ_REQUESTS_PER_CALL; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::note::note_getter_options::{NoteGetterOptions, Sort, SortOrder}; use dep::std::option::Option; diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml index 21ef226c194..2e29971c5dc 100644 --- a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml @@ -5,4 +5,5 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } \ No newline at end of file +aztec = { path = "../../../../aztec-nr/aztec" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr index 8e1de0cf189..f428fc88426 100644 --- a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr @@ -1,5 +1,6 @@ contract EasyPrivateVoting { // docs:start:imports + use dep::protocol_types::constants::EMPTY_NULLIFIED_COMMITMENT; use dep::aztec::{ context::{PrivateContext, Context}, oracle::get_secret_key::get_secret_key, // used to compute nullifier @@ -11,7 +12,6 @@ contract EasyPrivateVoting { field_serialization::{ FieldSerializationMethods, FIELD_SERIALIZED_LEN}, }, types::address::{AztecAddress}, - constants_gen::EMPTY_NULLIFIED_COMMITMENT, }; // docs:end:imports // docs:start:storage_struct diff --git a/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml index 7f5a66f3819..9ef152ea1f6 100644 --- a/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml @@ -5,4 +5,5 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } \ No newline at end of file +aztec = { path = "../../../../aztec-nr/aztec" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml index b11305196cd..3f884034998 100644 --- a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml @@ -6,4 +6,5 @@ type = "contract" [dependencies] aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note" } \ No newline at end of file +value_note = { path = "../../../../aztec-nr/value-note" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr index e271737d45c..d9235ccd6ee 100644 --- a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr @@ -2,6 +2,11 @@ mod utils; // A demonstration of inclusion and non-inclusion proofs. contract InclusionProofs { + use dep::protocol_types::constants::{ + NOTE_HASH_TREE_HEIGHT, + PUBLIC_DATA_TREE_HEIGHT, + GENERATOR_INDEX__PUBLIC_LEAF_INDEX, + }; use dep::std::merkle::compute_merkle_root; use dep::aztec::{ state_vars::{ @@ -20,11 +25,7 @@ contract InclusionProofs { note_header::NoteHeader, utils as note_utils, }, - constants_gen::{ - NOTE_HASH_TREE_HEIGHT, - PUBLIC_DATA_TREE_HEIGHT, - GENERATOR_INDEX__PUBLIC_LEAF_INDEX, - }, + oracle::{ get_membership_witness::{ get_membership_witness, diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml index 33b61c1b24d..ef3e9d65340 100644 --- a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml @@ -6,4 +6,5 @@ type = "contract" [dependencies] aztec = { path = "../../../../aztec-nr/aztec" } -safe_math = { path = "../../../../aztec-nr/safe-math" } \ No newline at end of file +safe_math = { path = "../../../../aztec-nr/safe-math" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr b/yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr index 53385ed3e99..6b2cfa5c629 100644 --- a/yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr +++ b/yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr @@ -4,7 +4,7 @@ use dep::aztec::context::{ }; use crate::asset::Asset; -use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH; use dep::aztec::selector::compute_selector; struct PriceFeed { diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml index 319c15b9ad4..cc97a1ddeee 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml @@ -8,3 +8,4 @@ type = "contract" aztec = { path = "../../../../aztec-nr/aztec" } field_note = { path = "../../../../aztec-nr/field-note" } token_portal_content_hash_lib = { path = "../token_portal_content_hash_lib" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr b/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr index 1bb62e9f3f6..51bd95002ae 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr +++ b/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr @@ -2,7 +2,7 @@ use dep::std; use dep::aztec::context::{ PrivateContext, PublicContext }; -use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; +use dep::protocol_types::constants::RETURN_VALUES_LENGTH; struct AStructTestCodeGenStruct { amount: Field, diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr index 186b9220cfb..1515b39d8a1 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr @@ -1,7 +1,7 @@ // A contract used for testing a random hodgepodge of small features from simulator and end-to-end tests. contract Test { use dep::std::option::Option; - + use dep::protocol_types::constants::EMPTY_NULLIFIED_COMMITMENT; // docs:start:unencrypted_import use dep::aztec::log::emit_unencrypted_log; // docs:end:unencrypted_import @@ -24,7 +24,6 @@ contract Test { state_vars::immutable_singleton::ImmutableSingleton, log::emit_unencrypted_log_from_private, types::vec::BoundedVec, - constants_gen::EMPTY_NULLIFIED_COMMITMENT, }; use dep::token_portal_content_hash_lib::{get_mint_private_content_hash, get_mint_public_content_hash}; use dep::field_note::field_note::{FieldNote, FieldNoteMethods, FIELD_NOTE_LEN}; diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml index 25ad4026709..15cff362a4b 100644 --- a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml @@ -8,4 +8,5 @@ type = "contract" aztec = { path = "../../../../aztec-nr/aztec" } safe_math = { path = "../../../../aztec-nr/safe-math" } field_note = { path = "../../../../aztec-nr/field-note" } -authwit = { path = "../../../../aztec-nr/authwit" } \ No newline at end of file +authwit = { path = "../../../../aztec-nr/authwit" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr index 5c3da5897b6..ae54a03ea76 100644 --- a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr +++ b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr @@ -1,8 +1,8 @@ use dep::std::option::Option; use dep::safe_math::SafeU120; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ context::Context, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, types::address::AztecAddress, }; diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr index 978676cc22e..55ef7ff36e9 100644 --- a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr +++ b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr @@ -1,3 +1,4 @@ +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ note::{ note_header::NoteHeader, @@ -5,7 +6,6 @@ use dep::aztec::{ utils::compute_note_hash_for_read_or_nullify, }, context::PrivateContext, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, log::emit_encrypted_log, hash::pedersen_hash, diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml index 13ddd27395c..4fc1814f588 100644 --- a/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml +++ b/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml @@ -7,4 +7,5 @@ type = "contract" [dependencies] aztec = { path = "../../../../aztec-nr/aztec" } safe_math = { path = "../../../../aztec-nr/safe-math" } -authwit = { path = "../../../../aztec-nr/authwit" } \ No newline at end of file +authwit = { path = "../../../../aztec-nr/authwit" } +protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr b/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr index 5c3da5897b6..ae54a03ea76 100644 --- a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr +++ b/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr @@ -1,8 +1,8 @@ use dep::std::option::Option; use dep::safe_math::SafeU120; +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ context::Context, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, types::address::AztecAddress, }; diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr b/yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr index cc366cc2277..8c4f1721cf9 100644 --- a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr +++ b/yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr @@ -1,3 +1,4 @@ +use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use dep::aztec::{ note::{ note_header::NoteHeader, @@ -5,7 +6,6 @@ use dep::aztec::{ utils::compute_note_hash_for_read_or_nullify, }, context::PrivateContext, - constants_gen::MAX_READ_REQUESTS_PER_CALL, state_vars::set::Set, log::emit_encrypted_log, hash::pedersen_hash, diff --git a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/Nargo.toml index 47c3f8af754..4132c7e2b18 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/Nargo.toml @@ -5,5 +5,4 @@ authors = [""] compiler_version = ">=0.18.0" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } types = { path = "../types" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/common.nr b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/common.nr index 8653d993183..c49b4843d22 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/common.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/common.nr @@ -1,11 +1,3 @@ -use dep::aztec::constants_gen::{ - EMPTY_NULLIFIED_COMMITMENT, - MAX_NEW_NULLIFIERS_PER_CALL, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_COMMITMENTS_PER_CALL, - MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, - MAX_READ_REQUESTS_PER_CALL, -}; use dep::types::{ abis::{ call_request::CallRequest, @@ -21,6 +13,14 @@ use dep::types::{ }, address::{Address, EthAddress}, contrakt::deployment_data::ContractDeploymentData, + constants::{ + EMPTY_NULLIFIED_COMMITMENT, + MAX_NEW_NULLIFIERS_PER_CALL, + MAX_NEW_L2_TO_L1_MSGS_PER_CALL, + MAX_NEW_COMMITMENTS_PER_CALL, + MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, + MAX_READ_REQUESTS_PER_CALL, + }, hash::{ compute_constructor_hash, compute_l2_to_l1_hash, diff --git a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_init.nr b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_init.nr index 88a34b4049c..b20c6b963b0 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_init.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_init.nr @@ -1,5 +1,4 @@ use crate::common; -use dep::aztec::constants_gen::EMPTY_NULLIFIED_COMMITMENT; use dep::std::unsafe; use dep::types::{ abis::{ @@ -7,6 +6,7 @@ use dep::types::{ private_kernel::private_call_data::PrivateCallData, kernel_circuit_public_inputs::{KernelCircuitPublicInputs, KernelCircuitPublicInputsBuilder}, }, + constants::EMPTY_NULLIFIED_COMMITMENT, mocked::{Proof, verify_previous_kernel_state}, transaction::request::TxRequest, utils::arrays::is_empty_array, @@ -117,7 +117,7 @@ impl PrivateKernelInputsInit { mod tests { use crate::private_kernel_init::PrivateKernelInputsInit; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ MAX_READ_REQUESTS_PER_CALL, }; use dep::types::{ diff --git a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_inner.nr b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_inner.nr index cdee6d1b941..a89e4010bab 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_inner.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_inner.nr @@ -81,7 +81,7 @@ impl PrivateKernelInputsInner { mod tests { use crate::private_kernel_inner::PrivateKernelInputsInner; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ EMPTY_NULLIFIED_COMMITMENT, MAX_READ_REQUESTS_PER_CALL, MAX_NEW_COMMITMENTS_PER_TX, diff --git a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_ordering.nr b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_ordering.nr index 057317729aa..0fe7d3283e9 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_ordering.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/private-kernel-lib/src/private_kernel_ordering.nr @@ -1,10 +1,4 @@ use crate::common; -use dep::aztec::constants_gen::{ - EMPTY_NULLIFIED_COMMITMENT, - MAX_NEW_COMMITMENTS_PER_TX, - MAX_NEW_NULLIFIERS_PER_TX, - MAX_READ_REQUESTS_PER_TX, -}; use dep::std::unsafe; use dep::types::{ abis::{ @@ -15,6 +9,12 @@ use dep::types::{ KernelCircuitPublicInputsFinal, }, }, + constants::{ + EMPTY_NULLIFIED_COMMITMENT, + MAX_NEW_COMMITMENTS_PER_TX, + MAX_NEW_NULLIFIERS_PER_TX, + MAX_READ_REQUESTS_PER_TX, + }, hash::{ compute_commitment_nonce, compute_unique_siloed_commitment, @@ -160,7 +160,7 @@ impl PrivateKernelInputsOrdering { mod tests { use crate::private_kernel_ordering::PrivateKernelInputsOrdering; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ MAX_READ_REQUESTS_PER_TX, MAX_NEW_COMMITMENTS_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/Nargo.toml index 76525900176..669bac30a78 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/Nargo.toml @@ -5,5 +5,4 @@ authors = [""] compiler_version = ">=0.18.0" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } types = { path = "../types" } 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 8bd199879b5..a83cda75565 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 @@ -17,6 +17,16 @@ use dep::types::{ storage_read::StorageRead, storage_update_request::StorageUpdateRequest, }, + constants::{ + EMPTY_NULLIFIED_COMMITMENT, + MAX_NEW_L2_TO_L1_MSGS_PER_CALL, + MAX_NEW_COMMITMENTS_PER_CALL, + MAX_NEW_NULLIFIERS_PER_CALL, + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, + MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, + MAX_PUBLIC_DATA_READS_PER_CALL, + MAX_READ_REQUESTS_PER_CALL, + }, hash::{silo_commitment, silo_nullifier, compute_l2_to_l1_hash, accumulate_sha256}, utils::{ arrays::{array_length, array_to_bounded_vec, is_empty_array, struct_array_length, struct_array_to_bounded_vec}, @@ -26,17 +36,6 @@ use dep::types::{ }; use crate::hash::{compute_public_data_tree_index, compute_public_data_tree_value}; -use dep::aztec::constants_gen::{ - EMPTY_NULLIFIED_COMMITMENT, - MAX_NEW_L2_TO_L1_MSGS_PER_CALL, - MAX_NEW_COMMITMENTS_PER_CALL, - MAX_NEW_NULLIFIERS_PER_CALL, - MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, - MAX_PUBLIC_DATA_READS_PER_CALL, - MAX_READ_REQUESTS_PER_CALL, -}; - // Validates inputs to the kernel circuit that are common to all invocation scenarios. pub fn validate_inputs(public_call: PublicCallData){ // Validates commons inputs for all type of kernel inputs diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/hash.nr b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/hash.nr index 444f3cf6c30..1769f9f87f2 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/hash.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/hash.nr @@ -1,14 +1,13 @@ -use dep::types::address::Address; -use dep::aztec::{ - constants_gen, - constants_gen::{GENERATOR_INDEX__PUBLIC_LEAF_INDEX}, +use dep::types::{ + address::Address, + constants::GENERATOR_INDEX__PUBLIC_LEAF_INDEX, }; pub fn compute_public_data_tree_index(contract_address: Address, storage_slot: Field) -> Field { dep::std::hash::pedersen_hash_with_separator([ contract_address.to_field(), storage_slot - ], constants_gen::GENERATOR_INDEX__PUBLIC_LEAF_INDEX) + ], GENERATOR_INDEX__PUBLIC_LEAF_INDEX) } pub fn compute_public_data_tree_value(value: Field) -> Field { diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_private_previous.nr b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_private_previous.nr index 6527e18c741..550f14151e3 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_private_previous.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_private_previous.nr @@ -88,7 +88,7 @@ mod tests { bounded_vec::BoundedVec, }, }; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_public_previous.nr b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_public_previous.nr index 46d4f485504..58c5b2ab399 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_public_previous.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-lib/src/public_kernel_public_previous.nr @@ -76,7 +76,7 @@ mod tests { arrays::array_eq, }, }; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, }; diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous-simulated/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous-simulated/Nargo.toml index d131d25b72c..a82bcabc543 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous-simulated/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous-simulated/Nargo.toml @@ -7,4 +7,3 @@ compiler_version = ">=0.18.0" [dependencies] types = { path = "../types" } public_kernel_lib = { path = "../public-kernel-lib" } -aztec = { path = "../../../../aztec-nr/aztec" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous/Nargo.toml index a1aebfa70a6..a6bf17d1903 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-private-previous/Nargo.toml @@ -7,4 +7,3 @@ compiler_version = ">=0.18.0" [dependencies] types = { path = "../types" } public_kernel_lib = { path = "../public-kernel-lib" } -aztec = { path = "../../../../aztec-nr/aztec" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous-simulated/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous-simulated/Nargo.toml index 5eb41be2441..9afbdf6b774 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous-simulated/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous-simulated/Nargo.toml @@ -7,4 +7,3 @@ compiler_version = ">=0.18.0" [dependencies] types = { path = "../types" } public_kernel_lib = { path = "../public-kernel-lib" } -aztec = { path = "../../../../aztec-nr/aztec" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous/Nargo.toml index 9d972e291cc..f4b1e9b3557 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/public-kernel-public-previous/Nargo.toml @@ -7,4 +7,3 @@ compiler_version = ">=0.18.0" [dependencies] types = { path = "../types" } public_kernel_lib = { path = "../public-kernel-lib" } -aztec = { path = "../../../../aztec-nr/aztec" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/Nargo.toml index 9a1b9b54fda..0a1dcaa0012 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/Nargo.toml @@ -5,5 +5,4 @@ authors = [""] compiler_version = ">=0.18.0" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } types = { path = "../types" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/base_or_merge_rollup_public_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/base_or_merge_rollup_public_inputs.nr index 54546a9e9fb..4594e4ea4c3 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/base_or_merge_rollup_public_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/base_or_merge_rollup_public_inputs.nr @@ -1,5 +1,5 @@ // TODO(Kev): This constant is also defined in private-kernel-lib -use dep::aztec::constants_gen::NUM_FIELDS_PER_SHA256; +use dep::types::constants::NUM_FIELDS_PER_SHA256; use crate::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot; use crate::abis::constant_rollup_data::ConstantRollupData; use dep::types::mocked::AggregationObject; diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/global_variables.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/global_variables.nr index ba521f5f196..71e88760209 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/global_variables.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/global_variables.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use dep::types::constants::GENERATOR_INDEX__GLOBAL_VARIABLES; struct GlobalVariables { chain_id : Field, @@ -16,7 +16,7 @@ impl GlobalVariables { self.block_number, self.timestamp ], - constants_gen::GENERATOR_INDEX__GLOBAL_VARIABLES, + GENERATOR_INDEX__GLOBAL_VARIABLES, ) } diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/previous_rollup_data.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/previous_rollup_data.nr index bd848be2463..db92815baa0 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/previous_rollup_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/abis/previous_rollup_data.nr @@ -1,6 +1,6 @@ use crate::abis::base_or_merge_rollup_public_inputs::BaseOrMergeRollupPublicInputs; use dep::types::abis::membership_witness::VKMembershipWitness; -use dep::aztec::constants_gen::ROLLUP_VK_TREE_HEIGHT; +use dep::types::constants::ROLLUP_VK_TREE_HEIGHT; use dep::types::mocked::{Proof, VerificationKey}; struct PreviousRollupData{ diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/base/base_rollup_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/base/base_rollup_inputs.nr index addb3053ce7..79ef5693a1d 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/base/base_rollup_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/base/base_rollup_inputs.nr @@ -8,7 +8,7 @@ use dep::types::utils::uint256::U256; use dep::types::abis::public_data_update_request::PublicDataUpdateRequest; use dep::types::abis::public_data_read::PublicDataRead; use dep::types::mocked::{AggregationObject, Proof}; -use dep::aztec::constants_gen::{ +use dep::types::constants::{ MAX_NEW_NULLIFIERS_PER_BASE_ROLLUP, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, @@ -538,7 +538,7 @@ mod tests { tests::merkle_tree_utils::{NonEmptyMerkleTree, compute_zero_hashes}, components, }; - use dep::aztec::constants_gen::{ + use dep::types::constants::{ CONTRACT_SUBTREE_SIBLING_PATH_LENGTH, CONTRACT_TREE_HEIGHT, CONTRACT_SUBTREE_HEIGHT, @@ -554,6 +554,7 @@ mod tests { NULLIFIER_TREE_HEIGHT, NULLIFIER_SUBTREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, + NUM_FIELDS_PER_SHA256, }; use dep::types::{ abis::membership_witness::ArchiveRootMembershipWitness, diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/components.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/components.nr index 4eb6d8bffd8..2a67a1acd96 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/components.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/components.nr @@ -2,7 +2,7 @@ use crate::abis::base_or_merge_rollup_public_inputs::BaseOrMergeRollupPublicInpu use dep::types::mocked::AggregationObject; use dep::types::hash::{accumulate_sha256, assert_check_membership, root_from_sibling_path}; use dep::types::utils::uint128::U128; -use dep::aztec::constants_gen::NUM_FIELDS_PER_SHA256; +use dep::types::constants::NUM_FIELDS_PER_SHA256; use crate::abis::previous_rollup_data::PreviousRollupData; use crate::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot; diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr index c024f1695e2..55f7d242e7e 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr @@ -1,5 +1,5 @@ use crate::abis::global_variables::GlobalVariables; -use dep::aztec::constants_gen; +use dep::types::constants::GENERATOR_INDEX__BLOCK_HASH; pub fn compute_block_hash_with_globals( globals : GlobalVariables, @@ -11,5 +11,5 @@ pub fn compute_block_hash_with_globals( let inputs = [globals.hash(), note_hash_tree_root, nullifier_tree_root, contract_tree_root, l1_to_l2_messages_tree_root, public_data_tree_root]; - dep::std::hash::pedersen_hash_with_separator(inputs, constants_gen::GENERATOR_INDEX__BLOCK_HASH) + dep::std::hash::pedersen_hash_with_separator(inputs, GENERATOR_INDEX__BLOCK_HASH) } \ No newline at end of file diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr index 71a54c0e25a..a2e29866aca 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr @@ -4,7 +4,7 @@ mod root_rollup_public_inputs; use root_rollup_public_inputs::RootRollupPublicInputs; use crate::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot; use dep::types::utils::uint256::U256; -use dep::aztec::constants_gen::{NUM_FIELDS_PER_SHA256,NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,L1_TO_L2_MSG_SUBTREE_HEIGHT}; +use dep::types::constants::{NUM_FIELDS_PER_SHA256,NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,L1_TO_L2_MSG_SUBTREE_HEIGHT}; use crate::{components, hash::compute_block_hash_with_globals}; use crate::merkle_tree::{calculate_subtree, calculate_empty_tree_root}; diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr index d1209150ee4..37f64928e8b 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr @@ -3,7 +3,7 @@ use crate::abis::previous_rollup_data::PreviousRollupData; use crate::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot; use crate::abis::constant_rollup_data::ConstantRollupData; -use dep::aztec::constants_gen::{ +use dep::types::constants::{ NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, ARCHIVE_HEIGHT diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr index c8fdbe367a1..c4c2f931d8b 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr @@ -2,7 +2,7 @@ use crate::abis::nullifier_leaf_preimage::NullifierLeafPreimage; use crate::abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot; use crate::abis::constant_rollup_data::ConstantRollupData; use crate::abis::global_variables::GlobalVariables; -use dep::aztec::constants_gen::{ +use dep::types::constants::{ NUM_FIELDS_PER_SHA256 }; use dep::types::mocked::AggregationObject; diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr index 9e6d7e02f3c..0a095423bc6 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr @@ -3,7 +3,7 @@ use crate::{ root_rollup_inputs::RootRollupInputs, }, }; -use dep::aztec::constants_gen::{ +use dep::types::constants::{ L1_TO_L2_MSG_TREE_HEIGHT, L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, L1_TO_L2_MSG_SUBTREE_HEIGHT, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/Nargo.toml b/yarn-project/noir-protocol-circuits/src/crates/types/Nargo.toml index 5a7509f4318..6c8b6657f62 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/Nargo.toml +++ b/yarn-project/noir-protocol-circuits/src/crates/types/Nargo.toml @@ -5,4 +5,3 @@ authors = [""] compiler_version = ">=0.18.0" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_context.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_context.nr index 37259a7e675..012ab922e5d 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_context.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/call_context.nr @@ -1,6 +1,6 @@ use crate::abis::function_selector::FunctionSelector; use crate::address::{EthAddress,Address}; -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__CALL_CONTEXT; struct CallContext{ msg_sender : Address, @@ -24,7 +24,7 @@ impl CallContext { self.is_delegate_call as Field, self.is_static_call as Field, self.is_contract_deployment as Field, - ], constants_gen::GENERATOR_INDEX__CALL_CONTEXT) + ], GENERATOR_INDEX__CALL_CONTEXT) } fn assert_is_zero(self) { 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/call_stack_item.nr index fc6a754c50d..ea323fba8fe 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/call_stack_item.nr @@ -4,7 +4,7 @@ use crate::abis::{ public_circuit_public_inputs::PublicCircuitPublicInputs, }; use crate::address::Address; -use dep::aztec::constants_gen::{ +use crate::constants::{ GENERATOR_INDEX__CALL_STACK_ITEM, }; diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/combined_accumulated_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/combined_accumulated_data.nr index 6d39c700d92..e48dc871220 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/combined_accumulated_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/combined_accumulated_data.nr @@ -10,7 +10,7 @@ use crate::{ mocked::AggregationObject, utils::bounded_vec::BoundedVec, }; -use dep::aztec::constants_gen::{ +use crate::constants::{ MAX_READ_REQUESTS_PER_TX, MAX_NEW_COMMITMENTS_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_data.nr index ad812b626a9..438ae6c61c6 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_data.nr @@ -1,5 +1,5 @@ use crate::abis::function_selector::FunctionSelector; -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__FUNCTION_DATA; struct FunctionData { // First four bytes of the abi encoding @@ -21,6 +21,6 @@ impl FunctionData { self.is_internal as Field, self.is_private as Field, self.is_constructor as Field, - ], constants_gen::GENERATOR_INDEX__FUNCTION_DATA) + ], GENERATOR_INDEX__FUNCTION_DATA) } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_leaf_preimage.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_leaf_preimage.nr index 022ec5a718e..2a66a161736 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_leaf_preimage.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/function_leaf_preimage.nr @@ -1,5 +1,5 @@ use crate::abis::function_selector::FunctionSelector; -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__FUNCTION_LEAF; struct FunctionLeafPreimage { selector : FunctionSelector, @@ -17,6 +17,6 @@ impl FunctionLeafPreimage { self.is_private as Field, self.vk_hash, self.acir_hash - ], constants_gen::GENERATOR_INDEX__FUNCTION_LEAF) + ], GENERATOR_INDEX__FUNCTION_LEAF) } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/membership_witness.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/membership_witness.nr index aa591455b18..efead3d78a2 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/membership_witness.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/membership_witness.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen::{ +use crate::constants::{ CONTRACT_TREE_HEIGHT, FUNCTION_TREE_HEIGHT, KERNELS_PER_BASE_ROLLUP, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/new_contract_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/new_contract_data.nr index aba0cda1789..784b698da5b 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/new_contract_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/new_contract_data.nr @@ -1,5 +1,5 @@ use crate::address::{Address, EthAddress}; -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__CONTRACT_LEAF; struct NewContractData { contract_address: Address, @@ -36,7 +36,7 @@ impl NewContractData { self.contract_address.to_field(), self.portal_contract_address.to_field(), self.function_tree_root, - ], constants_gen::GENERATOR_INDEX__CONTRACT_LEAF) + ], GENERATOR_INDEX__CONTRACT_LEAF) } } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/previous_kernel_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/previous_kernel_data.nr index d65dc83a883..5733acef236 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/previous_kernel_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/previous_kernel_data.nr @@ -1,5 +1,5 @@ use crate::mocked::{Proof, VerificationKey}; -use dep::aztec::constants_gen::VK_TREE_HEIGHT; +use crate::constants::VK_TREE_HEIGHT; use crate::abis::kernel_circuit_public_inputs::KernelCircuitPublicInputs; //TODO(sean): left a note saying that this should not be called Previous diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_circuit_public_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_circuit_public_inputs.nr index b13e029a926..8bee165fda4 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_circuit_public_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/private_circuit_public_inputs.nr @@ -7,9 +7,7 @@ use crate::{ hash::NUM_FIELDS_PER_SHA256, utils::bounded_vec::BoundedVec, }; -use dep::aztec::{ - constants_gen, - constants_gen::{ +use crate::constants::{ MAX_READ_REQUESTS_PER_CALL, MAX_NEW_COMMITMENTS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, @@ -18,7 +16,8 @@ use dep::aztec::{ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, RETURN_VALUES_LENGTH, - } + PRIVATE_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH, + GENERATOR_INDEX__PRIVATE_CIRCUIT_PUBLIC_INPUTS, }; struct PrivateCircuitPublicInputs { @@ -57,7 +56,7 @@ struct PrivateCircuitPublicInputs { impl PrivateCircuitPublicInputs { // TODO(https://github.com/AztecProtocol/aztec-packages/issues/3059) : Reuse aztec-nr fn hash(self) -> Field { - let mut fields: BoundedVec = BoundedVec::new(0); + let mut fields: BoundedVec = BoundedVec::new(0); fields.push(self.call_context.hash()); fields.push(self.args_hash); fields.push_array(self.return_values); @@ -78,8 +77,8 @@ impl PrivateCircuitPublicInputs { fields.push(self.chain_id); fields.push(self.version); - assert_eq(fields.len(), constants_gen::PRIVATE_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH, "Incorrect number of input fields when hashing PrivateCircuitPublicInputs"); + assert_eq(fields.len(), PRIVATE_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH, "Incorrect number of input fields when hashing PrivateCircuitPublicInputs"); - dep::std::hash::pedersen_hash_with_separator(fields.storage, constants_gen::GENERATOR_INDEX__PRIVATE_CIRCUIT_PUBLIC_INPUTS) + dep::std::hash::pedersen_hash_with_separator(fields.storage, GENERATOR_INDEX__PRIVATE_CIRCUIT_PUBLIC_INPUTS) } } 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 2ec38255474..23414ce6530 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 @@ -9,7 +9,7 @@ use crate::abis::{ }; use crate::address::EthAddress; use crate::mocked::{Proof, VerificationKey}; -use dep::aztec::constants_gen::{ +use crate::constants::{ MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_READ_REQUESTS_PER_CALL, 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 6310f119440..bc59e74e109 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 @@ -6,7 +6,7 @@ use crate::{ address::EthAddress, mocked::Proof, }; -use dep::aztec::constants_gen::MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL; +use crate::constants::MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL; struct PublicCallData { call_stack_item: PublicCallStackItem, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_circuit_public_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_circuit_public_inputs.nr index abcaf60e7af..69b6ab7af68 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_circuit_public_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_circuit_public_inputs.nr @@ -1,5 +1,4 @@ -use dep::aztec::constants_gen; -use dep::aztec::constants_gen::{ +use crate::constants::{ MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, MAX_NEW_COMMITMENTS_PER_CALL, @@ -7,6 +6,8 @@ use dep::aztec::constants_gen::{ MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, RETURN_VALUES_LENGTH, + GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS, + PUBLIC_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH }; use crate::{ abis::{ @@ -50,7 +51,7 @@ struct PublicCircuitPublicInputs{ impl PublicCircuitPublicInputs{ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/3059): Reuse aztec-nr fn hash(self) -> Field { - let mut inputs: BoundedVec = BoundedVec::new(0); + let mut inputs: BoundedVec = BoundedVec::new(0); inputs.push(self.call_context.hash()); inputs.push(self.args_hash); inputs.push_array(self.return_values); @@ -69,8 +70,8 @@ impl PublicCircuitPublicInputs{ inputs.push_array(self.block_header.to_array()); inputs.push(self.prover_address.to_field()); - assert_eq(inputs.len(), constants_gen::PUBLIC_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH, "Incorrect number of input fields when hashing PublicCircuitPublicInputs"); + assert_eq(inputs.len(), PUBLIC_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH, "Incorrect number of input fields when hashing PublicCircuitPublicInputs"); - dep::std::hash::pedersen_hash_with_separator(inputs.storage, constants_gen::GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS) + dep::std::hash::pedersen_hash_with_separator(inputs.storage, GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS) } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_read.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_read.nr index 94c8a02d087..0fefc927168 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_read.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_read.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__PUBLIC_DATA_READ; struct PublicDataRead { leaf_index : Field, @@ -10,7 +10,7 @@ impl PublicDataRead { dep::std::hash::pedersen_hash_with_separator([ self.leaf_index, self.value, - ], constants_gen::GENERATOR_INDEX__PUBLIC_DATA_READ) + ], GENERATOR_INDEX__PUBLIC_DATA_READ) } pub fn empty() -> Self { diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_update_request.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_update_request.nr index 458d6ec9549..2e6c51ccaa7 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_update_request.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/public_data_update_request.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen::GENERATOR_INDEX__PUBLIC_DATA_UPDATE_REQUEST; +use crate::constants::GENERATOR_INDEX__PUBLIC_DATA_UPDATE_REQUEST; struct PublicDataUpdateRequest { leaf_index : Field, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/block.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/block.nr index dc15b932bdd..a692491d3f4 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/block.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/block.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__BLOCK_HASH; // This is not in the cpp code. struct Block { @@ -31,6 +31,6 @@ impl Block { self.contract_tree_root, self.l1_to_l2_messages_tree_root, self.public_data_tree_root, - ], constants_gen::GENERATOR_INDEX__BLOCK_HASH) + ], GENERATOR_INDEX__BLOCK_HASH) } } \ No newline at end of file diff --git a/yarn-project/aztec-nr/aztec/src/constants_gen.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr similarity index 99% rename from yarn-project/aztec-nr/aztec/src/constants_gen.nr rename to yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr index 900159c9966..f8a5c60bb62 100644 --- a/yarn-project/aztec-nr/aztec/src/constants_gen.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/constants.nr @@ -82,6 +82,9 @@ global L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH: Field = 12; global FUNCTION_SELECTOR_NUM_BYTES: Field = 4; global MAPPING_SLOT_PEDERSEN_SEPARATOR: Field = 4; global NUM_FIELDS_PER_SHA256: Field = 2; +global ARGS_HASH_CHUNK_LENGTH: u32 = 32; +global ARGS_HASH_CHUNK_COUNT: u32 = 16; + // NOIR CONSTANTS - constants used only in yarn-packages/noir-contracts // Some are defined here because Noir doesn't yet support globals referencing other globals yet. diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/deployment_data.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/deployment_data.nr index d43f3d5ab2c..083122ff942 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/deployment_data.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/deployment_data.nr @@ -1,6 +1,6 @@ use crate::address::EthAddress; use crate::point::Point; -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__CONTRACT_DEPLOYMENT_DATA; struct ContractDeploymentData { deployer_public_key : Point, @@ -27,6 +27,6 @@ impl ContractDeploymentData { self.function_tree_root, self.contract_address_salt, self.portal_contract_address.to_field() - ], constants_gen::GENERATOR_INDEX__CONTRACT_DEPLOYMENT_DATA) + ], GENERATOR_INDEX__CONTRACT_DEPLOYMENT_DATA) } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_read.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_read.nr index cc7911471f1..71de424e162 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_read.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_read.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__PUBLIC_DATA_READ; struct StorageRead{ storage_slot: Field, @@ -17,7 +17,7 @@ impl StorageRead { dep::std::hash::pedersen_hash_with_separator([ self.storage_slot, self.current_value, - ], constants_gen::GENERATOR_INDEX__PUBLIC_DATA_READ) + ], GENERATOR_INDEX__PUBLIC_DATA_READ) } pub fn is_empty(self) -> bool { diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_update_request.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_update_request.nr index ba33f3985ba..7d1f90b0d89 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_update_request.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/contrakt/storage_update_request.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen::GENERATOR_INDEX__PUBLIC_DATA_UPDATE_REQUEST; +use crate::constants::GENERATOR_INDEX__PUBLIC_DATA_UPDATE_REQUEST; struct StorageUpdateRequest{ storage_slot : Field, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/hash.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/hash.nr index a331b8046be..a792107a9cd 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/hash.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/hash.nr @@ -8,13 +8,70 @@ use crate::abis::function_data::FunctionData; use crate::utils::uint128::U128; use crate::utils::uint256::U256; use crate::utils::bounded_vec::BoundedVec; - -use dep::aztec::{ - constants_gen, - constants_gen::{CONTRACT_TREE_HEIGHT, FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT}, - hash::sha256_to_field, +use crate::constants::{ + ARGS_HASH_CHUNK_COUNT, + ARGS_HASH_CHUNK_LENGTH, + CONTRACT_TREE_HEIGHT, + FUNCTION_TREE_HEIGHT, + NOTE_HASH_TREE_HEIGHT, + GENERATOR_INDEX__SILOED_COMMITMENT, + GENERATOR_INDEX__OUTER_NULLIFIER, + GENERATOR_INDEX__VK, + GENERATOR_INDEX__CONSTRUCTOR, + GENERATOR_INDEX__PARTIAL_ADDRESS, + GENERATOR_INDEX__CONTRACT_ADDRESS, + GENERATOR_INDEX__COMMITMENT_NONCE, + GENERATOR_INDEX__UNIQUE_COMMITMENT, + GENERATOR_INDEX__FUNCTION_ARGS, }; +use dep::std::hash::sha256; + +pub fn sha256_to_field(bytes_to_hash: [u8; N]) -> Field { + let sha256_hashed = sha256(bytes_to_hash); + + // Convert it to a field element + let mut v = 1; + let mut high = 0 as Field; + let mut low = 0 as Field; + + for i in 0..16 { + high = high + (sha256_hashed[15 - i] as Field) * v; + low = low + (sha256_hashed[16 + 15 - i] as Field) * v; + v = v * 256; + } + + // Abuse that a % p + b % p = (a + b) % p and that low < p + let hash_in_a_field = low + high * v; + + hash_in_a_field +} + +pub fn hash_args(args: [Field; N]) -> Field { + if args.len() == 0 { + 0 + } else { + let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT]; + for i in 0..ARGS_HASH_CHUNK_COUNT { + let mut chunk_hash = 0; + let start_chunk_index = i * ARGS_HASH_CHUNK_LENGTH; + if start_chunk_index < (args.len() as u32) { + let mut chunk_args = [0; ARGS_HASH_CHUNK_LENGTH]; + for j in 0..ARGS_HASH_CHUNK_LENGTH { + let item_index = i * ARGS_HASH_CHUNK_LENGTH + j; + if item_index < (args.len() as u32) { + chunk_args[j] = args[item_index]; + } + } + chunk_hash = dep::std::hash::pedersen_hash_with_separator(chunk_args, GENERATOR_INDEX__FUNCTION_ARGS); + } + chunks_hashes[i] = chunk_hash; + } + dep::std::hash::pedersen_hash_with_separator(chunks_hashes, GENERATOR_INDEX__FUNCTION_ARGS) + } +} + + // Checks that `value` is a member of a merkle tree with root `root` at position `index` // The witness being the `sibling_path` pub fn assert_check_membership(value : Field, index : Field, sibling_path : [Field; N], root : Field) { @@ -94,14 +151,14 @@ pub fn silo_commitment(address : Address, inner_commitment : Field) -> Field { dep::std::hash::pedersen_hash_with_separator([ address.to_field(), inner_commitment, - ], constants_gen::GENERATOR_INDEX__SILOED_COMMITMENT) + ], GENERATOR_INDEX__SILOED_COMMITMENT) } pub fn silo_nullifier(address : Address, nullifier : Field) -> Field { dep::std::hash::pedersen_hash_with_separator([ address.to_field(), nullifier, - ], constants_gen::GENERATOR_INDEX__OUTER_NULLIFIER) + ], GENERATOR_INDEX__OUTER_NULLIFIER) } fn merkle_hash(left : Field, right : Field) -> Field { @@ -112,7 +169,7 @@ pub fn stdlib_recursion_verification_key_compress_native_vk(_vk : VerificationKe // Original cpp code // stdlib::recursion::verification_key::compress_native(private_call.vk, GeneratorIndex::VK); // The above cpp method is only ever called on verification key, so it has been special cased here - let _hash_index = constants_gen::GENERATOR_INDEX__VK; + let _hash_index = GENERATOR_INDEX__VK; 0 } @@ -143,7 +200,7 @@ pub fn compute_constructor_hash(function_data : FunctionData, args_hash : Field, function_data_hash, args_hash, constructor_vk_hash - ], constants_gen::GENERATOR_INDEX__CONSTRUCTOR) + ], GENERATOR_INDEX__CONSTRUCTOR) } // sha256 hash is stored in two fields to accommodate all 256-bits of the hash @@ -201,7 +258,7 @@ pub fn compute_partial_address(contract_address_salt : Field, function_tree_root contract_address_salt, function_tree_root, constructor_hash - ],constants_gen::GENERATOR_INDEX__PARTIAL_ADDRESS) + ], GENERATOR_INDEX__PARTIAL_ADDRESS) } pub fn compute_contract_address_from_partial(point : Point, partial_address : Field) -> Address { @@ -209,7 +266,7 @@ pub fn compute_contract_address_from_partial(point : Point, partial_address : Fi point.x, point.y, partial_address - ],constants_gen::GENERATOR_INDEX__CONTRACT_ADDRESS); + ], GENERATOR_INDEX__CONTRACT_ADDRESS); Address::from_field(field) } @@ -217,14 +274,14 @@ pub fn compute_commitment_nonce(first_nullifier : Field, commitment_index : Fiel dep::std::hash::pedersen_hash_with_separator([ first_nullifier, commitment_index - ], constants_gen::GENERATOR_INDEX__COMMITMENT_NONCE) + ], GENERATOR_INDEX__COMMITMENT_NONCE) } pub fn compute_unique_siloed_commitment(nonce: Field, siloed_commitment: Field) -> Field { dep::std::hash::pedersen_hash_with_separator([ nonce, siloed_commitment - ], constants_gen::GENERATOR_INDEX__UNIQUE_COMMITMENT) + ], GENERATOR_INDEX__UNIQUE_COMMITMENT) } pub fn compute_unique_siloed_commitments(first_nullifier: Field, siloed_commitments: [Field; N]) -> [Field; N] { 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 16c2115161e..d3140b40e9b 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,9 +7,8 @@ use crate::abis::function_data::FunctionData; 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; +use crate::hash::{compute_l2_to_l1_hash, sha256_to_field}; use crate::abis::call_stack_item::PublicCallStackItem; -use dep::aztec::hash::sha256_to_field; use crate::abis::public_circuit_public_inputs::PublicCircuitPublicInputs; #[test] diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/lib.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/lib.nr index 8a33e4f28eb..90c1376598d 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/lib.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/lib.nr @@ -8,6 +8,7 @@ mod contrakt; mod transaction; mod abis; mod block; +mod constants; mod mocked; mod hash; diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures/read_requests.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures/read_requests.nr index 446fa2e5e70..97a57f44976 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures/read_requests.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures/read_requests.nr @@ -1,10 +1,8 @@ use crate::abis::membership_witness::ReadRequestMembershipWitness; use crate::tests::fixtures; use crate::utils::bounded_vec::BoundedVec; -use dep::aztec::{ - constants_gen::{ +use crate::constants::{ MAX_READ_REQUESTS_PER_CALL, - }, }; pub fn generate_read_requests(how_many: Field) -> ( diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/previous_kernel_data_builder.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/previous_kernel_data_builder.nr index d41008a7ad4..9c4c26dffc6 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/previous_kernel_data_builder.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/previous_kernel_data_builder.nr @@ -19,15 +19,13 @@ use crate::{ }, transaction::context::TxContext, }; -use dep::aztec::{ - constants_gen::{ +use crate::constants::{ EMPTY_NULLIFIED_COMMITMENT, MAX_NEW_COMMITMENTS_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PUBLIC_DATA_READS_PER_TX, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, VK_TREE_HEIGHT, - }, }; struct PreviousKernelDataBuilder { 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 b03552e2df6..0cb9b217f54 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 @@ -26,12 +26,10 @@ use crate::{ bounded_vec::BoundedVec, }, }; -use dep::aztec::{ - constants_gen::{ +use crate::constants::{ MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_READ_REQUESTS_PER_CALL, - }, }; struct PrivateCallDataBuilder { diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_circuit_public_inputs_builder.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_circuit_public_inputs_builder.nr index f000639f3df..e412af64d98 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_circuit_public_inputs_builder.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/private_circuit_public_inputs_builder.nr @@ -6,16 +6,14 @@ use crate::{ private_circuit_public_inputs::PrivateCircuitPublicInputs, }, contrakt::deployment_data::ContractDeploymentData, - hash::{compute_constructor_hash, NUM_FIELDS_PER_SHA256}, + hash::{compute_constructor_hash, NUM_FIELDS_PER_SHA256, hash_args}, tests::{ fixtures, testing_harness::build_contract_deployment_data, }, utils::bounded_vec::BoundedVec, }; -use dep::aztec::{ - abi::hash_args, - constants_gen::{ +use crate::constants::{ MAX_READ_REQUESTS_PER_CALL, MAX_NEW_COMMITMENTS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, @@ -24,7 +22,6 @@ use dep::aztec::{ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, RETURN_VALUES_LENGTH, - } }; struct PrivateCircuitPublicInputsBuilder { 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 fdf4678b161..01ee980b65b 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 @@ -19,7 +19,7 @@ use crate::{ }, utils::bounded_vec::BoundedVec, }; -use dep::aztec::constants_gen::{ +use crate::constants::{ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_circuit_public_inputs_builder.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_circuit_public_inputs_builder.nr index 7f1de0beee6..34d3df007c4 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_circuit_public_inputs_builder.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/public_circuit_public_inputs_builder.nr @@ -13,7 +13,7 @@ use crate::{ tests::fixtures, utils::bounded_vec::BoundedVec, }; -use dep::aztec::constants_gen::{ +use crate::constants::{ MAX_NEW_COMMITMENTS_PER_CALL, MAX_NEW_L2_TO_L1_MSGS_PER_CALL, MAX_NEW_NULLIFIERS_PER_CALL, diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/context.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/context.nr index 3032020b61b..3715951ca78 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/context.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/context.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__TX_CONTEXT; use crate::contrakt::deployment_data::ContractDeploymentData; struct TxContext { @@ -12,7 +12,6 @@ struct TxContext { version : Field, } - impl TxContext { fn hash(self) -> Field { dep::std::hash::pedersen_hash_with_separator([ @@ -22,6 +21,6 @@ impl TxContext { self.contract_deployment_data.hash(), self.chain_id, self.version, - ], constants_gen::GENERATOR_INDEX__TX_CONTEXT) + ], GENERATOR_INDEX__TX_CONTEXT) } } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/request.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/request.nr index 8bd6a5d963e..89d48366778 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/request.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/transaction/request.nr @@ -1,4 +1,4 @@ -use dep::aztec::constants_gen; +use crate::constants::GENERATOR_INDEX__TX_REQUEST; use crate::address::Address; use crate::transaction::context::TxContext; use crate::abis::function_data::FunctionData; @@ -17,6 +17,6 @@ impl TxRequest { self.function_data.hash(), self.args_hash, self.tx_context.hash(), - ], constants_gen::GENERATOR_INDEX__TX_REQUEST) + ], GENERATOR_INDEX__TX_REQUEST) } }