Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Oct 8, 2024
1 parent 1b902f6 commit a268885
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 44 deletions.
2 changes: 1 addition & 1 deletion boxes/boxes/react/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dep::aztec::macros::aztec;
#[aztec]
contract BoxReact {
use dep::aztec::{
keys::public_keys::{IvpkM, OvpkM},
protocol_types::address::public_keys::{IvpkM, OvpkM},
prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note,
macros::{storage::storage, functions::{private, public, initializer}}
Expand Down
2 changes: 1 addition & 1 deletion boxes/boxes/vanilla/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dep::aztec::macros::aztec;
#[aztec]
contract Vanilla {
use dep::aztec::{
keys::public_keys::{IvpkM, OvpkM},
protocol_types::address::public_keys::{IvpkM, OvpkM},
prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note,
macros::{storage::storage, functions::{private, public, initializer}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::{
context::PrivateContext, event::event_interface::EventInterface,
encrypted_logs::payload::compute_encrypted_log,
keys::{getters::get_ovsk_app, public_keys::{OvpkM, IvpkM}}, oracle::random::random
encrypted_logs::payload::compute_encrypted_log, keys::getters::get_ovsk_app, oracle::random::random
};
use dep::protocol_types::{address::AztecAddress, hash::sha256_to_field};
use dep::protocol_types::{address::{AztecAddress, public_keys::{OvpkM, IvpkM}}, hash::sha256_to_field};

fn compute_raw_event_log<Event, let N: u32>(
context: PrivateContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use crate::{
context::PrivateContext, note::{note_emission::NoteEmission, note_interface::NoteInterface},
keys::{getters::get_ovsk_app, public_keys::{PublicKeys, OvpkM, IvpkM}},
encrypted_logs::payload::compute_encrypted_log
keys::getters::get_ovsk_app, encrypted_logs::payload::compute_encrypted_log
};
use dep::protocol_types::{
address::{public_keys::{PublicKeys, OvpkM, IvpkM}, AztecAddress}, hash::sha256_to_field,
abis::note_hash::NoteHash
};
use dep::protocol_types::{hash::sha256_to_field, address::AztecAddress, abis::note_hash::NoteHash};

fn compute_raw_note_log<Note, let N: u32>(
context: PrivateContext,
Expand Down
6 changes: 3 additions & 3 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/header.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::protocol_types::{address::AztecAddress, scalar::Scalar, point::Point};
use dep::protocol_types::{address::{AztecAddress, public_keys::{PublicKeys, IvpkM, ToPoint}}, scalar::Scalar, point::Point};

use crate::keys::{point_to_symmetric_key::point_to_symmetric_key, public_keys::ToPoint};
use crate::keys::point_to_symmetric_key::point_to_symmetric_key;

use std::aes128::aes128_encrypt;

Expand Down Expand Up @@ -36,7 +36,7 @@ unconstrained fn test_encrypted_log_header_matches_noir() {
lo: 0x00000000000000000000000000000000649e7ca01d9de27b21624098b897babd,
hi: 0x0000000000000000000000000000000023b3127c127b1f29a7adff5cccf8fb06
};
let point = crate::keys::public_keys::IvpkM {
let point = IvpkM {
inner: Point {
x: 0x2688431c705a5ff3e6c6f2573c9e3ba1c1026d2251d0dbbf2d810aa53fd1d186,
y: 0x1e96887b117afca01c00468264f4f80b5bb16d94c1808a448595f115556e5c8e,
Expand Down
13 changes: 5 additions & 8 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::protocol_types::{
address::AztecAddress, scalar::Scalar, point::Point, constants::GENERATOR_INDEX__SYMMETRIC_KEY,
hash::poseidon2_hash_with_separator
address::{AztecAddress, public_keys::{OvpkM, IvpkM}}, scalar::Scalar, point::Point,
constants::GENERATOR_INDEX__SYMMETRIC_KEY, hash::poseidon2_hash_with_separator
};
use std::{
aes128::aes128_encrypt, embedded_curve_ops::fixed_base_scalar_mul as derive_public_key,
Expand All @@ -9,7 +9,7 @@ use std::{

use crate::{
oracle::random::random, utils::point::point_to_bytes, encrypted_logs::{header::EncryptedLogHeader},
keys::{point_to_symmetric_key::point_to_symmetric_key, public_keys::{OvpkM, IvpkM}}
keys::{point_to_symmetric_key::point_to_symmetric_key}
};

pub fn compute_encrypted_log<let P: u32, let M: u32>(
Expand Down Expand Up @@ -147,12 +147,9 @@ pub fn compute_outgoing_body_ciphertext(
}

mod test {
use crate::{
encrypted_logs::payload::{compute_encrypted_log, compute_incoming_body_ciphertext, compute_outgoing_body_ciphertext},
keys::public_keys::{OvpkM, IvpkM}
};
use crate::{encrypted_logs::payload::{compute_encrypted_log, compute_incoming_body_ciphertext, compute_outgoing_body_ciphertext}};
use std::embedded_curve_ops::fixed_base_scalar_mul as derive_public_key;
use dep::protocol_types::{address::AztecAddress, point::Point, scalar::Scalar};
use dep::protocol_types::{address::{AztecAddress, public_keys::{OvpkM, IvpkM}}, point::Point, scalar::Scalar};
use std::test::OracleMock;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/keys/getters/mod.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::protocol_types::address::AztecAddress;
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::{public_keys::PublicKeys, constants::{NULLIFIER_INDEX, OUTGOING_INDEX}}
keys::{constants::{NULLIFIER_INDEX, OUTGOING_INDEX}}
};

mod test;
Expand Down
3 changes: 0 additions & 3 deletions noir-projects/aztec-nr/aztec/src/keys/mod.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
mod constants;
mod getters;
mod point_to_symmetric_key;
mod public_keys;

pub use crate::keys::public_keys::{PublicKeys, PUBLIC_KEYS_LENGTH};
6 changes: 4 additions & 2 deletions noir-projects/aztec-nr/aztec/src/oracle/keys.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::keys::{PublicKeys, public_keys::{NpkM, IvpkM, OvpkM, TpkM}};
use dep::protocol_types::{address::{AztecAddress, PartialAddress}, point::Point};
use dep::protocol_types::{
address::{public_keys::{PublicKeys, NpkM, IvpkM, OvpkM, TpkM}, AztecAddress, PartialAddress},
point::Point
};

#[oracle(getPublicKeysAndPartialAddress)]
unconstrained fn get_public_keys_and_partial_address_oracle(_address: AztecAddress) -> [Field; 13] {}
Expand Down
3 changes: 1 addition & 2 deletions noir-projects/aztec-nr/aztec/src/test/helpers/cheatcodes.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use dep::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress,
abis::function_selector::FunctionSelector, address::{AztecAddress, PublicKeys},
constants::CONTRACT_INSTANCE_LENGTH, contract_instance::ContractInstance
};
use crate::context::inputs::PrivateContextInputs;
use crate::test::helpers::utils::TestAccount;
use crate::keys::public_keys::PublicKeys;

unconstrained pub fn reset() {
oracle_reset();
Expand Down
3 changes: 1 addition & 2 deletions noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use dep::protocol_types::{
traits::{Deserialize, Serialize}, address::AztecAddress,
traits::{Deserialize, Serialize}, address::{AztecAddress, PublicKeys, PUBLIC_KEYS_LENGTH},
abis::{function_selector::FunctionSelector, private_circuit_public_inputs::PrivateCircuitPublicInputs},
contract_instance::ContractInstance
};

use crate::context::inputs::PrivateContextInputs;
use crate::context::call_interfaces::CallInterface;
use crate::test::helpers::cheatcodes;
use crate::keys::public_keys::{PUBLIC_KEYS_LENGTH, PublicKeys};

use crate::oracle::{execution::{get_block_number, get_contract_address}};
use protocol_types::constants::PUBLIC_DISPATCH_SELECTOR;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use dep::authwit::auth_witness;
use dep::aztec::{
protocol_types::{address::PartialAddress, utils::arr_copy_slice},
keys::{PublicKeys, PUBLIC_KEYS_LENGTH}
};
use dep::aztec::protocol_types::{address::{PartialAddress, PublicKeys, PUBLIC_KEYS_LENGTH}, utils::arr_copy_slice};

pub struct AuthWitness {
keys: PublicKeys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use dep::aztec::prelude::{NoteGetterOptions, NoteViewerOptions, NoteInterface, NullifiableNote, PrivateSet};
use dep::aztec::{
context::{PrivateContext, UnconstrainedContext},
protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
note::note_emission::OuterNoteEmission, keys::public_keys::NpkM
protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, address::public_keys::NpkM},
note::note_emission::OuterNoteEmission
};
use crate::types::token_note::OwnedNote;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ contract Test {
use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note;
use dep::aztec::encrypted_logs::encrypted_event_emission::encode_and_encrypt_event_with_randomness_unconstrained;

use dep::aztec::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, traits::Serialize, point::Point};
use dep::aztec::protocol_types::{
constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, traits::Serialize, point::Point,
address::public_keys::IvpkM
};

use dep::aztec::note::constants::MAX_NOTES_PER_PAGE;
use dep::aztec::keys::getters::get_public_keys;

use dep::aztec::{
hash::{pedersen_hash, compute_secret_hash, ArgsHasher}, keys::public_keys::IvpkM,
hash::{pedersen_hash, compute_secret_hash, ArgsHasher},
note::{
lifecycle::{create_note, destroy_note_unsafe}, note_getter::{get_notes, view_notes},
note_getter_options::NoteStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use dep::aztec::prelude::{NoteGetterOptions, NoteViewerOptions, NoteInterface, PrivateSet};
use dep::aztec::{
context::{PrivateContext, UnconstrainedContext},
protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, address::public_keys::NpkM},
note::{note_interface::NullifiableNote, note_getter::view_notes, note_emission::OuterNoteEmission},
keys::{getters::get_public_keys, public_keys::NpkM}
keys::getters::get_public_keys
};
use crate::types::token_note::OwnedNote;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
mod aztec_address;
mod eth_address;
mod partial_address;
mod public_keys;
mod public_keys_hash;
mod salted_initialization_hash;

pub use aztec_address::AztecAddress;
pub use eth_address::EthAddress;
pub use partial_address::PartialAddress;
pub use public_keys::{PublicKeys, PUBLIC_KEYS_LENGTH};
pub use public_keys_hash::PublicKeysHash;
pub use salted_initialization_hash::SaltedInitializationHash;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use dep::protocol_types::{
address::PublicKeysHash, constants::GENERATOR_INDEX__PUBLIC_KEYS_HASH,
hash::poseidon2_hash_with_separator, point::{Point, POINT_LENGTH},
use crate::{
address::public_keys_hash::PublicKeysHash, constants::GENERATOR_INDEX__PUBLIC_KEYS_HASH,
hash::poseidon2_hash_with_separator, point::POINT_LENGTH,
traits::{Deserialize, Serialize, Empty, is_empty, Hash}
};

global PUBLIC_KEYS_LENGTH: u32 = 12;
use dep::std::embedded_curve_ops::EmbeddedCurvePoint as Point;

pub global PUBLIC_KEYS_LENGTH: u32 = 12;

pub struct PublicKeys {
npk_m: NpkM,
Expand Down

0 comments on commit a268885

Please sign in to comment.