Skip to content
Merged
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
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl NoteInterface<MOCK_NOTE_LENGTH, MOCK_NOTE_BYTES_LENGTH> for MockNote {
4135
}

fn compute_nullifier(self, context: &mut PrivateContext, note_hash_for_nullify: Field) -> Field {
fn compute_nullifier(_self: Self, _context: &mut PrivateContext, note_hash_for_nullify: Field) -> Field {
// We don't use any kind of secret here since this is only a mock note and having it here would make tests
// more cumbersome
poseidon2_hash_with_separator([note_hash_for_nullify], GENERATOR_INDEX__NOTE_NULLIFIER as Field)
Expand Down Expand Up @@ -85,7 +85,7 @@ impl NoteInterface<MOCK_NOTE_LENGTH, MOCK_NOTE_BYTES_LENGTH> for MockNote {

impl Eq for MockNote {
fn eq(self, other: Self) -> bool {
(self.header == other.header) &
(self.header == other.header) &
(self.value == other.value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dep::aztec::protocol_types::{
traits::{Hash, Serialize}
};

use dep::authwit::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES};
use dep::authwit::entrypoint::function_call::FunctionCall;

global DAPP_MAX_CALLS: u64 = 1;
// FUNCTION_CALL_SIZE * DAPP_MAX_CALLS + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ contract AvmTest {
// Libs
use std::embedded_curve_ops::{multi_scalar_mul, EmbeddedCurvePoint};
use dep::aztec::protocol_types::constants::CONTRACT_INSTANCE_LENGTH;
use dep::aztec::prelude::{Map, Deserialize};
use dep::aztec::prelude::Map;
use dep::aztec::state_vars::PublicMutable;
use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, constants::L1_TO_L2_MESSAGE_LENGTH, point::Point, scalar::Scalar};
use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, point::Point, scalar::Scalar};
use dep::aztec::oracle::get_contract_instance::{get_contract_instance_avm, get_contract_instance_internal_avm};
use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, storage::map::derive_storage_slot_in_map};
use dep::aztec::context::gas::GasOpts;
Expand Down Expand Up @@ -160,7 +160,7 @@ contract AvmTest {
}

/************************************************************************
* Misc
* Misc
************************************************************************/

#[aztec(public)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext, NoteHeader, NoteGetterOptions, NoteViewerOptions};
use dep::aztec::prelude::{AztecAddress, PrivateContext, NoteGetterOptions, NoteViewerOptions};

use dep::aztec::{
context::UnconstrainedContext,
protocol_types::{traits::{ToField, Serialize, FromField}, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
keys::getters::get_current_public_keys, note::note_getter::view_notes, state_vars::PrivateSet,
note::constants::MAX_NOTES_PER_PAGE
keys::getters::get_current_public_keys, state_vars::PrivateSet, note::constants::MAX_NOTES_PER_PAGE
};
use dep::value_note::{value_note::{ValueNote, VALUE_NOTE_LEN}};
use dep::value_note::value_note::ValueNote;

struct Card {
// We use u32s since u16s are unsupported
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
contract ContractInstanceDeployer {
use dep::aztec::protocol_types::{
address::{AztecAddress, EthAddress, PublicKeysHash, PartialAddress},
contract_class_id::ContractClassId, constants::DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE,
traits::Serialize, abis::log_hash::LogHash
};
use dep::aztec::{
context::PrivateContext, hash::compute_unencrypted_log_hash,
oracle::logs::emit_unencrypted_log_private_internal
address::{AztecAddress, PublicKeysHash, PartialAddress}, contract_class_id::ContractClassId,
constants::DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE, abis::log_hash::LogHash
};
use dep::aztec::{hash::compute_unencrypted_log_hash, oracle::logs::emit_unencrypted_log_private_internal};

#[aztec(event)]
struct ContractInstanceDeployed {
DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE: Field,
address: AztecAddress,
version: u8,
salt: Field,
contract_class_id: ContractClassId,
initialization_hash: Field,
public_keys_hash: PublicKeysHash,
salt: Field,
contract_class_id: ContractClassId,
initialization_hash: Field,
public_keys_hash: PublicKeysHash,
deployer: AztecAddress,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// 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 EcdsaKAccount {
use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable};
use dep::aztec::prelude::{PrivateContext, PrivateImmutable};
use dep::aztec::{
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
keys::getters::get_current_public_keys
};

use dep::aztec::protocol_types::abis::call_context::CallContext;
use dep::std;

use dep::authwit::{
entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions,
auth_witness::get_auth_witness
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// Account contract that uses ECDSA signatures for authentication on random version of the p256 curve (to use with touchID).
contract EcdsaRAccount {
use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable};
use dep::aztec::prelude::{PrivateContext, PrivateImmutable};
use dep::aztec::{
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
keys::getters::get_current_public_keys
};

use dep::aztec::protocol_types::abis::call_context::CallContext;
use dep::std;

use dep::authwit::{
entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions,
auth_witness::get_auth_witness
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::aztec::prelude::{AztecAddress, EthAddress};
use dep::aztec::prelude::AztecAddress;
use dep::aztec::context::PublicContext;
use dep::aztec::protocol_types::hash::sha256_to_field;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// A contract used along with `Child` contract to test nested calls.
contract Parent {
use dep::aztec::prelude::{AztecAddress, FunctionSelector, Deserialize};
use dep::aztec::prelude::{AztecAddress, FunctionSelector};
use dep::aztec::context::gas::GasOpts;
// Private function to call another private function in the target_contract using the provided selector
#[aztec(private)]
Expand Down Expand Up @@ -56,7 +56,7 @@ contract Parent {
context.call_public_function(target_contract, target_selector, [target_value]);
}

// Private function that enqueues two calls to a child contract:
// Private function that enqueues two calls to a child contract:
// - one through a nested call to enqueue_call_to_child with value 10,
// - followed by one issued directly from this function with value 20.
#[aztec(private)]
Expand All @@ -73,7 +73,7 @@ contract Parent {
context.call_public_function(target_contract, target_selector, [20]);
}

// Private function that enqueues two calls to a child contract:
// Private function that enqueues two calls to a child contract:
// - one issued directly from this function with value 20,
// - followed by one through a nested call to enqueue_call_to_child with value 10.
#[aztec(private)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod public_key_note;
contract SchnorrAccount {
use dep::std;

use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, PrivateContext, PrivateImmutable};
use dep::aztec::prelude::{AztecAddress, PrivateContext, PrivateImmutable};
use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys;
use dep::authwit::{
entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions,
Expand All @@ -14,7 +14,7 @@ contract SchnorrAccount {
use dep::aztec::{hash::compute_siloed_nullifier, keys::getters::get_current_public_keys};
use dep::aztec::oracle::get_nullifier_membership_witness::get_low_nullifier_membership_witness;

use crate::public_key_note::{PublicKeyNote, PUBLIC_KEY_NOTE_LEN};
use crate::public_key_note::PublicKeyNote;

#[aztec(storage)]
struct Storage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Account contract that uses Schnorr signatures for authentication using a hardcoded public key.
contract SchnorrHardcodedAccount {
use dep::std;
use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext};
use dep::aztec::prelude::PrivateContext;

use dep::authwit::{
entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ contract Token {
context::{PrivateContext, PrivateCallInterface}, hash::compute_secret_hash,
prelude::{
NoteGetterOptions, Map, PublicMutable, SharedImmutable, PrivateSet, AztecAddress,
FunctionSelector, NoteHeader, Point
FunctionSelector, NoteHeader
},
encrypted_logs::{
encrypted_note_emission::{encode_and_encrypt_note_with_keys, encode_and_encrypt_note_with_keys_unconstrained},
encrypted_event_emission::{encode_and_encrypt_event, encode_and_encrypt_event_with_keys_unconstrained}
encrypted_event_emission::encode_and_encrypt_event_with_keys_unconstrained
},
keys::getters::get_current_public_keys
};
Expand All @@ -33,8 +33,8 @@ contract Token {
// docs:end:import_authwit

use crate::types::{
transparent_note::TransparentNote,
token_note::{TokenNote, TOKEN_NOTE_LEN, TokenNoteHidingPoint}, balance_set::BalanceSet
transparent_note::TransparentNote, token_note::{TokenNote, TokenNoteHidingPoint},
balance_set::BalanceSet
};
// docs:end::imports

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod negative_roots;

use crate::{
config::{
BigNum, BLS12_381_Fr_Params, F, FIELDS_PER_BLOB, LOG_FIELDS_PER_BLOB, NOIR_FIELDS_PER_BLOB,
BigNum, F, FIELDS_PER_BLOB, LOG_FIELDS_PER_BLOB, NOIR_FIELDS_PER_BLOB,
FIELDS_CARRYING_AN_EXTRA_BIT_PER_BLOB, D, D_INV, ROOTS
},
negative_roots::NEGATIVE_ROOTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use dep::types::{hash::accumulate_sha256};
// hash functions.
// TODO(Miranda): This is an interim version with 1 field sha256 - ideally we remove this and use accumulate_sha256 inside
// the general MT
struct Sha256MerkleTree<N> {
struct Sha256MerkleTree<let N: u32> {
leaves: [Field; N],
nodes: [Field; N],
}

impl<N> Sha256MerkleTree<N> {
impl<let N: u32> Sha256MerkleTree<N> {
pub fn new(leaves: [Field; N]) -> Self {
let mut nodes = [0; N];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl BaseRollupInputs {
)
}

fn create_nullifier_subtree<N>(leaves: [NullifierLeafPreimage; N]) -> Field {
fn create_nullifier_subtree<let N: u32>(leaves: [NullifierLeafPreimage; N]) -> Field {
calculate_subtree_root(leaves.map(|leaf:NullifierLeafPreimage| leaf.hash()))
}

Expand Down Expand Up @@ -506,7 +506,7 @@ mod tests {
global MAX_nullifiers_PER_TEST = 4;
global MAX_PUBLIC_DATA_READS_PER_TEST = 2;

fn update_public_data_tree<EXISTING_LEAVES, SUBTREE_SIBLING_PATH_LENGTH, SUBTREE_HEIGHT>(
fn update_public_data_tree<let EXISTING_LEAVES: u32, let SUBTREE_SIBLING_PATH_LENGTH: u32, let SUBTREE_HEIGHT: u32>(
public_data_tree: &mut NonEmptyMerkleTree<EXISTING_LEAVES, PUBLIC_DATA_TREE_HEIGHT, SUBTREE_SIBLING_PATH_LENGTH, SUBTREE_HEIGHT>,
kernel_data: &mut KernelData,
snapshot: AppendOnlyTreeSnapshot,
Expand Down Expand Up @@ -615,7 +615,7 @@ mod tests {
fee_payer_fee_juice_balance_pre_existing_public_data_index: Option<u32>
}

fn test_compute_empty_root<N>(size: [Field; N]) -> Field {
fn test_compute_empty_root<let N: u32>(size: [Field; N]) -> Field {
compute_zero_hashes(size)[N - 1]
}

Expand Down Expand Up @@ -653,7 +653,7 @@ mod tests {
)
}

fn extract_subtree_sibling_path<FULL_HEIGHT, SIBLING_PATH_LENGTH>(
fn extract_subtree_sibling_path<let FULL_HEIGHT: u32, let SIBLING_PATH_LENGTH: u32>(
path: [Field; FULL_HEIGHT],
mut sibling_path: [Field; SIBLING_PATH_LENGTH]
) -> [Field; SIBLING_PATH_LENGTH] {
Expand Down