Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b82032888819eac82b2bfce8300c2c8b66507c64
07ab5150857ec6719b132ec91d5f90af0564a046
3 changes: 2 additions & 1 deletion noir-projects/aztec-nr/authwit/src/account.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use dep::aztec::{
context::PrivateContext,
hash::poseidon2_hash_with_separator,
protocol_types::constants::{GENERATOR_INDEX__COMBINED_PAYLOAD, GENERATOR_INDEX__TX_NULLIFIER},
hash::poseidon2_hash_with_separator,
};

use crate::auth::{compute_authwit_message_hash, IS_VALID_SELECTOR};
use crate::entrypoint::{app::AppPayload, fee::FeePayload};
use crate::auth::{IS_VALID_SELECTOR, compute_authwit_message_hash};

pub struct AccountActions<Context> {
context: Context,
Expand Down
5 changes: 3 additions & 2 deletions noir-projects/aztec-nr/authwit/src/auth.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use dep::aztec::{context::{gas::GasOpts, PrivateContext, PublicContext}, hash::hash_args_array};
use dep::aztec::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress,
abis::function_selector::FunctionSelector,
address::AztecAddress,
constants::{
GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER,
GENERATOR_INDEX__AUTHWIT_NULLIFIER, CANONICAL_AUTH_REGISTRY_ADDRESS,
}, hash::poseidon2_hash_with_separator,
};
use dep::aztec::{context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};

