From 17cb55bbed3a11c487d8752e7462ef6a0d22625e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Tue, 24 Sep 2024 23:26:49 +0000 Subject: [PATCH 1/3] Remove unused imports --- noir-projects/aztec-nr/authwit/src/auth.nr | 2 +- noir-projects/aztec-nr/authwit/src/entrypoint/app.nr | 2 +- .../aztec-nr/aztec/src/encrypted_logs/incoming_body.nr | 2 +- noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr | 2 +- noir-projects/aztec-nr/aztec/src/state_vars/map.nr | 1 - noir-projects/aztec-nr/aztec/src/state_vars/storage.nr | 1 - .../aztec-nr/aztec/src/test/helpers/test_environment.nr | 1 - .../noir-contracts/contracts/card_game_contract/src/main.nr | 2 -- .../src/events/private_function_broadcasted.nr | 1 - .../src/events/unconstrained_function_broadcasted.nr | 1 - 10 files changed, 4 insertions(+), 11 deletions(-) diff --git a/noir-projects/aztec-nr/authwit/src/auth.nr b/noir-projects/aztec-nr/authwit/src/auth.nr index 6dca5f75fd8a..3af1d1ac85ca 100644 --- a/noir-projects/aztec-nr/authwit/src/auth.nr +++ b/noir-projects/aztec-nr/authwit/src/auth.nr @@ -6,7 +6,7 @@ use dep::aztec::protocol_types::{ }, hash::poseidon2_hash_with_separator }; -use dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array}; +use dep::aztec::{context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array}; /** * Authenticaion witness helper library diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr index b74d6637f9b0..552b9a81a303 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr @@ -4,7 +4,7 @@ use dep::aztec::protocol_types::{ traits::{Hash, Serialize} }; -use crate::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES}; +use crate::entrypoint::function_call::FunctionCall; // FUNCTION_CALL_SIZE * ACCOUNT_MAX_CALLS + 1 global APP_PAYLOAD_SIZE: u32 = 21; diff --git a/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr b/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr index 99f84f33bf8c..093434164414 100644 --- a/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr +++ b/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr @@ -40,7 +40,7 @@ mod test { }; use crate::{ - note::{note_header::NoteHeader, note_interface::{NoteInterface, PartialNote, NullifiableNote}}, + note::{note_header::NoteHeader, note_interface::{NoteInterface, NullifiableNote}}, encrypted_logs::incoming_body::EncryptedLogIncomingBody, event::event_interface::EventInterface, context::PrivateContext, keys::public_keys::IvpkM }; diff --git a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr index e00eecfcdfd6..ea3040586b25 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr @@ -3,7 +3,7 @@ use std::{ hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher} }; use protocol_types::meta::{flatten_to_fields, pack_from_fields}; -use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector, note_interface::NoteInterface}; +use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector}; comptime global NOTE_HEADER_TYPE = type_of(NoteHeader::empty()); 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 5ca79f852b9d..f1d5604952d5 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/map.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/map.nr @@ -33,4 +33,3 @@ impl Map { } // docs:end:at } - diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/storage.nr b/noir-projects/aztec-nr/aztec/src/state_vars/storage.nr index abcf627f798c..2eec5d9c1b85 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/storage.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/storage.nr @@ -12,4 +12,3 @@ pub trait Storage where T: Serialize + Deserialize { pub struct Storable { slot: Field, } - diff --git a/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr b/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr index 302cd1215f35..2b58aeac9d48 100644 --- a/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr +++ b/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr @@ -8,7 +8,6 @@ use crate::context::{packed_returns::PackedReturns, call_interfaces::CallInterfa use crate::context::{PrivateContext, PublicContext, UnconstrainedContext}; use crate::test::helpers::{cheatcodes, utils::{apply_side_effects_private, Deployer}}; -use crate::keys::constants::{NULLIFIER_INDEX, INCOMING_INDEX, OUTGOING_INDEX, TAGGING_INDEX}; use crate::hash::hash_args; use crate::note::{note_header::NoteHeader, note_interface::{NoteInterface, NullifiableNote}}; 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 62367267c5df..095f870193b5 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 @@ -14,8 +14,6 @@ contract CardGame { use crate::game::{PLAYABLE_CARDS, PlayerEntry, Game}; use dep::aztec::macros::{storage::storage, functions::{private, public, internal}}; - use value_note::value_note::ValueNote; - #[storage] struct Storage { collections: Map, Context>, 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 11735b333160..2f39e82bf736 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,5 +1,4 @@ use dep::aztec::prelude::FunctionSelector; -use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ contract_class_id::ContractClassId, constants::{ 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 28a6e791e850..5942facbfcc0 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,5 +1,4 @@ use dep::aztec::prelude::FunctionSelector; -use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ contract_class_id::ContractClassId, constants::{ From f3983a463bccd6c7f67f60d15c2d3bc27f828252 Mon Sep 17 00:00:00 2001 From: thunkar Date: Wed, 25 Sep 2024 07:49:41 +0000 Subject: [PATCH 2/3] fixed note_custom_interface import --- noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr index 3c723bf86699..fd8777873a1a 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr @@ -374,7 +374,7 @@ pub comptime fn note(s: StructDefinition) -> Quoted { pub comptime fn note_custom_interface(s: StructDefinition) -> Quoted { let (common, note_type_id) = common_note_annotation(s); let serialized_len_type = fresh_type_variable(); - let note_interface_impl = s.as_type().get_trait_impl(quote { NoteInterface<$serialized_len_type> }.as_trait_constraint()); + let note_interface_impl = s.as_type().get_trait_impl(quote { crate::note::note_interface::NoteInterface<$serialized_len_type> }.as_trait_constraint()); let name = s.name(); let note_serialized_len = note_interface_impl.expect(f"Note {name} must implement NoteInterface trait").trait_generic_args()[0].as_constant().unwrap(); From 6835b081d69d2ec11bbb2d4501b5e36cac68570f Mon Sep 17 00:00:00 2001 From: thunkar Date: Wed, 25 Sep 2024 07:55:18 +0000 Subject: [PATCH 3/3] nargo fmt --- noir-projects/aztec-nr/authwit/src/auth.nr | 24 +++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/noir-projects/aztec-nr/authwit/src/auth.nr b/noir-projects/aztec-nr/authwit/src/auth.nr index 3af1d1ac85ca..072127270829 100644 --- a/noir-projects/aztec-nr/authwit/src/auth.nr +++ b/noir-projects/aztec-nr/authwit/src/auth.nr @@ -215,11 +215,7 @@ pub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf * @param on_behalf_of The address that have authorized the current call * @param inner_hash The hash of the message to authorize */ -pub fn assert_inner_hash_valid_authwit( - context: &mut PrivateContext, - on_behalf_of: AztecAddress, - inner_hash: Field -) { +pub fn assert_inner_hash_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress, inner_hash: Field) { // We perform a static call here and not a standard one to ensure that the account contract cannot re-enter. let result: Field = context.static_call_private_function( on_behalf_of, @@ -247,7 +243,10 @@ pub fn assert_inner_hash_valid_authwit( * @param on_behalf_of The address that have authorized the current call */ // docs:start:assert_current_call_valid_authwit_public -pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) { +pub fn assert_current_call_valid_authwit_public( + context: &mut PublicContext, + on_behalf_of: AztecAddress +) { let inner_hash = compute_inner_authwit_hash( [(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()] ); @@ -266,11 +265,7 @@ pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_ * * @param on_behalf_of The address that have authorized the `inner_hash` */ -pub fn assert_inner_hash_valid_authwit_public( - context: &mut PublicContext, - on_behalf_of: AztecAddress, - inner_hash: Field -) { +pub fn assert_inner_hash_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress, inner_hash: Field) { let result: Field = context.call_public_function( CANONICAL_AUTH_REGISTRY_ADDRESS, comptime { @@ -346,12 +341,7 @@ pub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) * @param version The version of the chain that the message is being consumed on * @param inner_hash The hash of the "inner" message that is being consumed */ -pub fn compute_authwit_message_hash( - consumer: AztecAddress, - chain_id: Field, - version: Field, - inner_hash: Field -) -> Field { +pub fn compute_authwit_message_hash(consumer: AztecAddress, chain_id: Field, version: Field, inner_hash: Field) -> Field { poseidon2_hash_with_separator( [ consumer.to_field(),