Skip to content

Commit 35dc1e1

Browse files
authored
chore: fix a load of warnings in aztec-nr (#8501)
aztec-nr isn't properly specifying the visibility of its re-exports so there's a ton of warnings. This PR addresses some of them along with some unused imports.
1 parent f6d31f1 commit 35dc1e1

File tree

9 files changed

+27
-36
lines changed

9 files changed

+27
-36
lines changed

noir-projects/aztec-nr/aztec/src/context/mod.nr

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ mod unconstrained_context;
99
mod call_interfaces;
1010
mod gas;
1111

12-
use call_interfaces::{
12+
pub use call_interfaces::{
1313
PrivateCallInterface, PrivateStaticCallInterface, PublicCallInterface, PublicStaticCallInterface,
1414
PrivateVoidCallInterface, PrivateStaticVoidCallInterface, PublicVoidCallInterface,
1515
PublicStaticVoidCallInterface
1616
};
17-
use private_context::PrivateContext;
18-
use packed_returns::PackedReturns;
19-
use public_context::PublicContext;
20-
use public_context::FunctionReturns;
21-
use unconstrained_context::UnconstrainedContext;
17+
pub use private_context::PrivateContext;
18+
pub use packed_returns::PackedReturns;
19+
pub use public_context::PublicContext;
20+
pub use public_context::FunctionReturns;
21+
pub use unconstrained_context::UnconstrainedContext;

noir-projects/aztec-nr/aztec/src/oracle/mod.nr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ mod returns;
2525

2626
// debug_log oracle is used by both noir-protocol-circuits and this crate and for this reason we just re-export it
2727
// here from protocol circuits.
28-
use dep::protocol_types::debug_log;
28+
pub use dep::protocol_types::debug_log;

noir-projects/aztec-nr/aztec/src/prelude.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// docs:start:prelude
2-
use dep::protocol_types::{
2+
pub use dep::protocol_types::{
33
address::{AztecAddress, EthAddress}, abis::function_selector::FunctionSelector, point::Point,
44
traits::{Serialize, Deserialize}
55
};
6-
use crate::{
6+
pub use crate::{
77
state_vars::{
88
map::Map, private_immutable::PrivateImmutable, private_mutable::PrivateMutable,
99
public_immutable::PublicImmutable, public_mutable::PublicMutable, private_set::PrivateSet,

noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use dep::protocol_types::{
2-
address::AztecAddress, constants::GENERATOR_INDEX__INITIALIZATION_NULLIFIER,
3-
hash::poseidon2_hash_with_separator
4-
};
1+
use dep::protocol_types::{constants::GENERATOR_INDEX__INITIALIZATION_NULLIFIER, hash::poseidon2_hash_with_separator};
52

63
use crate::context::{PrivateContext, UnconstrainedContext};
74
use crate::note::{
@@ -32,7 +29,7 @@ impl<Note, Context> PrivateImmutable<Note, Context> {
3229
// When this initialization nullifier is emitted, an observer could do a dictionary or rainbow attack to learn the preimage of this nullifier to deduce the storage slot and contract address.
3330
// For some applications, leaking the details that a particular state variable of a particular contract has been initialized will be unacceptable.
3431
// Under such circumstances, such application developers might wish to _not_ use this state variable type.
35-
// This is especially dangerous for initial assignment to elements of a `Map<AztecAddress, PrivateImmutable>` type (for example), because the storage slot often also identifies an actor.
32+
// This is especially dangerous for initial assignment to elements of a `Map<AztecAddress, PrivateImmutable>` type (for example), because the storage slot often also identifies an actor.
3633
// e.g. the initial assignment to `my_map.at(msg.sender)` will leak: `msg.sender`, the fact that an element of `my_map` was assigned-to for the first time, and the contract_address.
3734
pub fn compute_initialization_nullifier(self) -> Field {
3835
poseidon2_hash_with_separator(

noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::note::{
44
constants::MAX_NOTES_PER_PAGE,
55
lifecycle::{create_note, create_note_hash_from_public, destroy_note_unsafe},
66
note_getter::{get_notes, view_notes}, note_getter_options::NoteGetterOptions,
7-
note_header::NoteHeader, note_interface::NoteInterface, note_viewer_options::NoteViewerOptions,
7+
note_interface::NoteInterface, note_viewer_options::NoteViewerOptions,
88
utils::compute_note_hash_for_read_request, note_emission::NoteEmission
99
};
1010
use crate::state_vars::storage::Storage;

noir-projects/aztec-nr/aztec/src/state_vars/public_immutable.nr

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use crate::{
2-
context::{PublicContext, UnconstrainedContext}, oracle::storage::storage_read,
3-
state_vars::storage::Storage
4-
};
1+
use crate::{context::{PublicContext, UnconstrainedContext}, state_vars::storage::Storage};
52
use dep::protocol_types::{constants::INITIALIZATION_SLOT_SEPARATOR, traits::{Deserialize, Serialize}};
63

74
// Just like SharedImmutable but without the ability to read from private functions.

noir-projects/aztec-nr/aztec/src/state_vars/shared_immutable.nr

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use crate::{
2-
context::{PrivateContext, PublicContext, UnconstrainedContext}, oracle::storage::storage_read,
3-
state_vars::storage::Storage
4-
};
1+
use crate::{context::{PrivateContext, PublicContext, UnconstrainedContext}, state_vars::storage::Storage};
52
use dep::protocol_types::{constants::INITIALIZATION_SLOT_SEPARATOR, traits::{Deserialize, Serialize}};
63

74
// Just like PublicImmutable but with the ability to read from private functions.
@@ -24,7 +21,7 @@ impl<T, Context> SharedImmutable<T, Context> {
2421
}
2522

2623
impl<T, T_SERIALIZED_LEN> SharedImmutable<T, &mut PublicContext> where T: Serialize<T_SERIALIZED_LEN> + Deserialize<T_SERIALIZED_LEN> {
27-
// Intended to be only called once.
24+
// Intended to be only called once.
2825
pub fn initialize(self, value: T) {
2926
// We check that the struct is not yet initialized by checking if the initialization slot is 0
3027
let initialization_slot = INITIALIZATION_SLOT_SEPARATOR + self.storage_slot;

noir-projects/aztec-nr/aztec/src/state_vars/shared_mutable/scheduled_delay_change.nr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use dep::protocol_types::traits::{Serialize, Deserialize, FromField, ToField};
1+
use dep::protocol_types::traits::{Serialize, Deserialize};
22
use std::cmp::min;
33

44
mod test;
55

66
// This data structure is used by SharedMutable to store the minimum delay with which a ScheduledValueChange object can
77
// schedule a change.
8-
// This delay is initally equal to INITIAL_DELAY, and can be safely mutated to any other value over time. This mutation
9-
// is performed via `schedule_change` in order to satisfy ScheduleValueChange constraints: if e.g. we allowed for the
10-
// delay to be decreased immediately then it'd be possible for the state variable to schedule a value change with a
8+
// This delay is initally equal to INITIAL_DELAY, and can be safely mutated to any other value over time. This mutation
9+
// is performed via `schedule_change` in order to satisfy ScheduleValueChange constraints: if e.g. we allowed for the
10+
// delay to be decreased immediately then it'd be possible for the state variable to schedule a value change with a
1111
// reduced delay, invalidating prior private reads.
1212
struct ScheduledDelayChange<let INITIAL_DELAY: u32> {
13-
// Both pre and post are stored in public storage, so by default they are zeroed. By wrapping them in an Option,
13+
// Both pre and post are stored in public storage, so by default they are zeroed. By wrapping them in an Option,
1414
// they default to Option::none(), which we detect and replace with INITIAL_DELAY. The end result is that a
1515
// ScheduledDelayChange that has not been initialized has a delay equal to INITIAL_DELAY, which is the desired
1616
// effect. Once initialized, the Option will never be none again.
@@ -83,11 +83,11 @@ impl<let INITIAL_DELAY: u32> ScheduledDelayChange<INITIAL_DELAY> {
8383
}
8484

8585
/// Returns the minimum delay before a value might mutate due to a scheduled change, from the perspective of some
86-
/// historical block number. It only returns a meaningful value when called in private with historical blocks. This
86+
/// historical block number. It only returns a meaningful value when called in private with historical blocks. This
8787
/// function can be used alongside `ScheduledValueChange.get_block_horizon` to properly constrain the
8888
/// `max_block_number` transaction property when reading mutable shared state.
8989
/// This value typically equals the current delay at the block following the historical one (the earliest one in
90-
/// which a value change could be scheduled), but it also considers scenarios in which a delay reduction is
90+
/// which a value change could be scheduled), but it also considers scenarios in which a delay reduction is
9191
/// scheduled to happen in the near future, resulting in a way to schedule a change with an overall delay lower than
9292
/// the current one.
9393
pub fn get_effective_minimum_delay_at(self, historical_block_number: u32) -> u32 {
@@ -114,7 +114,7 @@ impl<let INITIAL_DELAY: u32> ScheduledDelayChange<INITIAL_DELAY> {
114114
// | until change |
115115
// | |
116116
// |----------------------------------------------------------------|
117-
// current delay at the earliest block in
117+
// current delay at the earliest block in
118118
// which to scheduled value change
119119

120120
let blocks_until_change = self.block_of_change - (historical_block_number + 1);
@@ -136,8 +136,8 @@ impl<INITIAL_DELAY> Serialize<1> for ScheduledDelayChange<INITIAL_DELAY> {
136136
let lo = ((self.pre.unwrap_unchecked() as u64) * (1 << 32))
137137
+ (self.post.unwrap_unchecked() as u64);
138138

139-
let hi = (self.pre.is_some() as u64) * (1 << 33)
140-
+ (self.post.is_some() as u64 * (1 << 32))
139+
let hi = (self.pre.is_some() as u64) * (1 << 33)
140+
+ (self.post.is_some() as u64 * (1 << 32))
141141
+ self.block_of_change as u64;
142142

143143
let packed = U128::from_u64s_le(lo, hi);

noir-projects/aztec-nr/uint-note/src/uint_note.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use dep::aztec::{
22
generators::{Ga1 as G_amt, Ga2 as G_npk, Ga3 as G_rnd, G_slot},
3-
prelude::{NoteHeader, NoteInterface, PrivateContext},
3+
prelude::{NoteInterface, PrivateContext},
44
protocol_types::{
5-
constants::GENERATOR_INDEX__NOTE_NULLIFIER, point::{Point, POINT_LENGTH}, scalar::Scalar,
5+
constants::GENERATOR_INDEX__NOTE_NULLIFIER, point::{Point, POINT_LENGTH},
66
hash::poseidon2_hash_with_separator, traits::Serialize
77
},
88
note::utils::compute_note_hash_for_nullify, oracle::unsafe_rand::unsafe_rand,

0 commit comments

Comments
 (0)