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
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/encrypted_logs/header.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dep::protocol_types::{address::AztecAddress, grumpkin_private_key::GrumpkinP

use crate::keys::point_to_symmetric_key::point_to_symmetric_key;

use dep::std::aes128::aes128_encrypt;
use std::aes128::aes128_encrypt;

struct EncryptedLogHeader {
address: AztecAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::note::note_interface::NoteInterface;
use crate::event::event_interface::EventInterface;
use dep::protocol_types::{grumpkin_private_key::GrumpkinPrivateKey, grumpkin_point::GrumpkinPoint};

use dep::std::aes128::aes128_encrypt;
use std::aes128::aes128_encrypt;
use crate::keys::point_to_symmetric_key::point_to_symmetric_key;

struct EncryptedLogIncomingBody<M> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use dep::protocol_types::{
constants::GENERATOR_INDEX__SYMMETRIC_KEY, hash::poseidon2_hash
};

use dep::std::aes128::aes128_encrypt;
use dep::std::println;
use std::aes128::aes128_encrypt;

use crate::keys::point_to_symmetric_key::point_to_symmetric_key;

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dep::protocol_types::{
constants::{GENERATOR_INDEX__IVSK_M, GENERATOR_INDEX__OVSK_M}, hash::poseidon2_hash
};

use dep::std::{embedded_curve_ops::{embedded_curve_add, EmbeddedCurvePoint}, field::bytes32_to_field};
use std::{embedded_curve_ops::{embedded_curve_add, EmbeddedCurvePoint}, field::bytes32_to_field};

use crate::oracle::unsafe_rand::unsafe_rand;

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,4 +1,4 @@
use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;
use dep::protocol_types::header::Header;

use crate::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;
use dep::protocol_types::header::Header;

use crate::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;
use dep::protocol_types::{header::Header, utils::field::{full_field_less_than, full_field_greater_than}};
use crate::{
context::PrivateContext, note::{utils::compute_siloed_nullifier, note_interface::NoteInterface},
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/history/public_storage.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dep::protocol_types::{
constants::GENERATOR_INDEX__PUBLIC_LEAF_INDEX, hash::pedersen_hash, address::AztecAddress,
header::Header, utils::field::full_field_less_than
};
use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;

use crate::{context::PrivateContext, oracle::get_public_data_witness::get_public_data_witness};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dep::protocol_types::{
constants::GENERATOR_INDEX__SYMMETRIC_KEY, grumpkin_private_key::GrumpkinPrivateKey,
grumpkin_point::GrumpkinPoint, utils::arr_copy_slice
};
use dep::std::{hash::sha256, embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul}};
use std::{hash::sha256, embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul}};

// 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/messaging.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
oracle::get_l1_to_l2_membership_witness::get_l1_to_l2_membership_witness
};

use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;
use dep::protocol_types::{constants::L1_TO_L2_MSG_TREE_HEIGHT, address::{AztecAddress, EthAddress}, utils::arr_copy_slice};

pub fn process_l1_to_l2_message(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::option::Option;
use std::option::Option;
use dep::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, traits::ToField};
use crate::note::note_interface::NoteInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::option::Option;
use std::option::Option;
use crate::note::note_getter_options::{PropertySelector, Select, Sort, Comparator, NoteStatus};
use dep::protocol_types::traits::ToField;
use crate::note::note_interface::NoteInterface;
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,4 +1,4 @@
use dep::std::merkle::compute_merkle_root;
use std::merkle::compute_merkle_root;
use dep::protocol_types::{constants::HEADER_LENGTH, header::Header};

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/public_storage.nr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn write<T, N>(storage_slot: Field, value: T) where T: Serialize<N> {
// }

mod tests {
use dep::std::test::OracleMock;
use std::test::OracleMock;
use dep::protocol_types::traits::{Deserialize, Serialize};
use crate::public_storage;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint};
use crate::{context::PrivateContext, state_vars::private_mutable::PrivateMutable};
use crate::test::{mocks::mock_note::MockNote, helpers::{cheatcodes, test_environment::TestEnvironment}};
use dep::std::{unsafe::zeroed, test::OracleMock};
use std::{unsafe::zeroed, test::OracleMock};

global storage_slot = 17;

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

mod test;

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

mod test;

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn verify_collapse_hints<T, N>(
} else {
// BoundedVec assumes that the unused parts of the storage are zeroed out (e.g. in the Eq impl), so we make
// sure that this property holds.
assert_eq(collapsed.get_unchecked(i), dep::std::unsafe::zeroed(), "Dirty collapsed vec storage");
assert_eq(collapsed.get_unchecked(i), std::unsafe::zeroed(), "Dirty collapsed vec storage");
}
}
// We now know that:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ mod dapp_payload;

