From 0fcc34d5ef007a4fea0ccace94de0dcf7091b34e Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 18:46:42 +0000 Subject: [PATCH 01/15] feat: add aztec-nr prelude --- .../aztec-nr/authwit/src/entrypoint/app.nr | 2 +- .../aztec-nr/authwit/src/entrypoint/fee.nr | 4 +- noir-projects/aztec-nr/aztec/src/lib.nr | 1 + noir-projects/aztec-nr/aztec/src/prelude.nr | 14 +++++++ .../aztec-nr/value-note/src/utils.nr | 7 +--- .../src/dapp_payload.nr | 7 +--- .../app_subscription_contract/src/main.nr | 11 +++-- .../src/subscription_note.nr | 7 ++-- .../benchmarking_contract/src/main.nr | 1 + .../contracts/card_game_contract/src/cards.nr | 17 ++++---- .../contracts/child_contract/src/main.nr | 6 +-- .../events/private_function_broadcasted.nr | 3 +- .../unconstrained_function_broadcasted.nr | 3 +- .../src/main.nr | 6 +-- .../contracts/counter_contract/src/main.nr | 7 +--- .../delegated_on_contract/src/main.nr | 14 +++---- .../contracts/delegator_contract/src/main.nr | 11 +++-- .../docs_example_contract/src/main.nr | 13 +++--- .../docs_example_contract/src/options.nr | 7 ++-- .../easy_private_token_contract/src/main.nr | 4 +- .../easy_private_voting_contract/src/main.nr | 7 ++-- .../src/ecdsa_public_key_note.nr | 10 +++-- .../ecdsa_account_contract/src/main.nr | 12 +++--- .../contracts/escrow_contract/src/main.nr | 10 +---- .../contracts/fpc_contract/src/interfaces.nr | 5 ++- .../contracts/gas_token_contract/src/lib.nr | 3 +- .../import_test_contract/src/main.nr | 3 +- .../inclusion_proofs_contract/src/main.nr | 16 +++---- .../contracts/lending_contract/src/asset.nr | 3 +- .../lending_contract/src/interfaces.nr | 6 ++- .../contracts/lending_contract/src/main.nr | 6 +-- .../contracts/parent_contract/src/main.nr | 2 +- .../pending_note_hashes_contract/src/main.nr | 9 +--- .../contracts/price_feed_contract/src/main.nr | 5 +-- .../contracts/reader_contract/src/main.nr | 2 +- .../schnorr_account_contract/src/main.nr | 8 +--- .../src/main.nr | 5 +-- .../src/main.nr | 5 +-- .../src/util.nr | 3 +- .../contracts/slow_tree_contract/src/main.nr | 7 ++-- .../stateful_test_contract/src/main.nr | 5 +-- .../contracts/test_contract/src/main.nr | 17 ++++---- .../src/types/balances_map.nr | 16 ++++--- .../src/types/roles.nr | 42 +++++++++---------- .../src/types/token_note.nr | 8 +--- .../src/types/transparent_note.nr | 8 ++-- .../token_bridge_contract/src/main.nr | 4 +- .../src/token_interface.nr | 4 +- .../token_contract/src/types/balances_map.nr | 20 +++++---- .../token_contract/src/types/token_note.nr | 9 ++-- .../src/types/transparent_note.nr | 7 ++-- .../token_portal_content_hash_lib/src/lib.nr | 16 ++++--- .../uniswap_contract/src/interfaces.nr | 4 +- .../contracts/uniswap_contract/src/main.nr | 4 +- .../contracts/uniswap_contract/src/util.nr | 3 +- 55 files changed, 207 insertions(+), 232 deletions(-) create mode 100644 noir-projects/aztec-nr/aztec/src/prelude.nr diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr index dc04a740238..529b5e78c32 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr @@ -1,4 +1,4 @@ -use dep::aztec::context::PrivateContext; +use dep::aztec::prelude::PrivateContext; use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; use crate::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES}; diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr index 657d21dff30..89616efa830 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr @@ -1,6 +1,6 @@ -use dep::aztec::context::PrivateContext; +use dep::aztec::prelude::PrivateContext; use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__FEE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; -use crate::entrypoint::function_call::{FunctionCall}; +use crate::entrypoint::function_call::FunctionCall; // 2 * 4 (function call) + 1 global FEE_PAYLOAD_SIZE: Field = 9; diff --git a/noir-projects/aztec-nr/aztec/src/lib.nr b/noir-projects/aztec-nr/aztec/src/lib.nr index 2d6eeb862c9..a57f6c018b5 100644 --- a/noir-projects/aztec-nr/aztec/src/lib.nr +++ b/noir-projects/aztec-nr/aztec/src/lib.nr @@ -11,4 +11,5 @@ mod messaging; mod note; mod oracle; mod state_vars; +mod prelude; use dep::protocol_types; diff --git a/noir-projects/aztec-nr/aztec/src/prelude.nr b/noir-projects/aztec-nr/aztec/src/prelude.nr new file mode 100644 index 00000000000..9d65d3f1dc6 --- /dev/null +++ b/noir-projects/aztec-nr/aztec/src/prelude.nr @@ -0,0 +1,14 @@ +use dep::protocol_types::{address::{AztecAddress, EthAddress}, abis::function_selector::FunctionSelector}; +use crate::{ + state_vars::{ + map::Map, private_immutable::PrivateImmutable, private_mutable::PrivateMutable, + public_immutable::PublicImmutable, public_mutable::PublicMutable, private_set::PrivateSet, + shared_immutable::SharedImmutable +}, + log::{emit_unencrypted_log, emit_encrypted_log}, context::PrivateContext, + note::{ + note_header::NoteHeader, note_interface::NoteInterface, note_getter_options::NoteGetterOptions, + note_viewer_options::NoteViewerOptions, + utils::compute_note_hash_and_nullifier as utils_compute_note_hash_and_nullifier +} +}; diff --git a/noir-projects/aztec-nr/value-note/src/utils.nr b/noir-projects/aztec-nr/value-note/src/utils.nr index 03a2fd637f3..446a00c232c 100644 --- a/noir-projects/aztec-nr/value-note/src/utils.nr +++ b/noir-projects/aztec-nr/value-note/src/utils.nr @@ -1,10 +1,7 @@ -use dep::std::option::Option; -use dep::aztec::context::PrivateContext; -use dep::aztec::note::note_getter_options::{NoteGetterOptions, SortOrder}; +use dep::aztec::prelude::{AztecAddress, PrivateContext, PrivateSet, NoteGetterOptions}; +use dep::aztec::note::note_getter_options::SortOrder; use dep::aztec::oracle::get_public_key::get_public_key; -use dep::aztec::state_vars::PrivateSet; use crate::{filter::filter_notes_min_sum, value_note::{ValueNote, VALUE_NOTE_LEN}}; -use dep::aztec::protocol_types::address::AztecAddress; // Sort the note values (0th field) in descending order. // Pick the fewest notes whose sum is equal to or greater than `amount`. diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr index 941f86472f0..234c5d0aefe 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr @@ -1,8 +1,5 @@ -use dep::aztec::context::PrivateContext; -use dep::aztec::protocol_types::{ - constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}, - address::AztecAddress -}; +use dep::aztec::prelude::{PrivateContext, AztecAddress}; +use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; use dep::authwit::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES}; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr index 740dab33bc5..3a0cb8f1e74 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr @@ -6,13 +6,12 @@ contract AppSubscription { use dep::std::option::Option; use crate::dapp_payload::DAppPayload; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; - - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, - state_vars::{Map, PrivateMutable, PublicMutable, SharedImmutable} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, PrivateContext, NoteHeader, Map, PrivateMutable, PublicMutable, + SharedImmutable }; + + use dep::aztec::{context::Context, note::utils as note_utils, oracle::get_public_key::get_public_key}; use dep::authwit::{account::AccountActions, auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit}; use crate::subscription_note::{SubscriptionNote, SUBSCRIPTION_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr index 8bb87a798ac..3f454f7c469 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr @@ -1,8 +1,7 @@ +use dep::aztec::prelude::{AztecAddress, PrivateContext, NoteHeader, emit_encrypted_log, NoteInterface}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::pedersen_hash, - oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, context::PrivateContext, protocol_types::{address::AztecAddress} + note::utils::compute_note_hash_for_consumption, hash::pedersen_hash, + oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key} }; global SUBSCRIPTION_NOTE_LEN: Field = 3; diff --git a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr index 4044cdd6920..873c8d158d1 100644 --- a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr @@ -5,6 +5,7 @@ // arise from code changes. contract Benchmarking { + use dep::aztec::prelude::{AztecAddress, FunctionSelector}; use dep::value_note::{utils::{increment, decrement}, value_note::ValueNote}; use dep::aztec::{ diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr index 59208aa986e..02be2b0f061 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr @@ -1,11 +1,8 @@ +use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext, NoteHeader, NoteGetterOptions, NoteViewerOptions}; + use dep::aztec::{ - protocol_types::{address::AztecAddress, constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}}, - context::{PrivateContext, PublicContext, Context}, - note::{ - note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, - note_getter::view_notes -}, - state_vars::PrivateSet + protocol_types::constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, + context::{PublicContext, Context}, note::note_getter::view_notes, state_vars::PrivateSet }; use dep::std; use dep::std::{option::Option}; @@ -161,7 +158,11 @@ impl Deck { global PACK_CARDS = 3; // Limited by number of write requests (max 4) -pub fn get_pack_cards(seed: Field, owner: AztecAddress, context: &mut PrivateContext) -> [Card; PACK_CARDS] { +pub fn get_pack_cards( + seed: Field, + owner: AztecAddress, + context: &mut PrivateContext +) -> [Card; PACK_CARDS] { // generate pseudo randomness deterministically from 'seed' and user secret let secret = context.request_nullifier_secret_key(owner); let mix = secret.high + secret.low + seed; diff --git a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr index 315c4c7ec34..d78d9da9b4a 100644 --- a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr @@ -1,11 +1,9 @@ // A contract used along with `Parent` contract to test nested calls. contract Child { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PublicMutable, PrivateSet, PrivateContext, emit_unencrypted_log}; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_unencrypted_log, - state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector, call_context::CallContext}, address::AztecAddress}, + context::{PublicContext, Context}, protocol_types::{abis::{call_context::CallContext}}, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils} }; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr index 99092cf70e3..c2888d7430b 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr @@ -1,6 +1,7 @@ +use dep::aztec::prelude::FunctionSelector; use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ - contract_class_id::ContractClassId, abis::function_selector::FunctionSelector, + contract_class_id::ContractClassId, constants::{ FUNCTION_TREE_HEIGHT, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS, diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr index aeaeaeaf627..c40c52a06a4 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr @@ -1,6 +1,7 @@ +use dep::aztec::prelude::FunctionSelector; use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ - contract_class_id::ContractClassId, abis::function_selector::FunctionSelector, + contract_class_id::ContractClassId, constants::{ ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS, REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr index 760b4e5ff64..d1f72aa53e6 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr @@ -2,9 +2,9 @@ mod events; mod capsule; contract ContractClassRegisterer { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, emit_unencrypted_log}; use dep::aztec::protocol_types::{ - address::{AztecAddress, EthAddress}, contract_class_id::ContractClassId, + contract_class_id::ContractClassId, constants::{ ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE @@ -12,7 +12,7 @@ contract ContractClassRegisterer { traits::{Serialize} }; - use dep::aztec::log::{emit_unencrypted_log, emit_unencrypted_log_from_private}; + use dep::aztec::log::{emit_unencrypted_log_from_private}; use crate::events::{ class_registered::ContractClassRegistered, diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index 7782c5c3bf8..806afb02ffa 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,10 +1,7 @@ contract Counter { // docs:start:imports - use dep::aztec::protocol_types::address::AztecAddress; - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - state_vars::Map - }; + use dep::aztec::prelude::{AztecAddress, Map}; + use dep::aztec::{context::Context, note::utils as note_utils}; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::easy_private_state::EasyPrivateUint; // docs:end:imports diff --git a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr index 928760f048f..5b1ee37626f 100644 --- a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr @@ -1,15 +1,13 @@ // A contract used along with `Parent` contract to test nested calls. contract DelegatedOn { - use dep::std::option::Option; + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, NoteViewerOptions, + emit_unencrypted_log, PublicMutable, PrivateSet, PrivateContext + }; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_unencrypted_log, - state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector, call_context::CallContext}, address::AztecAddress}, - note::{ - note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, - utils as note_utils, note_header::NoteHeader - } + context::{PublicContext, Context}, protocol_types::abis::call_context::CallContext, + note::utils as note_utils }; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr index d93629e4fea..42a4f9577fc 100644 --- a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr @@ -1,12 +1,11 @@ // A contract used along with `Parent` contract to test nested calls. contract Delegator { - use dep::std::option::Option; - - use dep::aztec::{ - log::emit_unencrypted_log, state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector}, address::AztecAddress}, - note::{note_viewer_options::NoteViewerOptions, utils as note_utils, note_header::NoteHeader} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteViewerOptions, emit_unencrypted_log, + PublicMutable, PrivateSet }; + + use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; struct Storage { diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr index de6e6b629db..d5304c7a83f 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr @@ -13,14 +13,13 @@ mod types; contract DocsExample { // how to import dependencies defined in your workspace - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, + PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, PrivateSet, SharedImmutable + }; use dep::aztec::{ - note::{ - note_header::NoteHeader, note_getter_options::{NoteGetterOptions, Comparator}, - note_viewer_options::{NoteViewerOptions}, utils as note_utils - }, - context::{PrivateContext, PublicContext, Context}, - state_vars::{Map, PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, PrivateSet, SharedImmutable} + note::{note_getter_options::Comparator, note_viewer_options::NoteViewerOptions, utils as note_utils}, + context::{PublicContext, Context} }; // how to import methods from other files/folders within your workspace use crate::options::create_account_card_getter_options; diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr index 362828f7ce7..7083ff65f75 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr @@ -1,7 +1,8 @@ use crate::types::card_note::{CardNote, CARD_NOTE_LEN}; -use dep::aztec::protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}; -use dep::aztec::note::note_getter_options::{NoteGetterOptions, Sort, SortOrder}; -use dep::std::option::Option; +use dep::aztec::prelude::{AztecAddress, NoteGetterOptions}; + +use dep::aztec::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL; +use dep::aztec::note::note_getter_options::{Sort, SortOrder}; // Shows how to use NoteGetterOptions and query for notes. diff --git a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr index 0acb8c4e028..d5cb59dc268 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr @@ -1,7 +1,7 @@ // docs:start:easy_private_token_contract contract EasyPrivateToken { - use dep::aztec::protocol_types::address::AztecAddress; - use dep::aztec::{note::{note_header::NoteHeader, utils as note_utils}, state_vars::Map}; + use dep::aztec::prelude::{AztecAddress, NoteHeader, Map}; + use dep::aztec::note::utils as note_utils; use dep::value_note::{balance_utils, value_note::ValueNote}; use dep::easy_private_state::EasyPrivateUint; diff --git a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr index 5a25136195d..86991286193 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr @@ -1,9 +1,10 @@ contract EasyPrivateVoting { // docs:start:imports - use dep::aztec::{ - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}, - context::{PrivateContext, Context}, state_vars::{Map, PublicMutable} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteGetterOptions, PrivateContext, + Map, PublicMutable }; + use dep::aztec::context::Context; // docs:end:imports // docs:start:storage_struct struct Storage { diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr index 1ac71be5690..992dd56b5a6 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr @@ -1,8 +1,12 @@ -use dep::aztec::protocol_types::address::AztecAddress; +use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteGetterOptions, PrivateContext, + emit_encrypted_log +}; + use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, + note::utils::compute_note_hash_for_consumption, oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, hash::pedersen_hash, context::PrivateContext + hash::pedersen_hash }; global ECDSA_PUBLIC_KEY_NOTE_LEN: Field = 5; diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr index 3ab9a2edfcd..d47b0a61328 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr @@ -3,14 +3,12 @@ mod ecdsa_public_key_note; // Account contract that uses ECDSA signatures for authentication on the same curve as Ethereum. // The signing key is stored in an immutable private note and should be different from the signing key. contract EcdsaAccount { - use dep::aztec::protocol_types::{abis::{call_context::CallContext, function_selector::FunctionSelector}, address::AztecAddress}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable}; + + use dep::aztec::protocol_types::abis::call_context::CallContext; use dep::std; - use dep::std::option::Option; - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, oracle::get_public_key::get_public_key, - state_vars::PrivateImmutable - }; + + use dep::aztec::{context::{PublicContext, Context}, note::utils as note_utils, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr index db9c51eab85..6af98e2cacd 100644 --- a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr @@ -1,14 +1,8 @@ // Sample escrow contract that stores a balance of a private token on behalf of an owner. contract Escrow { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateSet}; - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, state_vars::PrivateSet - }; + use dep::aztec::{context::{PublicContext, Context}, note::{utils as note_utils}, oracle::get_public_key::get_public_key}; use dep::address_note::address_note::{AddressNote, ADDRESS_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr index 0c49a06111f..717c8223f0e 100644 --- a/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr @@ -1,6 +1,7 @@ -use dep::aztec::context::{PrivateContext, PublicContext}; +use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, PrivateContext}; +use dep::aztec::context::PublicContext; -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::RETURN_VALUES_LENGTH}; +use dep::aztec::protocol_types::constants::RETURN_VALUES_LENGTH; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr b/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr index 9d7dbf3b74e..5210894d79f 100644 --- a/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr +++ b/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr @@ -1,5 +1,6 @@ +use dep::aztec::prelude::{AztecAddress, EthAddress}; use dep::aztec::context::PublicContext; -use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, hash::sha256_to_field}; +use dep::aztec::protocol_types::hash::sha256_to_field; pub fn calculate_fee(_context: PublicContext) -> U128 { U128::from_integer(1) diff --git a/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr index e575b117ae9..0c06ea7e276 100644 --- a/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr @@ -3,7 +3,8 @@ mod test_contract_interface; // Contract that uses the autogenerated interface of the Test contract for calling its functions. // Used for testing calling into other contracts via autogenerated interfaces. contract ImportTest { - use dep::aztec::protocol_types::address::AztecAddress; + use dep::aztec::prelude::AztecAddress; + use crate::test_contract_interface::{ TestPrivateContextInterface, TestPublicContextInterface, AStructTestCodeGenStruct, ADeepStructTestCodeGenStruct, ANoteADeepStructTestCodeGenStruct, diff --git a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr index 2ca5b2111e6..dccc0c425cf 100644 --- a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr @@ -1,16 +1,12 @@ // A demonstration of inclusion and non-inclusion proofs. contract InclusionProofs { - use dep::aztec::protocol_types::{ - abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}, - grumpkin_point::GrumpkinPoint, contract_class_id::ContractClassId - }; - use dep::aztec::{ - state_vars::{Map, PrivateSet, PublicMutable}, context::Context, - note::{ - note_getter_options::NoteGetterOptions, note_getter_options::NoteStatus, - note_header::NoteHeader, utils as note_utils - } + use dep::aztec::prelude::{ + AztecAddress, EthAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, + PrivateSet, PublicMutable }; + + use dep::aztec::protocol_types::{grumpkin_point::GrumpkinPoint, contract_class_id::ContractClassId}; + use dep::aztec::{context::Context, note::{note_getter_options::NoteStatus, utils as note_utils}}; // docs:start:imports use dep::aztec::history::{ contract_inclusion::{prove_contract_inclusion, prove_contract_inclusion_at}, diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr index 88f95f6e848..5dc8cb7f300 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr @@ -1,4 +1,5 @@ -use dep::aztec::protocol_types::{address::AztecAddress, traits::{Deserialize, Serialize}}; +use dep::aztec::prelude::AztecAddress; +use dep::aztec::protocol_types::traits::{Deserialize, Serialize}; // Struct to be used to represent "totals". Generally, there should be one per asset. // It stores the global values that are shared among all users, such as an accumulator diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr index 631f5eed5ca..7593f8353d2 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr @@ -1,7 +1,9 @@ -use dep::aztec::context::{PrivateContext, PublicContext}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, PrivateContext}; + +use dep::aztec::context::PublicContext; +use dep::aztec::protocol_types::constants::RETURN_VALUES_LENGTH; use crate::asset::Asset; -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::RETURN_VALUES_LENGTH}; struct PriceFeed { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr index 7a6e6d1376c..7ed23878394 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr @@ -11,9 +11,9 @@ mod interfaces; // - A way to repay all debt at once // - Liquidations contract Lending { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - use dep::std::option::Option; - use dep::aztec::{context::{PrivateContext, PublicContext, Context}, state_vars::{Map, PublicMutable}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, PrivateContext, Map, PublicMutable}; + use dep::aztec::context::{PublicContext, Context}; + use crate::asset::Asset; use crate::interest_math::compute_multiplier; use crate::helpers::{covered_by_collateral, DebtReturn, debt_updates, debt_value, compute_identifier}; diff --git a/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr b/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr index b89dcb83d39..056ba803ec7 100644 --- a/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr @@ -1,6 +1,6 @@ // A contract used along with `Child` contract to test nested calls. contract Parent { - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector}; #[aztec(private)] fn constructor() {} diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index 4115f9c34c7..2e1939399f6 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -4,14 +4,9 @@ // be read/nullified before their creation etc. contract PendingNoteHashes { // Libs - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet}; use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_encrypted_log, - note::{note_getter::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, - state_vars::{Map, PrivateSet} - }; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::{context::{PublicContext, Context}, log::emit_encrypted_log, note::utils as note_utils}; struct Storage { balances: Map>, diff --git a/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr b/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr index afd14a72400..4741a390917 100644 --- a/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr @@ -1,9 +1,8 @@ mod asset; contract PriceFeed { - use dep::std::option::Option; - use dep::aztec::{context::{PrivateContext, PublicContext, Context}, state_vars::{Map, PublicMutable}}; - use dep::aztec::protocol_types::address::AztecAddress; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext, Map, PublicMutable}; + use dep::aztec::{context::{PublicContext, Context}}; use crate::asset::Asset; // Storage structure, containing all storage, and specifying what slots they use. diff --git a/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr b/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr index cfe709c3ee8..058c26129b5 100644 --- a/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr @@ -1,5 +1,5 @@ contract Reader { - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector}; use dep::compressed_string::FieldCompressedString; diff --git a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr index 5717762a7c1..b2f44479b2c 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr @@ -4,14 +4,10 @@ mod public_key_note; // The signing key is stored in an immutable private note and should be different from the encryption/nullifying key. contract SchnorrAccount { use dep::std; - use dep::std::option::Option; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, PrivateContext, PrivateImmutable}; - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, state_vars::PrivateImmutable - }; + use dep::aztec::{context::Context, note::utils as note_utils, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr index dc1d8912af6..5411e14a692 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr @@ -2,10 +2,7 @@ // Account contract that uses Schnorr signatures for authentication using a hardcoded public key. contract SchnorrHardcodedAccount { use dep::std; - use dep::aztec::{ - context::PrivateContext, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} - }; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, diff --git a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr index cdaf950180f..ed6bfef6352 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr @@ -2,10 +2,7 @@ mod util; mod auth_oracle; contract SchnorrSingleKeyAccount { - use dep::aztec::{ - context::{PrivateContext}, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} - }; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext}; use dep::authwit::{entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions}; diff --git a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr index fff77376e94..f30cdc2bd18 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr @@ -1,4 +1,5 @@ -use dep::aztec::protocol_types::address::{AztecAddress, PublicKeysHash}; +use dep::aztec::prelude::AztecAddress; +use dep::aztec::protocol_types::address::PublicKeysHash; use dep::std::{schnorr::verify_signature}; use crate::auth_oracle::{AuthWitness}; diff --git a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr index 5161f7b04db..b93c011a7cd 100644 --- a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr @@ -7,13 +7,12 @@ mod types; // This is made as a separate contract for one thing mainly. Making it simpler to use. // TODO(#4760): Rename slow updates to shared mutable and ideally move the impl to state-vars in aztec-nr. contract SlowTree { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; + use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteViewerOptions, PrivateContext, Map, PublicMutable, PrivateSet}; + use dep::std::option::Option; use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::ValueNote}; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, - state_vars::{Map, PublicMutable, PrivateSet}, + context::{PublicContext, Context}, note::utils as note_utils, protocol_types::type_serialization::FIELD_SERIALIZED_LEN }; use dep::slow_updates_tree::{SlowMap, Leaf, SlowUpdateProof, compute_merkle_root, deserialize_slow_update_proof}; diff --git a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr index 587f7713fd8..3e23df816c8 100644 --- a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr @@ -9,7 +9,7 @@ contract StatefulTest { state_vars::{Map, PublicMutable, PrivateSet}, oracle::get_contract_instance::get_contract_instance, initializer::{mark_as_initialized, assert_is_initialized}, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}, + protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} }; struct Storage { @@ -65,7 +65,6 @@ contract StatefulTest { increment(recipient_notes, amount, recipient); } - #[aztec(public)] fn increment_public_value(owner: AztecAddress, value: Field) { assert_is_initialized(&mut context); @@ -89,4 +88,4 @@ contract StatefulTest { unconstrained fn get_public_value(owner: AztecAddress) -> pub Field { storage.public_values.at(owner).read() } -} \ No newline at end of file +} diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index 771a301cbe7..6ccffbf17f9 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -1,9 +1,12 @@ // 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::aztec::prelude::{ + AztecAddress, EthAddress, NoteHeader, NoteGetterOptions, NoteViewerOptions, PrivateContext, + PrivateImmutable, PrivateSet + }; + use dep::aztec::protocol_types::{ abis::private_circuit_public_inputs::PrivateCircuitPublicInputs, - address::{AztecAddress, EthAddress}, constants::{MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTES_PER_PAGE}, hash::hash_args }; // docs:start:unencrypted_import @@ -11,17 +14,15 @@ contract Test { // docs:end:unencrypted_import use dep::aztec::{ - context::{Context, inputs::private_context_inputs::PrivateContextInputs}, + context::{Context, inputs::private_context_inputs::PrivateContextInputs}, hash::{pedersen_hash, compute_secret_hash}, - context::PrivateContext, note::{ - note_header::NoteHeader, utils as note_utils, lifecycle::{create_note, destroy_note}, - note_getter::{get_notes, view_notes}, note_getter_options::{NoteGetterOptions, NoteStatus}, - note_viewer_options::NoteViewerOptions + utils as note_utils, lifecycle::{create_note, destroy_note}, + note_getter::{get_notes, view_notes}, note_getter_options::NoteStatus }, deploy::{deploy_contract as aztec_deploy_contract}, oracle::{get_public_key::get_public_key as get_public_key_oracle, context::get_portal_address, rand::rand}, - state_vars::{PrivateImmutable, PrivateSet}, log::emit_unencrypted_log_from_private + log::emit_unencrypted_log_from_private }; use dep::token_portal_content_hash_lib::{get_mint_private_content_hash, get_mint_public_content_hash}; use dep::field_note::field_note::FieldNote; diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr index 95653508f0d..a6e0ff2dc69 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr @@ -1,12 +1,7 @@ -use dep::std::option::Option; +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteViewerOptions}; use dep::aztec::{ - context::Context, - protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, - state_vars::{PrivateSet, Map}, - note::{ - note_getter::view_notes, note_getter_options::{NoteGetterOptions, SortOrder}, - note_viewer_options::NoteViewerOptions, note_header::NoteHeader, note_interface::NoteInterface -} + context::Context, protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, + note::{note_getter::view_notes, note_getter_options::SortOrder} }; use crate::types::token_note::{TokenNote, OwnedNote}; @@ -26,7 +21,10 @@ impl BalancesMap { } } - unconstrained pub fn balance_of(self: Self, owner: AztecAddress) -> U128 where T: NoteInterface + OwnedNote { + unconstrained pub fn balance_of( + self: Self, + owner: AztecAddress + ) -> U128 where T: NoteInterface + OwnedNote { self.balance_of_with_offset(owner, 0) } diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr index 57dab6e890d..8f010dc43b6 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr @@ -10,33 +10,29 @@ struct UserFlags { impl UserFlags { - pub fn new(value: U128) -> Self { - let is_admin = value & ADMIN_FLAG == ADMIN_FLAG; - let is_minter = value & MINTER_FLAG == MINTER_FLAG; - let is_blacklisted = value & BLACKLIST_FLAG == BLACKLIST_FLAG; - - Self { - is_admin, - is_minter, - is_blacklisted, + pub fn new(value: U128) -> Self { + let is_admin = value & ADMIN_FLAG == ADMIN_FLAG; + let is_minter = value & MINTER_FLAG == MINTER_FLAG; + let is_blacklisted = value & BLACKLIST_FLAG == BLACKLIST_FLAG; + + Self { is_admin, is_minter, is_blacklisted } } - } - pub fn get_value(self) -> U128 { - let mut value: U128 = U128::from_integer(0); + pub fn get_value(self) -> U128 { + let mut value: U128 = U128::from_integer(0); - if self.is_admin { - value = value | ADMIN_FLAG; - } + if self.is_admin { + value = value | ADMIN_FLAG; + } - if self.is_minter { - value = value | MINTER_FLAG; - } + if self.is_minter { + value = value | MINTER_FLAG; + } - if self.is_blacklisted { - value = value | BLACKLIST_FLAG; - } + if self.is_blacklisted { + value = value | BLACKLIST_FLAG; + } - value - } + value + } } diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr index c9233038f30..ee921232453 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr @@ -1,10 +1,6 @@ -use dep::aztec::{ - protocol_types::address::AztecAddress, - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - context::PrivateContext, log::emit_encrypted_log, hash::pedersen_hash -}; +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, PrivateContext, emit_encrypted_log}; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::pedersen_hash}; use dep::aztec::oracle::{rand::rand, nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}; -use dep::std::option::Option; trait OwnedNote { fn new(amount: U128, owner: AztecAddress) -> Self; diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr index a444d27df26..1f7136d8004 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr @@ -1,8 +1,6 @@ // docs:start:token_types_all -use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::{compute_secret_hash, pedersen_hash}, context::PrivateContext -}; +use dep::aztec::prelude::{NoteHeader, NoteInterface, PrivateContext}; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::{compute_secret_hash, pedersen_hash}}; global TRANSPARENT_NOTE_LEN: Field = 2; @@ -86,4 +84,4 @@ impl TransparentNote { assert(self.secret_hash == hash); } } -// docs:end:token_types_all \ No newline at end of file +// docs:end:token_types_all diff --git a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr index 352d86e1980..22274097e2d 100644 --- a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr @@ -7,9 +7,9 @@ mod token_interface; // Bridge has to be set as a minter on the token before it can be used contract TokenBridge { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PublicMutable}; - use dep::aztec::{context::{Context}, hash::{compute_secret_hash}, state_vars::{PublicMutable}}; + use dep::aztec::{context::Context, hash::compute_secret_hash}; use dep::token_portal_content_hash_lib::{get_mint_public_content_hash, get_mint_private_content_hash, get_withdraw_content_hash}; diff --git a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr index 4f0ef61e978..26c852a58bb 100644 --- a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr +++ b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr @@ -1,6 +1,6 @@ // docs:start:token_bridge_token_interface -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; -use dep::aztec::{context::{PrivateContext, PublicContext, Context}}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PrivateContext}; +use dep::aztec::context::{PublicContext, Context}; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr index 740d328413f..d48e925df34 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr @@ -1,12 +1,11 @@ -use dep::std::option::Option; +use dep::aztec::prelude::{ + AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, PrivateSet, Map, + emit_encrypted_log +}; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, hash::pedersen_hash, - protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, - state_vars::{PrivateSet, Map}, - note::{ - note_getter::view_notes, note_getter_options::{NoteGetterOptions, SortOrder}, - note_viewer_options::NoteViewerOptions, note_header::NoteHeader, note_interface::NoteInterface -} + context::{PublicContext, Context}, hash::pedersen_hash, + protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + note::{note_getter::view_notes, note_getter_options::SortOrder, note_interface::NoteInterface} }; use crate::types::token_note::{TokenNote, OwnedNote}; @@ -26,7 +25,10 @@ impl BalancesMap { } } - unconstrained pub fn balance_of(self: Self, owner: AztecAddress) -> U128 where T: NoteInterface + OwnedNote { + unconstrained pub fn balance_of( + self: Self, + owner: AztecAddress + ) -> U128 where T: NoteInterface + OwnedNote { self.balance_of_with_offset(owner, 0) } diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr index c9233038f30..5ea6128161a 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr @@ -1,10 +1,9 @@ -use dep::aztec::{ - protocol_types::address::AztecAddress, - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - context::PrivateContext, log::emit_encrypted_log, hash::pedersen_hash +use dep::aztec::prelude::{ + AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, PrivateSet, Map, + emit_encrypted_log }; +use dep::aztec::{note::{note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, hash::pedersen_hash}; use dep::aztec::oracle::{rand::rand, nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}; -use dep::std::option::Option; trait OwnedNote { fn new(amount: U128, owner: AztecAddress) -> Self; diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr index a444d27df26..a9c1d4f3423 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr @@ -1,7 +1,8 @@ // docs:start:token_types_all +use dep::aztec::prelude::{NoteHeader, PrivateContext}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::{compute_secret_hash, pedersen_hash}, context::PrivateContext + note::{note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, + hash::{compute_secret_hash, pedersen_hash} }; global TRANSPARENT_NOTE_LEN: Field = 2; @@ -86,4 +87,4 @@ impl TransparentNote { assert(self.secret_hash == hash); } } -// docs:end:token_types_all \ No newline at end of file +// docs:end:token_types_all diff --git a/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr b/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr index 2106b0a585d..f0bda067f1f 100644 --- a/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr +++ b/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr @@ -1,16 +1,10 @@ // docs:start:mint_public_content_hash_nr -use dep::aztec::protocol_types::{ - address::{ - AztecAddress, - EthAddress, - }, - hash::sha256_to_field, -}; +use dep::aztec::prelude::{AztecAddress, EthAddress}; +use dep::aztec::protocol_types::hash::sha256_to_field; // Computes a content hash of a deposit/mint_public message. // Refer TokenPortal.sol for reference on L1. pub fn get_mint_public_content_hash(owner: AztecAddress, amount: Field, canceller: EthAddress) -> Field { - let mut hash_bytes: [u8; 100] = [0; 100]; let recipient_bytes = owner.to_field().to_be_bytes(32); let amount_bytes = amount.to_be_bytes(32); @@ -36,7 +30,11 @@ pub fn get_mint_public_content_hash(owner: AztecAddress, amount: Field, cancelle // docs:start:get_mint_private_content_hash // Computes a content hash of a deposit/mint_private message. // Refer TokenPortal.sol for reference on L1. -pub fn get_mint_private_content_hash(secret_hash_for_redeeming_minted_notes: Field, amount: Field, canceller: EthAddress) -> Field { +pub fn get_mint_private_content_hash( + secret_hash_for_redeeming_minted_notes: Field, + amount: Field, + canceller: EthAddress +) -> Field { let mut hash_bytes: [u8; 100] = [0; 100]; let secret_hash_bytes = secret_hash_for_redeeming_minted_notes.to_be_bytes(32); let amount_bytes = amount.to_be_bytes(32); diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr index f70a2f93c38..77ef1575390 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr @@ -1,6 +1,6 @@ // docs:start:interfaces -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; -use dep::aztec::{context::{PrivateContext, PublicContext}}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PrivateContext}; +use dep::aztec::context::PublicContext; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr index 1188a027c8e..7295fd47488 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr @@ -6,8 +6,8 @@ mod util; // Has two separate flows for private and public respectively // Uses the token bridge contract, which tells which input token we need to talk to and handles the exit funds to L1 contract Uniswap { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; - use dep::aztec::{oracle::{context::get_portal_address}, state_vars::{Map, PublicMutable}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, Map, PublicMutable}; + use dep::aztec::oracle::context::get_portal_address; use dep::authwit::auth::{ IS_VALID_SELECTOR, assert_current_call_valid_authwit_public, compute_call_authwit_hash, diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr index 6be6bab884e..b5928337197 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr @@ -1,5 +1,6 @@ // docs:start:uniswap_public_content_hash -use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, hash::sha256_to_field}; +use dep::aztec::prelude::{AztecAddress, EthAddress}; +use dep::aztec::protocol_types::hash::sha256_to_field; // This method computes the L2 to L1 message content hash for the public // refer `l1-contracts/test/portals/UniswapPortal.sol` on how L2 to L1 message is expected From e0634b4beb9888ef078abb283271a5b67c336851 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 18:56:48 +0000 Subject: [PATCH 02/15] chore: more prelude --- boxes/react/src/contracts/src/main.nr | 6 ++---- boxes/vanilla-js/src/contracts/src/main.nr | 6 ++---- .../contracts/docs_example_contract/src/types/card_note.nr | 6 +++--- .../schnorr_account_contract/src/public_key_note.nr | 7 +++---- .../contracts/token_contract/src/types/token_note.nr | 6 +++--- .../contracts/token_contract/src/types/transparent_note.nr | 7 ++----- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/boxes/react/src/contracts/src/main.nr b/boxes/react/src/contracts/src/main.nr index e57aac08ab1..b2ead20bc22 100644 --- a/boxes/react/src/contracts/src/main.nr +++ b/boxes/react/src/contracts/src/main.nr @@ -1,8 +1,6 @@ contract BoxReact { - use dep::aztec::{ - protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map}, - note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader} - }; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; + use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/boxes/vanilla-js/src/contracts/src/main.nr b/boxes/vanilla-js/src/contracts/src/main.nr index bb374393d5d..4bb9d90b4f2 100644 --- a/boxes/vanilla-js/src/contracts/src/main.nr +++ b/boxes/vanilla-js/src/contracts/src/main.nr @@ -1,8 +1,6 @@ contract Vanilla { - use dep::aztec::{ - protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map}, - note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader} - }; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; + use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr index 356e6421c21..6d9add2ee86 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr @@ -1,8 +1,8 @@ +use dep::aztec::prelude::{AztecAddress, NoteInterface, NoteHeader, PrivateContext, emit_encrypted_log}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, + note::{utils::compute_note_hash_for_consumption}, oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, hash::pedersen_hash, context::PrivateContext, - protocol_types::{address::AztecAddress, traits::Empty} + hash::pedersen_hash, protocol_types::traits::Empty }; // Shows how to create a custom note diff --git a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr index d552a44f4a0..7b55db4476c 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr @@ -1,8 +1,7 @@ +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, PrivateContext, emit_encrypted_log}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::pedersen_hash, - oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, context::PrivateContext, protocol_types::{address::AztecAddress} + note::utils::compute_note_hash_for_consumption, hash::pedersen_hash, + oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key} }; global PUBLIC_KEY_NOTE_LEN: Field = 3; diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr index 5ea6128161a..37179b2f326 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr @@ -1,8 +1,8 @@ use dep::aztec::prelude::{ - AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, PrivateSet, Map, - emit_encrypted_log + AztecAddress, NoteInterface, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, + PrivateSet, Map, emit_encrypted_log }; -use dep::aztec::{note::{note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, hash::pedersen_hash}; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::pedersen_hash}; use dep::aztec::oracle::{rand::rand, nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}; trait OwnedNote { diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr index a9c1d4f3423..79f059b20c2 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr @@ -1,9 +1,6 @@ // docs:start:token_types_all -use dep::aztec::prelude::{NoteHeader, PrivateContext}; -use dep::aztec::{ - note::{note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::{compute_secret_hash, pedersen_hash} -}; +use dep::aztec::prelude::{NoteHeader, NoteInterface, PrivateContext}; +use dep::aztec::{note::{utils::compute_note_hash_for_consumption}, hash::{compute_secret_hash, pedersen_hash}}; global TRANSPARENT_NOTE_LEN: Field = 2; From 31f8bccae0fd1154d65598650cce813d647f875d Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 18:59:08 +0000 Subject: [PATCH 03/15] chore: update docs import to use prelude --- .../noir-contracts/contracts/test_contract/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index 6ccffbf17f9..afc279bf739 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -10,7 +10,7 @@ contract Test { constants::{MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTES_PER_PAGE}, hash::hash_args }; // docs:start:unencrypted_import - use dep::aztec::log::emit_unencrypted_log; + use dep::aztec::prelude::emit_unencrypted_log; // docs:end:unencrypted_import use dep::aztec::{ From 9123bb7832ee84df6b1f78815b20d4997eb6796d Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 19:22:35 +0000 Subject: [PATCH 04/15] chore: fix build --- .../contracts/benchmarking_contract/src/main.nr | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr index 873c8d158d1..e66c1cc15a8 100644 --- a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr @@ -5,15 +5,13 @@ // arise from code changes. contract Benchmarking { - use dep::aztec::prelude::{AztecAddress, FunctionSelector}; + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, emit_unencrypted_log, Map, + PublicMutable, PrivateSet + }; use dep::value_note::{utils::{increment, decrement}, value_note::ValueNote}; - use dep::aztec::{ - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}, - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, - log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet} - }; + use dep::aztec::{context::{Context}, note::utils as note_utils}; struct Storage { notes: Map>, From be7db483fa1feefb1b244ff41ea3302b0d26ac1e Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 19:27:08 +0000 Subject: [PATCH 05/15] chore: fix mystery necessary import --- .../noir-contracts/contracts/counter_contract/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index 806afb02ffa..f594f723a31 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,6 +1,6 @@ contract Counter { // docs:start:imports - use dep::aztec::prelude::{AztecAddress, Map}; + use dep::aztec::prelude::{AztecAddress, NoteHeader, Map}; use dep::aztec::{context::Context, note::utils as note_utils}; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::easy_private_state::EasyPrivateUint; From 2288df8f76313022a48cbaaa622bb757970da019 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 19:28:44 +0000 Subject: [PATCH 06/15] chore: revert previous commit and fix aztec_macros --- .../noir-contracts/contracts/counter_contract/src/main.nr | 2 +- noir/noir-repo/aztec_macros/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index f594f723a31..806afb02ffa 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,6 +1,6 @@ contract Counter { // docs:start:imports - use dep::aztec::prelude::{AztecAddress, NoteHeader, Map}; + use dep::aztec::prelude::{AztecAddress, Map}; use dep::aztec::{context::Context, note::utils as note_utils}; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::easy_private_state::EasyPrivateUint; diff --git a/noir/noir-repo/aztec_macros/src/lib.rs b/noir/noir-repo/aztec_macros/src/lib.rs index 6191108de86..99289cc21dd 100644 --- a/noir/noir-repo/aztec_macros/src/lib.rs +++ b/noir/noir-repo/aztec_macros/src/lib.rs @@ -1907,7 +1907,7 @@ fn generate_compute_note_hash_and_nullifier_source(note_types: &Vec) -> note_type_id: Field, serialized_note: [Field; 20] ) -> pub [Field; 4] {{ - let note_header = NoteHeader::new(contract_address, nonce, storage_slot); + let note_header = dep::aztec::NoteHeader::new(contract_address, nonce, storage_slot); {} }}", From 12b9e5420843f941194e507e3d335ff25ed6c025 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:25:04 +0000 Subject: [PATCH 07/15] chore: fix use proper path for `compute_note_hash_and_nullifier` --- noir/noir-repo/aztec_macros/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/noir-repo/aztec_macros/src/lib.rs b/noir/noir-repo/aztec_macros/src/lib.rs index 99289cc21dd..1bd1cc6a9db 100644 --- a/noir/noir-repo/aztec_macros/src/lib.rs +++ b/noir/noir-repo/aztec_macros/src/lib.rs @@ -1887,7 +1887,7 @@ fn generate_compute_note_hash_and_nullifier_source(note_types: &Vec) -> let if_statements: Vec = note_types.iter().map(|note_type| format!( "if (note_type_id == {0}::get_note_type_id()) {{ - note_utils::compute_note_hash_and_nullifier({0}::deserialize_content, note_header, serialized_note) + dep::aztec::note::utils::compute_note_hash_and_nullifier({0}::deserialize_content, note_header, serialized_note) }}" , note_type)).collect(); From d26adb148ed88fcd17668f9b2799e6594dbe5471 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:28:27 +0000 Subject: [PATCH 08/15] chore: fix `NoteHeader` import --- noir/noir-repo/aztec_macros/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/noir-repo/aztec_macros/src/lib.rs b/noir/noir-repo/aztec_macros/src/lib.rs index 1bd1cc6a9db..febea007bd4 100644 --- a/noir/noir-repo/aztec_macros/src/lib.rs +++ b/noir/noir-repo/aztec_macros/src/lib.rs @@ -1907,7 +1907,7 @@ fn generate_compute_note_hash_and_nullifier_source(note_types: &Vec) -> note_type_id: Field, serialized_note: [Field; 20] ) -> pub [Field; 4] {{ - let note_header = dep::aztec::NoteHeader::new(contract_address, nonce, storage_slot); + let note_header = dep::aztec::prelude::NoteHeader::new(contract_address, nonce, storage_slot); {} }}", From f9b47bd87e1c2b58d77f53bbcc7d5e42486bbfa6 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:28:40 +0000 Subject: [PATCH 09/15] chore: fix imports --- .../noir-contracts/contracts/slow_tree_contract/src/main.nr | 6 ++++-- .../token_blacklist_contract/src/types/balances_map.nr | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr index b93c011a7cd..e61a09e31bb 100644 --- a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr @@ -7,9 +7,11 @@ mod types; // This is made as a separate contract for one thing mainly. Making it simpler to use. // TODO(#4760): Rename slow updates to shared mutable and ideally move the impl to state-vars in aztec-nr. contract SlowTree { - use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteViewerOptions, PrivateContext, Map, PublicMutable, PrivateSet}; + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteViewerOptions, PrivateContext, + Map, PublicMutable, PrivateSet + }; - use dep::std::option::Option; use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::ValueNote}; use dep::aztec::{ context::{PublicContext, Context}, note::utils as note_utils, diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr index a6e0ff2dc69..c14dfadf4c3 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr @@ -1,4 +1,4 @@ -use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteViewerOptions}; +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteGetterOptions, NoteViewerOptions, PrivateSet, Map}; use dep::aztec::{ context::Context, protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, note::{note_getter::view_notes, note_getter_options::SortOrder} From f5cafb3af8c64a73389599d06932e951a743f2a2 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:32:18 +0000 Subject: [PATCH 10/15] chore: remove unnecessary `note_utils` import --- boxes/react/src/contracts/src/main.nr | 1 - boxes/vanilla-js/src/contracts/src/main.nr | 1 - .../contracts/app_subscription_contract/src/main.nr | 2 +- .../contracts/benchmarking_contract/src/main.nr | 2 +- .../noir-contracts/contracts/card_game_contract/src/main.nr | 2 +- .../noir-contracts/contracts/child_contract/src/main.nr | 2 +- .../noir-contracts/contracts/counter_contract/src/main.nr | 2 +- .../contracts/docs_example_contract/src/main.nr | 2 +- .../contracts/ecdsa_account_contract/src/main.nr | 2 +- .../contracts/inclusion_proofs_contract/src/main.nr | 2 +- .../contracts/pending_note_hashes_contract/src/main.nr | 2 +- .../contracts/schnorr_account_contract/src/main.nr | 2 +- .../noir-contracts/contracts/slow_tree_contract/src/main.nr | 5 +---- .../contracts/stateful_test_contract/src/main.nr | 3 +-- .../contracts/token_blacklist_contract/src/main.nr | 2 +- .../noir-contracts/contracts/token_contract/src/main.nr | 2 +- noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr | 3 +-- 17 files changed, 15 insertions(+), 22 deletions(-) diff --git a/boxes/react/src/contracts/src/main.nr b/boxes/react/src/contracts/src/main.nr index b2ead20bc22..342ad0aa62a 100644 --- a/boxes/react/src/contracts/src/main.nr +++ b/boxes/react/src/contracts/src/main.nr @@ -1,6 +1,5 @@ contract BoxReact { use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; - use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/boxes/vanilla-js/src/contracts/src/main.nr b/boxes/vanilla-js/src/contracts/src/main.nr index 4bb9d90b4f2..fb08ae0a550 100644 --- a/boxes/vanilla-js/src/contracts/src/main.nr +++ b/boxes/vanilla-js/src/contracts/src/main.nr @@ -1,6 +1,5 @@ contract Vanilla { use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; - use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr index 3a0cb8f1e74..1cc88f3dd3a 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr @@ -11,7 +11,7 @@ contract AppSubscription { SharedImmutable }; - use dep::aztec::{context::Context, note::utils as note_utils, oracle::get_public_key::get_public_key}; + use dep::aztec::{context::Context, oracle::get_public_key::get_public_key}; use dep::authwit::{account::AccountActions, auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit}; use crate::subscription_note::{SubscriptionNote, SUBSCRIPTION_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr index e66c1cc15a8..9b55d8005de 100644 --- a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr @@ -11,7 +11,7 @@ contract Benchmarking { }; use dep::value_note::{utils::{increment, decrement}, value_note::ValueNote}; - use dep::aztec::{context::{Context}, note::utils as note_utils}; + use dep::aztec::{context::{Context}}; struct Storage { notes: Map>, diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr index 930215d7802..937c5609ab1 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr @@ -8,7 +8,7 @@ contract CardGame { use dep::std::option::Option; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; - use dep::aztec::note::{note_header::NoteHeader, utils as note_utils}; + use dep::aztec::note::note_header::NoteHeader; use crate::cards::{PACK_CARDS, Deck, Card, get_pack_cards, compute_deck_strength}; use crate::game::{NUMBER_OF_PLAYERS, NUMBER_OF_CARDS_DECK, PLAYABLE_CARDS, PlayerEntry, Game, GAME_SERIALIZED_LEN}; diff --git a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr index d78d9da9b4a..1571bfa6353 100644 --- a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr @@ -4,7 +4,7 @@ contract Child { use dep::aztec::{ context::{PublicContext, Context}, protocol_types::{abis::{call_context::CallContext}}, - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils} + note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader} }; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index 806afb02ffa..54e3bec7244 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,7 +1,7 @@ contract Counter { // docs:start:imports use dep::aztec::prelude::{AztecAddress, Map}; - use dep::aztec::{context::Context, note::utils as note_utils}; + use dep::aztec::context::Context; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::easy_private_state::EasyPrivateUint; // docs:end:imports diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr index d5304c7a83f..6bf664d4950 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr @@ -18,7 +18,7 @@ contract DocsExample { PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, PrivateSet, SharedImmutable }; use dep::aztec::{ - note::{note_getter_options::Comparator, note_viewer_options::NoteViewerOptions, utils as note_utils}, + note::{note_getter_options::Comparator, note_viewer_options::NoteViewerOptions}, context::{PublicContext, Context} }; // how to import methods from other files/folders within your workspace diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr index d47b0a61328..94bdd54d3d8 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr @@ -8,7 +8,7 @@ contract EcdsaAccount { use dep::aztec::protocol_types::abis::call_context::CallContext; use dep::std; - use dep::aztec::{context::{PublicContext, Context}, note::utils as note_utils, oracle::get_public_key::get_public_key}; + use dep::aztec::{context::{PublicContext, Context}, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr index dccc0c425cf..cc272615374 100644 --- a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr @@ -6,7 +6,7 @@ contract InclusionProofs { }; use dep::aztec::protocol_types::{grumpkin_point::GrumpkinPoint, contract_class_id::ContractClassId}; - use dep::aztec::{context::Context, note::{note_getter_options::NoteStatus, utils as note_utils}}; + use dep::aztec::{context::Context, note::note_getter_options::NoteStatus}; // docs:start:imports use dep::aztec::history::{ contract_inclusion::{prove_contract_inclusion, prove_contract_inclusion_at}, diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index 2e1939399f6..ee745e2278c 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -6,7 +6,7 @@ contract PendingNoteHashes { // Libs use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet}; use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; - use dep::aztec::{context::{PublicContext, Context}, log::emit_encrypted_log, note::utils as note_utils}; + use dep::aztec::{context::{PublicContext, Context}, log::emit_encrypted_log}; struct Storage { balances: Map>, diff --git a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr index b2f44479b2c..7d122947eb5 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr @@ -7,7 +7,7 @@ contract SchnorrAccount { use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, PrivateContext, PrivateImmutable}; - use dep::aztec::{context::Context, note::utils as note_utils, oracle::get_public_key::get_public_key}; + use dep::aztec::{context::Context, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr index e61a09e31bb..7962e69f110 100644 --- a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr @@ -13,10 +13,7 @@ contract SlowTree { }; use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::ValueNote}; - use dep::aztec::{ - context::{PublicContext, Context}, note::utils as note_utils, - protocol_types::type_serialization::FIELD_SERIALIZED_LEN - }; + use dep::aztec::{context::{PublicContext, Context}, protocol_types::type_serialization::FIELD_SERIALIZED_LEN}; use dep::slow_updates_tree::{SlowMap, Leaf, SlowUpdateProof, compute_merkle_root, deserialize_slow_update_proof}; // docs:start:import_pop_capsule diff --git a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr index 3e23df816c8..334e66b2d2f 100644 --- a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr @@ -4,8 +4,7 @@ contract StatefulTest { use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote}}; use dep::aztec::{ deploy::{deploy_contract as aztec_deploy_contract}, - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, + context::{PrivateContext, PublicContext, Context}, note::{note_header::NoteHeader}, state_vars::{Map, PublicMutable, PrivateSet}, oracle::get_contract_instance::get_contract_instance, initializer::{mark_as_initialized, assert_is_initialized}, diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr index 34928ebc3d9..4d18060a5fe 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr @@ -18,7 +18,7 @@ contract TokenBlacklist { use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; use dep::aztec::{ - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, + note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, hash::{compute_secret_hash}, state_vars::{Map, PublicMutable, PrivateSet, SharedImmutable} }; diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index b1a37a66a77..eda0c227bab 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -16,7 +16,7 @@ contract Token { use dep::compressed_string::FieldCompressedString; use dep::aztec::{ - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, + note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, hash::{compute_secret_hash}, state_vars::{Map, PublicMutable, SharedImmutable, PrivateSet}, protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress} }; diff --git a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr index a03b8774700..5ba83eabc93 100644 --- a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr +++ b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr @@ -8,8 +8,7 @@ contract Benchmarking { use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; use dep::aztec::{ - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + context::{Context}, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, types::address::{AztecAddress} From d07ab87b0cda86a27d75ac62abd69f889024fdcc Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:37:10 +0000 Subject: [PATCH 11/15] chore: more prelude --- .../contracts/docs_example_contract/src/main.nr | 10 ++++------ .../contracts/pending_note_hashes_contract/src/main.nr | 7 +++++-- .../contracts/stateful_test_contract/src/main.nr | 9 +++------ .../contracts/token_contract/src/main.nr | 8 ++++---- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr index 6bf664d4950..7378f2b6139 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr @@ -14,13 +14,11 @@ mod types; contract DocsExample { // how to import dependencies defined in your workspace use dep::aztec::prelude::{ - AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, - PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, PrivateSet, SharedImmutable - }; - use dep::aztec::{ - note::{note_getter_options::Comparator, note_viewer_options::NoteViewerOptions}, - context::{PublicContext, Context} + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, NoteViewerOptions, + PrivateContext, Map, PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, + PrivateSet, SharedImmutable }; + use dep::aztec::{note::note_getter_options::Comparator, context::{PublicContext, Context}}; // how to import methods from other files/folders within your workspace use crate::options::create_account_card_getter_options; use crate::types::{card_note::{CardNote, CARD_NOTE_LEN}, leader::Leader}; diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index ee745e2278c..6983d1db955 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -4,9 +4,12 @@ // be read/nullified before their creation etc. contract PendingNoteHashes { // Libs - use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet}; + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet, + emit_encrypted_log + }; use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; - use dep::aztec::{context::{PublicContext, Context}, log::emit_encrypted_log}; + use dep::aztec::context::{PublicContext, Context}; struct Storage { balances: Map>, diff --git a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr index 334e66b2d2f..6e51a861eea 100644 --- a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr @@ -1,14 +1,11 @@ // A contract used for testing a random hodgepodge of small features from simulator and end-to-end tests. contract StatefulTest { - use dep::std::option::Option; + use dep::aztec::prelude::{PrivateContext, NoteHeader, Map, PublicMutable, PrivateSet, AztecAddress, FunctionSelector}; use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote}}; use dep::aztec::{ - deploy::{deploy_contract as aztec_deploy_contract}, - context::{PrivateContext, PublicContext, Context}, note::{note_header::NoteHeader}, - state_vars::{Map, PublicMutable, PrivateSet}, + deploy::{deploy_contract as aztec_deploy_contract}, context::{PublicContext, Context}, oracle::get_contract_instance::get_contract_instance, - initializer::{mark_as_initialized, assert_is_initialized}, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} + initializer::{mark_as_initialized, assert_is_initialized} }; struct Storage { diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index eda0c227bab..a895b7cfdc1 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -15,11 +15,11 @@ contract Token { use dep::compressed_string::FieldCompressedString; - use dep::aztec::{ - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, - hash::{compute_secret_hash}, state_vars::{Map, PublicMutable, SharedImmutable, PrivateSet}, - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress} + use dep::aztec::prelude::{ + NoteGetterOptions, NoteHeader, Map, PublicMutable, SharedImmutable, PrivateSet, + FunctionSelector, AztecAddress }; + use dep::aztec::hash::compute_secret_hash; // docs:start:import_authwit use dep::authwit::{auth::{assert_current_call_valid_authwit, assert_current_call_valid_authwit_public}}; From 40ce83533c94e1498c63d3fab34d5a98064bf6e1 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:47:00 +0000 Subject: [PATCH 12/15] chore: remove more `note_utils` --- .../contracts/delegated_on_contract/src/main.nr | 5 +---- .../noir-contracts/contracts/delegator_contract/src/main.nr | 1 - .../contracts/easy_private_token_contract/src/main.nr | 1 - .../noir-contracts/contracts/escrow_contract/src/main.nr | 2 +- .../noir-contracts/contracts/test_contract/src/main.nr | 4 ++-- noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr | 2 +- noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr | 3 +-- 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr index 5b1ee37626f..8b45ca01741 100644 --- a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr @@ -5,10 +5,7 @@ contract DelegatedOn { emit_unencrypted_log, PublicMutable, PrivateSet, PrivateContext }; - use dep::aztec::{ - context::{PublicContext, Context}, protocol_types::abis::call_context::CallContext, - note::utils as note_utils - }; + use dep::aztec::{context::{PublicContext, Context}, protocol_types::abis::call_context::CallContext}; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; struct Storage { diff --git a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr index 42a4f9577fc..a44fd4c39de 100644 --- a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr @@ -5,7 +5,6 @@ contract Delegator { PublicMutable, PrivateSet }; - use dep::aztec::note::utils as note_utils; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; struct Storage { diff --git a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr index d5cb59dc268..12261322cf0 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr @@ -1,7 +1,6 @@ // docs:start:easy_private_token_contract contract EasyPrivateToken { use dep::aztec::prelude::{AztecAddress, NoteHeader, Map}; - use dep::aztec::note::utils as note_utils; use dep::value_note::{balance_utils, value_note::ValueNote}; use dep::easy_private_state::EasyPrivateUint; diff --git a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr index 6af98e2cacd..e8c8f968adf 100644 --- a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr @@ -2,7 +2,7 @@ contract Escrow { use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateSet}; - use dep::aztec::{context::{PublicContext, Context}, note::{utils as note_utils}, oracle::get_public_key::get_public_key}; + use dep::aztec::{context::{PublicContext, Context}, oracle::get_public_key::get_public_key}; use dep::address_note::address_note::{AddressNote, ADDRESS_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index afc279bf739..34943b7cedc 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -17,8 +17,8 @@ contract Test { context::{Context, inputs::private_context_inputs::PrivateContextInputs}, hash::{pedersen_hash, compute_secret_hash}, note::{ - utils as note_utils, lifecycle::{create_note, destroy_note}, - note_getter::{get_notes, view_notes}, note_getter_options::NoteStatus + lifecycle::{create_note, destroy_note}, note_getter::{get_notes, view_notes}, + note_getter_options::NoteStatus }, deploy::{deploy_contract as aztec_deploy_contract}, oracle::{get_public_key::get_public_key as get_public_key_oracle, context::get_portal_address, rand::rand}, diff --git a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr index 5ba83eabc93..c5b19a686d2 100644 --- a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr +++ b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr @@ -8,7 +8,7 @@ contract Benchmarking { use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; use dep::aztec::{ - context::{Context}, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, types::address::{AztecAddress} diff --git a/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr b/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr index a03b8774700..c5b19a686d2 100644 --- a/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr +++ b/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr @@ -8,8 +8,7 @@ contract Benchmarking { use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; use dep::aztec::{ - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, types::address::{AztecAddress} From 695c546a45e3d5e08f4c7a2412c091d94eeb5320 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:54:35 +0000 Subject: [PATCH 13/15] chore: fix build --- .../noir-contracts/contracts/delegator_contract/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr index a44fd4c39de..fde7188bc23 100644 --- a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr @@ -64,6 +64,6 @@ contract Delegator { serialized_note: [Field; VALUE_NOTE_LEN] ) -> pub [Field; 4] { let note_header = NoteHeader::new(contract_address, nonce, storage_slot); - note_utils::compute_note_hash_and_nullifier(ValueNote::deserialize_content, note_header, serialized_note) + dep::aztec::note::utils::compute_note_hash_and_nullifier(ValueNote::deserialize_content, note_header, serialized_note) } } From e62e6a20453202cb094ae3be4d8e551781509ee8 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 4 Mar 2024 23:58:10 +0000 Subject: [PATCH 14/15] chore: final preluding --- .../contracts/token_contract/src/types/balances_map.nr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr index d48e925df34..0736abbab62 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr @@ -1,11 +1,11 @@ use dep::aztec::prelude::{ - AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, PrivateSet, Map, - emit_encrypted_log + AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, NoteInterface, PrivateContext, + PrivateSet, Map, emit_encrypted_log }; use dep::aztec::{ context::{PublicContext, Context}, hash::pedersen_hash, protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, - note::{note_getter::view_notes, note_getter_options::SortOrder, note_interface::NoteInterface} + note::{note_getter::view_notes, note_getter_options::SortOrder} }; use crate::types::token_note::{TokenNote, OwnedNote}; From 51897675d51d5fbf8616f5c405c1995714da9308 Mon Sep 17 00:00:00 2001 From: Tom French Date: Tue, 5 Mar 2024 00:02:46 +0000 Subject: [PATCH 15/15] chore: remove remaining imports of `Option` --- .../aztec-nr/aztec/src/context/private_context.nr | 1 - noir-projects/aztec-nr/aztec/src/note/note_getter.nr | 7 +------ .../aztec-nr/aztec/src/note/note_getter_options.nr | 1 - .../aztec-nr/aztec/src/note/note_viewer_options.nr | 1 - noir-projects/aztec-nr/aztec/src/oracle/notes.nr | 1 - noir-projects/aztec-nr/aztec/src/state_vars/map.nr | 1 - .../aztec-nr/aztec/src/state_vars/private_immutable.nr | 1 - .../aztec-nr/aztec/src/state_vars/private_mutable.nr | 2 -- noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr | 1 - .../aztec-nr/aztec/src/state_vars/public_mutable.nr | 1 - noir-projects/aztec-nr/value-note/src/filter.nr | 1 - .../contracts/app_subscription_contract/src/main.nr | 1 - .../contracts/card_game_contract/src/main.nr | 1 - .../contract_instance_deployer_contract/src/main.nr | 1 - .../contracts/token_blacklist_contract/src/main.nr | 1 - .../noir-contracts/contracts/token_contract/src/main.nr | 1 - .../crates/rollup-lib/src/base/base_rollup_inputs.nr | 1 - 17 files changed, 1 insertion(+), 23 deletions(-) diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 7a60c69bdbf..61746bdd239 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -30,7 +30,6 @@ use dep::protocol_types::{ grumpkin_private_key::GrumpkinPrivateKey, hash::hash_args, header::Header, messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::is_empty }; -use dep::std::option::Option; // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165) // use dep::std::collections::vec::Vec; diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter.nr index a42e9f89318..25398adad28 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{ constants::{ MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, GET_NOTE_ORACLE_RETURN_LENGTH, GET_NOTES_ORACLE_RETURN_LENGTH, @@ -13,11 +12,7 @@ use crate::note::{ }; use crate::oracle; -fn check_note_header( - context: PrivateContext, - storage_slot: Field, - note: Note -) where Note: NoteInterface { +fn check_note_header(context: PrivateContext, storage_slot: Field, note: Note) where Note: NoteInterface { let header = note.get_header(); let contract_address = context.this_address(); assert(header.contract_address.eq(contract_address)); diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr index 24c9a223ab4..b24104a2662 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}; use crate::note::note_interface::NoteInterface; diff --git a/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr b/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr index e7fe43a66bf..97496eb7c42 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use crate::note::note_getter_options::{Select, Sort, Comparator, NoteStatus}; use dep::protocol_types::{constants::MAX_NOTES_PER_PAGE}; use crate::note::note_interface::NoteInterface; diff --git a/noir-projects/aztec-nr/aztec/src/oracle/notes.nr b/noir-projects/aztec-nr/aztec/src/oracle/notes.nr index 02194699c8f..cfad47101d2 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/notes.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/notes.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use crate::note::{note_header::NoteHeader, note_interface::NoteInterface}; use dep::protocol_types::{address::AztecAddress, utils::arr_copy_slice}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/map.nr b/noir-projects/aztec-nr/aztec/src/state_vars/map.nr index 043c8a3f615..0deee4556df 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/map.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/map.nr @@ -1,5 +1,4 @@ use crate::context::{PrivateContext, PublicContext, Context}; -use dep::std::option::Option; use dep::protocol_types::{hash::pedersen_hash, traits::{ToField}}; use crate::state_vars::storage::Storage; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr index 0803486551c..29772b2d600 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{address::AztecAddress, constants::{GENERATOR_INDEX__INITIALIZATION_NULLIFIER}, hash::pedersen_hash}; use crate::context::{PrivateContext, Context}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr index 14dd9609c05..6e06c66d97b 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr @@ -1,5 +1,3 @@ -use dep::std::option::Option; - use dep::protocol_types::{address::AztecAddress, constants::{GENERATOR_INDEX__INITIALIZATION_NULLIFIER}, hash::pedersen_hash}; use crate::context::{PrivateContext, PublicContext, Context}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr index ec0b254bb4b..b72b405d197 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{ constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, abis::side_effect::{SideEffect, SideEffectLinkedToNoteHash} diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr index 5c474846357..0b24bb08723 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr @@ -1,7 +1,6 @@ use crate::context::{Context}; use crate::oracle::storage::storage_read; use crate::oracle::storage::storage_write; -use dep::std::option::Option; use dep::protocol_types::traits::{Deserialize, Serialize}; use crate::state_vars::storage::Storage; diff --git a/noir-projects/aztec-nr/value-note/src/filter.nr b/noir-projects/aztec-nr/value-note/src/filter.nr index 2621ffb49f9..af5b3ee03e0 100644 --- a/noir-projects/aztec-nr/value-note/src/filter.nr +++ b/noir-projects/aztec-nr/value-note/src/filter.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::aztec::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL; use crate::value_note::ValueNote; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr index 1cc88f3dd3a..8d53aaf5506 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr @@ -3,7 +3,6 @@ mod dapp_payload; contract AppSubscription { use dep::std; - use dep::std::option::Option; use crate::dapp_payload::DAppPayload; use dep::aztec::prelude::{ diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr index 937c5609ab1..e63eea84e8e 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr @@ -5,7 +5,6 @@ contract CardGame { use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::MAX_NOTES_PER_PAGE}; use dep::aztec::{context::Context, hash::pedersen_hash, state_vars::{Map, PublicMutable}}; - use dep::std::option::Option; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::aztec::note::note_header::NoteHeader; diff --git a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr index aceccc3ab11..ba62e9b22e7 100644 --- a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr @@ -1,7 +1,6 @@ mod events; contract ContractInstanceDeployer { - use dep::std::option::Option; use dep::aztec::protocol_types::{ address::{AztecAddress, EthAddress, PublicKeysHash, PartialAddress}, contract_class_id::ContractClassId, diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr index 4d18060a5fe..7bf5cd8bca4 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr @@ -14,7 +14,6 @@ mod interfaces; contract TokenBlacklist { // Libs - use dep::std::option::Option; use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; use dep::aztec::{ diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index a895b7cfdc1..79f9d70bd71 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -11,7 +11,6 @@ mod types; contract Token { // Libs - use dep::std::option::Option; use dep::compressed_string::FieldCompressedString; diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr index d239cc82b2d..01570f0aa9f 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr @@ -583,7 +583,6 @@ mod tests { }, utils::{field::full_field_less_than, uint256::U256} }; - use dep::std::option::Option; struct NullifierInsertion { existing_index: u64,