Skip to content

Commit

Permalink
refactor: pedersen hash related cleanup in aztec.nr
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 15, 2024
1 parent 3d61bdf commit e3af37c
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 38 deletions.
3 changes: 1 addition & 2 deletions noir-projects/aztec-nr/authwit/src/account.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use dep::aztec::context::{PrivateContext, PublicContext};
use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector, hash::pedersen_hash};
use dep::aztec::context::PrivateContext;

use crate::entrypoint::{app::AppPayload, fee::FeePayload};
use crate::auth::{IS_VALID_SELECTOR, compute_authwit_message_hash};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::protocol_types::{
abis::nullifier_leaf_preimage::{NullifierLeafPreimage, NULLIFIER_LEAF_PREIMAGE_LENGTH},
constants::NULLIFIER_TREE_HEIGHT, hash::pedersen_hash, utils::arr_copy_slice
constants::NULLIFIER_TREE_HEIGHT, utils::arr_copy_slice
};

// INDEX_LENGTH + NULLIFIER_LEAF_PREIMAGE_LENGTH + NULLIFIER_TREE_HEIGHT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use dep::protocol_types::{
constants::PUBLIC_DATA_TREE_HEIGHT, hash::pedersen_hash,
public_data_tree_leaf_preimage::PublicDataTreeLeafPreimage, traits::{Hash, Serialize},
constants::PUBLIC_DATA_TREE_HEIGHT, public_data_tree_leaf_preimage::PublicDataTreeLeafPreimage,
utils::arr_copy_slice
};

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,4 +1,4 @@
use dep::protocol_types::{hash::pedersen_hash, storage::map::derive_storage_slot_in_map, traits::ToField};
use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};
use crate::state_vars::storage::Storage;

// docs:start:map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
use dep::protocol_types::{
hash::{pedersen_hash, poseidon2_hash}, traits::{FromField, ToField}, address::AztecAddress,
header::Header
};
use dep::protocol_types::{traits::{FromField, ToField}, address::AztecAddress, header::Header};

use crate::context::PrivateContext;
use crate::state_vars::{
storage::Storage,
shared_mutable::{
shared_mutable::SharedMutable, scheduled_delay_change::ScheduledDelayChange,
scheduled_value_change::ScheduledValueChange
}
};
use crate::{context::PrivateContext, state_vars::shared_mutable::shared_mutable::SharedMutable};

struct SharedMutablePrivateGetter<T, INITIAL_DELAY> {
context: &mut PrivateContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use dep::aztec::{
note::{note_header::NoteHeader, note_interface::NoteInterface}, hash::pedersen_hash,
context::PrivateContext
};
use dep::aztec::{note::{note_header::NoteHeader, note_interface::NoteInterface}, context::PrivateContext};

global TEST_NOTE_LEN: Field = 1;
// TEST_NOTE_LENGTH * 32 + 32(storage_slot as bytes) + 32(note_type_id as bytes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::aztec::prelude::{AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, NoteInterface, PrivateSet, Map};
use dep::aztec::{
context::{PrivateContext, UnconstrainedContext}, hash::pedersen_hash,
context::{PrivateContext, UnconstrainedContext},
protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
note::{note_getter::view_notes, note_getter_options::SortOrder, note_emission::OuterNoteEmission}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::aztec::prelude::{AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, NoteInterface, PrivateSet, Map};
use dep::aztec::{
context::{PrivateContext, UnconstrainedContext}, hash::pedersen_hash,
context::{PrivateContext, UnconstrainedContext},
protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
note::{
note_getter::view_notes, note_getter_options::SortOrder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::aztec::prelude::{AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, NoteInterface, PrivateSet, Map};
use dep::aztec::{
context::{PrivateContext, UnconstrainedContext}, hash::pedersen_hash,
context::{PrivateContext, UnconstrainedContext},
protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
note::{
note_getter::view_notes, note_getter_options::SortOrder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{
abis::function_selector::FunctionSelector, address::{EthAddress, AztecAddress},
constants::{GAS_LENGTH, FIXED_DA_GAS, FIXED_L2_GAS}, hash::pedersen_hash,
traits::{Deserialize, Hash, Serialize, Empty}, abis::side_effect::Ordered, utils::reader::Reader,
abis::gas_fees::GasFees
constants::{GAS_LENGTH, FIXED_DA_GAS, FIXED_L2_GAS}, traits::{Deserialize, Hash, Serialize, Empty},
abis::side_effect::Ordered, utils::reader::Reader, abis::gas_fees::GasFees
};
use std::ops::{Add, Sub};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
abis::function_selector::FunctionSelector, address::{EthAddress, AztecAddress},
constants::GAS_FEES_LENGTH, hash::pedersen_hash, traits::{Deserialize, Hash, Serialize, Empty},
constants::GAS_FEES_LENGTH, traits::{Deserialize, Hash, Serialize, Empty},
abis::side_effect::Ordered, utils::reader::Reader
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use crate::{
GAS_SETTINGS_LENGTH, DEFAULT_GAS_LIMIT, DEFAULT_TEARDOWN_GAS_LIMIT, DEFAULT_MAX_FEE_PER_GAS,
DEFAULT_INCLUSION_FEE
},
hash::pedersen_hash, traits::{Deserialize, Hash, Serialize, Empty}, abis::side_effect::Ordered,
utils::reader::Reader
traits::{Deserialize, Hash, Serialize, Empty}, abis::side_effect::Ordered, utils::reader::Reader
};

struct GasSettings {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use crate::{
constants::ETH_ADDRESS_LENGTH, hash::pedersen_hash,
traits::{Empty, ToField, Serialize, Deserialize}, utils
};
use crate::{constants::ETH_ADDRESS_LENGTH, traits::{Empty, ToField, Serialize, Deserialize}, utils};

struct EthAddress{
inner : Field
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/src/e2e_keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('Key Registry', () => {
afterAll(() => teardown());

describe('using nsk_app to detect nullification', () => {
// This test checks that it possible to detect that a note has been nullified just by using nsk_app. Note that
// this only works for non-transient notes as transient ones never emit a note hash which makes it impossible
// to brute force their nullifier.
// This test checks that it is possible to detect that a note has been nullified just by using nsk_app. Note
// that this only works for non-transient notes as transient ones never emit a note hash which makes it
// impossible to brute force their nullifier.
// This might seem to make the scheme useless in practice. This could not be the case because if you have
// a note of funds, when you create the transient you are nullifying that note. So even if I cannot see when you
// nullified the transient ones, I can see that you nullified the first.
Expand Down

0 comments on commit e3af37c

Please sign in to comment.