/**
* Authenticaion witness helper library
Expand Down
5 changes: 4 additions & 1 deletion noir-projects/aztec-nr/authwit/src/cheatcodes.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use dep::aztec::{
context::{call_interfaces::CallInterface, public_context::PublicContext},
hash::hash_args,
oracle::execution::{get_block_number, get_contract_address},
protocol_types::address::AztecAddress,
context::{public_context::PublicContext, call_interfaces::CallInterface},
test::helpers::cheatcodes, oracle::execution::{get_block_number, get_contract_address},
hash::hash_args,
};

use crate::auth::{compute_inner_authwit_hash, compute_authwit_message_hash, set_authorized};
use crate::auth::{compute_authwit_message_hash, compute_inner_authwit_hash, set_authorized};

pub fn add_private_authwit_from_call_interface<C, let M: u32>(
on_behalf_of: AztecAddress,
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::entrypoint::function_call::FunctionCall;
use dep::aztec::prelude::PrivateContext;
use dep::aztec::protocol_types::{
constants::GENERATOR_INDEX__FEE_PAYLOAD, hash::poseidon2_hash_with_separator,
traits::{Hash, Serialize},
};
use crate::entrypoint::function_call::FunctionCall;

// 2 * 5 (FUNCTION_CALL_SIZE) + 2
global FEE_PAYLOAD_SIZE: u32 = 12;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::context::{
inputs::PrivateContextInputs,
};

use crate::oracle::arguments::pack_arguments;
use crate::hash::hash_args;
use crate::oracle::arguments::pack_arguments;

pub trait CallInterface<let N: u32> {
fn get_args(self) -> [Field] {
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/context/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub use call_interfaces::{
PublicStaticCallInterface, PrivateVoidCallInterface, PrivateStaticVoidCallInterface,
PublicVoidCallInterface, PublicStaticVoidCallInterface,
};
pub use private_context::PrivateContext;
pub use packed_returns::PackedReturns;
pub use public_context::PublicContext;
pub use private_context::PrivateContext;
pub use public_context::FunctionReturns;
pub use public_context::PublicContext;
pub use unconstrained_context::UnconstrainedContext;
5 changes: 3 additions & 2 deletions noir-projects/aztec-nr/aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{
context::{inputs::PrivateContextInputs, packed_returns::PackedReturns},
messaging::process_l1_to_l2_message, hash::{hash_args_array, ArgsHasher},
keys::constants::{NULLIFIER_INDEX, OUTGOING_INDEX, NUM_KEY_TYPES, sk_generators},
hash::{ArgsHasher, hash_args_array},
keys::constants::{NULLIFIER_INDEX, NUM_KEY_TYPES, OUTGOING_INDEX, sk_generators},
messaging::process_l1_to_l2_message,
oracle::{
key_validation_request::get_key_validation_request, arguments, returns::pack_returns,
call_private_function::call_private_function_internal, header::get_header_at,
Expand Down
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/aztec/src/context/public_context.nr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::hash::{compute_secret_hash, compute_message_hash, compute_message_nullifier};
use crate::context::gas::GasOpts;
use crate::hash::{compute_message_hash, compute_message_nullifier, compute_secret_hash};
use dep::protocol_types::abis::function_selector::FunctionSelector;
use dep::protocol_types::address::{AztecAddress, EthAddress};
use dep::protocol_types::constants::{MAX_FIELD_VALUE, PUBLIC_DISPATCH_SELECTOR};
use dep::protocol_types::traits::{Serialize, Deserialize, Empty};
use dep::protocol_types::abis::function_selector::FunctionSelector;
use crate::context::gas::GasOpts;
use dep::protocol_types::traits::{Deserialize, Empty, Serialize};

pub struct PublicContext {
args_hash: Option<Field>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
use crate::oracle::{
execution::{get_block_number, get_chain_id, get_contract_address, get_version},
storage::storage_read,
};
use dep::protocol_types::{address::AztecAddress, traits::Deserialize};
use crate::oracle::{
execution::{get_chain_id, get_version, get_contract_address, get_block_number},
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/generators.nr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ global G_slot = Point {
};

mod test {
use crate::generators::{Ga1, Ga2, Ga3, Ga4, Ga5, G_slot};
use crate::generators::{G_slot, Ga1, Ga2, Ga3, Ga4, Ga5};
use dep::protocol_types::point::Point;
use std::hash::derive_generators;

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/hash.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::utils::to_bytes::{arr_to_be_bytes_arr, str_to_be_bytes_arr};
use dep::protocol_types::{
address::{AztecAddress, EthAddress},
constants::{
Expand All @@ -6,7 +7,6 @@ use dep::protocol_types::{
}, point::Point, traits::Hash,
hash::{sha256_to_field, poseidon2_hash_with_separator, poseidon2_hash_with_separator_slice},
};
use crate::utils::to_bytes::{arr_to_be_bytes_arr, str_to_be_bytes_arr};

pub use dep::protocol_types::hash::{compute_siloed_nullifier, pedersen_hash};

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/history/note_inclusion.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;
use dep::protocol_types::header::Header;
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;

use crate::{
note::{utils::compute_note_hash_for_nullify, note_interface::{NoteInterface, NullifiableNote}},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;
use dep::protocol_types::header::Header;
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;

use crate::{
context::PrivateContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ use crate::{
note::{utils::compute_siloed_nullifier, note_interface::{NoteInterface, NullifiableNote}},
oracle::get_nullifier_membership_witness::get_low_nullifier_membership_witness,
};
use dep::protocol_types::{
header::Header,
utils::field::{full_field_greater_than, full_field_less_than},
};
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;

trait ProveNullifierNonInclusion {
fn prove_nullifier_non_inclusion(header: Header, nullifier: Field);
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/keys/getters/mod.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use dep::protocol_types::{address::AztecAddress, public_keys::PublicKeys};
use crate::{
oracle::{
keys::get_public_keys_and_partial_address,
key_validation_request::get_key_validation_request,
}, keys::constants::{NULLIFIER_INDEX, OUTGOING_INDEX},
};
use dep::protocol_types::{address::AztecAddress, public_keys::PublicKeys};

mod test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use dep::protocol_types::{
constants::GENERATOR_INDEX__SYMMETRIC_KEY, scalar::Scalar, point::Point, utils::arr_copy_slice,
};
use crate::utils::point::point_to_bytes;
use std::{hash::sha256, embedded_curve_ops::multi_scalar_mul};
use dep::protocol_types::{
constants::GENERATOR_INDEX__SYMMETRIC_KEY, point::Point, scalar::Scalar, utils::arr_copy_slice,
};
use std::{embedded_curve_ops::multi_scalar_mul, hash::sha256};

// TODO(#5726): This function is called deriveAESSecret in TS. I don't like point_to_symmetric_key name much since
// point is not the only input of the function. Unify naming with TS once we have a better name.
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/events/mod.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use protocol_types::meta::flatten_to_fields;
use super::utils::compute_event_selector;
use protocol_types::meta::flatten_to_fields;

comptime fn generate_event_interface(s: StructDefinition) -> Quoted {
let name = s.name();
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/functions/mod.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod interfaces;

use std::meta::type_of;
use super::utils::{
modify_fn_body, is_fn_private, get_fn_visibility, is_fn_view, is_fn_initializer, is_fn_internal,
fn_has_noinitcheck, add_to_hasher, module_has_storage, module_has_initializer,
};
use protocol_types::meta::flatten_to_fields;
use std::meta::type_of;

use interfaces::{create_fn_abi_export, register_stub, stub_fn};

Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/macros/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ mod storage;
mod events;

use functions::interfaces::STUBS;
use notes::{generate_note_export, NOTES};
use storage::STORAGE_LAYOUT_NAME;
use notes::{NOTES, generate_note_export};

use dispatch::generate_public_dispatch;
use functions::transform_unconstrained;
use utils::module_has_storage;
use dispatch::generate_public_dispatch;

/// Marks a contract as an Aztec contract, generating the interfaces for its functions and notes, as well as injecting
/// the `compute_note_hash_and_optionally_a_nullifier` function PXE requires in order to validate notes.
Expand Down
6 changes: 5 additions & 1 deletion noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ 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};
use std::{
collections::umap::UHashMap,
hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher},
meta::{typ::fresh_type_variable, type_of, unquote},
};

comptime global NOTE_HEADER_TYPE = type_of(NoteHeader::empty());

Expand Down
3 changes: 3 additions & 0 deletions noir-projects/aztec-nr/aztec/src/note/note_getter/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use crate::note::{
};
use crate::oracle;
use crate::utils::comparison::compare;
use dep::protocol_types::constants::{
GET_NOTES_ORACLE_RETURN_LENGTH, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
};

pub use crate::note::constants::MAX_NOTES_PER_PAGE;

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/note/note_getter/test.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use dep::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL;
use crate::{
note::{
note_getter_options::{NoteGetterOptions, SortOrder, PropertySelector},
note_getter::constrain_get_notes_internal,
}, oracle::execution::get_contract_address,
};
use dep::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL;

use crate::test::{helpers::test_environment::TestEnvironment, mocks::mock_note::MockNote};
use crate::utils::comparison::Comparator;
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::option::Option;
use dep::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, traits::ToField};
use crate::note::note_interface::NoteInterface;
use dep::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, traits::ToField};
use std::option::Option;

pub struct PropertySelector {
index: u8, // index of the field in the serialized note array
Expand Down
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::option::Option;
use crate::note::note_getter_options::{PropertySelector, Select, Sort, NoteStatus};
use dep::protocol_types::traits::ToField;
use crate::note::note_interface::NoteInterface;
use crate::note::constants::MAX_NOTES_PER_PAGE;
use crate::note::note_getter_options::{NoteStatus, PropertySelector, Select, Sort};
use crate::note::note_interface::NoteInterface;
use dep::protocol_types::traits::ToField;
use std::option::Option;

// docs:start:NoteViewerOptions
pub struct NoteViewerOptions<Note, let N: u32> {
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/oracle/header.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;
use dep::protocol_types::{constants::HEADER_LENGTH, header::Header};
use dep::protocol_types::merkle_tree::root::root_from_sibling_path;

use crate::{
context::PrivateContext, oracle::get_membership_witness::get_archive_membership_witness,
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/oracle/storage.nr
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ mod tests {
use crate::oracle::storage::{raw_storage_read, storage_read};
use dep::protocol_types::address::AztecAddress;

use std::test::OracleMock;
use crate::test::mocks::mock_struct::MockStruct;
use std::test::OracleMock;

global address = AztecAddress::from_field(29);
global slot = 7;
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/state_vars/map.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};
use crate::state_vars::storage::Storage;
use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};

// docs:start:map
pub struct Map<K, V, Context> {
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/state_vars/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ mod storage;
pub use crate::state_vars::map::Map;
pub use crate::state_vars::private_immutable::PrivateImmutable;
pub use crate::state_vars::private_mutable::PrivateMutable;
pub use crate::state_vars::private_set::PrivateSet;
pub use crate::state_vars::public_immutable::PublicImmutable;
pub use crate::state_vars::public_mutable::PublicMutable;
pub use crate::state_vars::private_set::PrivateSet;
pub use crate::state_vars::shared_immutable::SharedImmutable;
pub use crate::state_vars::shared_mutable::SharedMutable;
pub use crate::state_vars::storage::Storage;
3 changes: 3 additions & 0 deletions noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use crate::note::{
utils::compute_note_hash_for_read_request, note_emission::NoteEmission,
};
use crate::state_vars::storage::Storage;
use dep::protocol_types::{
abis::read_request::ReadRequest, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
};

// docs:start:struct
pub struct PrivateSet<Note, Context> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::context::{PublicContext, UnconstrainedContext};
use dep::protocol_types::traits::{Deserialize, Serialize};
use crate::state_vars::storage::Storage;
use dep::protocol_types::traits::{Deserialize, Serialize};

// docs:start:public_mutable_struct
pub struct PublicMutable<T, Context> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::protocol_types::traits::{Serialize, Deserialize};
use dep::protocol_types::traits::{Deserialize, Serialize};
use std::cmp::min;

mod test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::protocol_types::traits::{Serialize, Deserialize, FromField, ToField};
use dep::protocol_types::traits::{Deserialize, FromField, Serialize, ToField};
use std::cmp::min;

mod test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ use crate::state_vars::{
},
};
use crate::oracle::storage::storage_read;
use crate::state_vars::{
shared_mutable::{
scheduled_delay_change::ScheduledDelayChange, scheduled_value_change::ScheduledValueChange,
},
storage::Storage,
};
use dep::std::mem::zeroed;

mod test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::{
context::{PublicContext, PrivateContext, UnconstrainedContext},
context::{PrivateContext, PublicContext, UnconstrainedContext},
state_vars::shared_mutable::{
shared_mutable::SharedMutable, scheduled_value_change::ScheduledValueChange,
scheduled_delay_change::ScheduledDelayChange,
}, test::helpers::test_environment::TestEnvironment,
};

use dep::std::{test::OracleMock, mem::zeroed};
use dep::std::{mem::zeroed, test::OracleMock};

global new_value = 17;

Expand Down
5 changes: 5 additions & 0 deletions noir-projects/aztec-nr/aztec/src/test/helpers/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ use dep::protocol_types::{
};
use crate::context::inputs::PrivateContextInputs;
use crate::test::helpers::utils::TestAccount;
use dep::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress,
constants::CONTRACT_INSTANCE_LENGTH, contract_instance::ContractInstance,
public_keys::PublicKeys,
};

pub unconstrained fn reset() {
oracle_reset();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use dep::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress};

use crate::context::{call_interfaces::CallInterface, packed_returns::PackedReturns};
use crate::context::inputs::PrivateContextInputs;
use crate::context::{packed_returns::PackedReturns, call_interfaces::CallInterface};

use crate::context::{PrivateContext, PublicContext, UnconstrainedContext};
use crate::test::helpers::{cheatcodes, utils::Deployer};
use crate::hash::hash_args;
use crate::test::helpers::{cheatcodes, utils::{apply_side_effects_private, Deployer}};

use crate::note::{note_header::NoteHeader, note_interface::{NoteInterface, NullifiableNote}};
use crate::oracle::{
Expand Down
Loading