contract AppSubscription {
use crate::{dapp_payload::DAppPayload, subscription_note::{SubscriptionNote, SUBSCRIPTION_NOTE_LEN}};
use dep::{
aztec::{

use aztec::{
prelude::{
AztecAddress, FunctionSelector, PrivateContext, NoteHeader, Map, PrivateMutable, PublicMutable,
SharedImmutable
},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note,
protocol_types::{traits::is_empty, grumpkin_point::GrumpkinPoint}
},
authwit::{auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit},
gas_token::GasToken, token::Token
};
use authwit::{auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit};
use gas_token::GasToken;
use token::Token;

#[aztec(storage)]
struct Storage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract AvmTest {
global big_field_136_bits: Field = 0x991234567890abcdef1234567890abcdef;

// Libs
use dep::std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul};
use std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul};
use dep::aztec::protocol_types::constants::CONTRACT_INSTANCE_LENGTH;
use dep::aztec::prelude::{Map, Deserialize};
use dep::aztec::state_vars::PublicMutable;
Expand Down Expand Up @@ -76,15 +76,15 @@ contract AvmTest {
fn set_storage_map(to: AztecAddress, amount: u32) -> Field {
storage.map.at(to).write(amount);
// returns storage slot for key
dep::std::hash::pedersen_hash([storage.map.storage_slot, to.to_field()])
std::hash::pedersen_hash([storage.map.storage_slot, to.to_field()])
}

#[aztec(public)]
fn add_storage_map(to: AztecAddress, amount: u32) -> Field {
let new_balance = storage.map.at(to).read().add(amount);
storage.map.at(to).write(new_balance);
// returns storage slot for key
dep::std::hash::pedersen_hash([storage.map.storage_slot, to.to_field()])
std::hash::pedersen_hash([storage.map.storage_slot, to.to_field()])
}

#[aztec(public)]
Expand Down Expand Up @@ -209,27 +209,27 @@ contract AvmTest {
************************************************************************/
#[aztec(public)]
fn keccak_hash(data: [u8; 10]) -> [u8; 32] {
dep::std::hash::keccak256(data, data.len() as u32)
std::hash::keccak256(data, data.len() as u32)
}

#[aztec(public)]
fn poseidon2_hash(data: [Field; 10]) -> Field {
dep::std::hash::poseidon2::Poseidon2::hash(data, data.len())
std::hash::poseidon2::Poseidon2::hash(data, data.len())
}

#[aztec(public)]
fn sha256_hash(data: [u8; 10]) -> [u8; 32] {
dep::std::hash::sha256(data)
std::hash::sha256(data)
}

#[aztec(public)]
fn pedersen_hash(data: [Field; 10]) -> Field {
dep::std::hash::pedersen_hash(data)
std::hash::pedersen_hash(data)
}

#[aztec(public)]
fn pedersen_hash_with_index(data: [Field; 10]) -> Field {
dep::std::hash::pedersen_hash_with_separator(data, /*index=*/ 20)
std::hash::pedersen_hash_with_separator(data, /*index=*/ 20)
}

/************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use dep::aztec::{
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys,
note::note_getter::view_notes, state_vars::PrivateSet, note::constants::MAX_NOTES_PER_PAGE
};
use dep::std;
use dep::std::{option::Option};
use dep::value_note::{value_note::{ValueNote, VALUE_NOTE_LEN}};

struct Card {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract EasyPrivateVoting {
let msg_sender_npk_m_hash = header_at_active_at_block.get_npk_m_hash(&mut context, context.msg_sender());

let secret = context.request_nsk_app(msg_sender_npk_m_hash); // get secret key of caller of function
let nullifier = dep::std::hash::pedersen_hash([context.msg_sender().to_field(), secret]); // derive nullifier from sender and secret
let nullifier = std::hash::pedersen_hash([context.msg_sender().to_field(), secret]); // derive nullifier from sender and secret
context.push_new_nullifier(nullifier, 0); // push nullifier
EasyPrivateVoting::at(context.this_address()).add_to_tally_public(candidate).enqueue(&mut context);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dep::std::{schnorr::verify_signature_slice};
use std::{schnorr::verify_signature_slice};
use dep::aztec::prelude::AztecAddress;
use crate::auth_oracle::AuthWitness;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ contract Uniswap {
use dep::aztec::context::gas::GasOpts;

use dep::authwit::auth::{
IS_VALID_SELECTOR, assert_current_call_valid_authwit_public, compute_authwit_message_hash_from_call,
compute_authwit_message_hash, set_authorized
IS_VALID_SELECTOR, assert_current_call_valid_authwit_public,
compute_authwit_message_hash_from_call, compute_authwit_message_hash, set_authorized
};

use dep::token::Token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Empty for RootParityInput {
impl Verifiable for RootParityInput {
fn verify(self) {
let inputs = ParityPublicInputs::serialize(self.public_inputs);
dep::std::verify_proof(
std::verify_proof(
self.verification_key.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Empty for RootRollupParityInput {
impl Verifiable for RootRollupParityInput {
fn verify(self) {
let inputs = ParityPublicInputs::serialize(self.public_inputs);
dep::std::verify_proof(
std::verify_proof(
self.verification_key.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ impl PrivateCallDataValidator {
let private_call_vk_hash = stdlib_recursion_verification_key_compress_native_vk(self.data.vk);

assert(!contract_address.is_zero(), "contract address cannot be zero");
// std::println(f"contract_address={contract_address}");
// std::println(f"private_call_vk_hash={private_call_vk_hash}");
// println(f"contract_address={contract_address}");
// println(f"private_call_vk_hash={private_call_vk_hash}");

// Recompute the contract class id
let computed_private_functions_root = private_functions_root_from_siblings(
Expand All @@ -217,24 +217,24 @@ impl PrivateCallDataValidator {
self.data.function_leaf_membership_witness.leaf_index,
self.data.function_leaf_membership_witness.sibling_path
);
// std::println(f"computed_private_functions_root={computed_private_functions_root}");
// println(f"computed_private_functions_root={computed_private_functions_root}");

let computed_contract_class_id = ContractClassId::compute(
self.data.contract_class_artifact_hash,
computed_private_functions_root,
self.data.contract_class_public_bytecode_commitment
);
// std::println(f"computed_contract_class_id={computed_contract_class_id}");
// println(f"computed_contract_class_id={computed_contract_class_id}");

// Recompute contract address using the preimage which includes the class_id
let computed_partial_address = PartialAddress::compute_from_salted_initialization_hash(
computed_contract_class_id,
self.data.salted_initialization_hash
);
// std::println(f"computed_partial_address={computed_partial_address}");
// println(f"computed_partial_address={computed_partial_address}");

let computed_address = AztecAddress::compute(self.data.public_keys_hash, computed_partial_address);
// std::println(f"computed_address={computed_address}");
// println(f"computed_address={computed_address}");

assert(
computed_address.eq(contract_address), "computed contract address does not match expected one"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct EmptyNestedCircuitPublicInputs {

impl Verifiable for EmptyNestedCircuitPublicInputs {
fn verify(self) {
dep::std::verify_proof(
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
&[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ impl PrivateKernelInitCircuitPrivateInputs {
private_call_data_validator.validate_as_first_call(self.hints.first_revertible_private_call_request_index);
private_call_data_validator.validate_against_tx_request(self.tx_request);
private_call_data_validator.validate(output.end.new_note_hashes);
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
// verify/aggregate the private call proof
self.private_call.verify();
}

// Validate output.
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
PrivateKernelCircuitOutputValidator::new(output).validate_as_first_call(
self.tx_request,
self.private_call.call_stack_item.public_inputs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ impl PrivateKernelInnerCircuitPrivateInputs {
private_call_data_validator.validate_against_call_request(call_request);
private_call_data_validator.validate_against_previous_kernel(self.previous_kernel.public_inputs);
private_call_data_validator.validate(output.end.new_note_hashes);
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
// verify/aggregate the private call proof
self.private_call.verify();
// verify/aggregate the previous kernel
self.previous_kernel.verify();
}

// Validate output.
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
PrivateKernelCircuitOutputValidator::new(output).validate_as_inner_call(
self.previous_kernel.public_inputs,
previous_kernel_array_lengths,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ impl PrivateKernelTailCircuitPrivateInputs {

// Validate inputs.
PreviousKernelValidator::new(self.previous_kernel.public_inputs).validate_for_private_tail();
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
// verify/aggregate the previous kernel
self.previous_kernel.verify();
}

// Validate output.
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
let hints = generate_hints(self.previous_kernel.public_inputs);
KernelCircuitOutputValidator::new(output, self.previous_kernel.public_inputs).validate(hints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl PrivateKernelTailToPublicCircuitPrivateInputs {
pub fn execute(self) -> PublicKernelCircuitPublicInputs {
// Validate inputs.
PreviousKernelValidator::new(self.previous_kernel.public_inputs).validate_for_private_tail_to_public();
if !dep::std::runtime::is_unconstrained() {
if !std::runtime::is_unconstrained() {
// verify/aggregate the previous kernel
self.previous_kernel.verify();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use dep::std::cmp::Eq;
use dep::types::{
abis::{global_variables::GlobalVariables, append_only_tree_snapshot::AppendOnlyTreeSnapshot},
traits::{Empty, Serialize, Deserialize}, constants::CONSTANT_ROLLUP_DATA_LENGTH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct PreviousRollupData{
impl Verifiable for PreviousRollupData {
fn verify(self) {
let inputs = BaseOrMergeRollupPublicInputs::serialize(self.base_or_merge_rollup_public_inputs);
dep::std::verify_proof(
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
Expand Down
Loading