Skip to content

Commit

Permalink
chore: remove some more warnings (#9819)
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro authored Nov 8, 2024
1 parent 2a98ebb commit ddba505
Show file tree
Hide file tree
Showing 69 changed files with 608 additions and 624 deletions.
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/authwit/src/entrypoint/app.nr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Serialize<APP_PAYLOAD_SIZE> for AppPayload {
fields.extend_from_array(call.serialize());
}
fields.push(self.nonce);
fields.storage
fields.storage()
}
}

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Serialize<FEE_PAYLOAD_SIZE> for FeePayload {
}
fields.push(self.nonce);
fields.push(self.is_fee_payer as Field);
fields.storage
fields.storage()
}
}

Expand Down
5 changes: 1 addition & 4 deletions noir-projects/aztec-nr/aztec/src/context/call_interfaces.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use dep::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress, traits::Deserialize,
};

use crate::context::{
gas::GasOpts, inputs::PrivateContextInputs, private_context::PrivateContext,
public_context::PublicContext,
};
use crate::context::{gas::GasOpts, private_context::PrivateContext, public_context::PublicContext};

use crate::hash::hash_args;
use crate::oracle::arguments::pack_arguments;
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/context/inputs/mod.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod private_context_inputs;
pub mod private_context_inputs;

pub use crate::context::inputs::private_context_inputs::PrivateContextInputs;
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use dep::protocol_types::{
// PrivateContextInputs are expected to be provided to each private function
// docs:start:private-context-inputs
pub struct PrivateContextInputs {
call_context: CallContext,
historical_header: Header,
tx_context: TxContext,
start_side_effect_counter: u32,
pub call_context: CallContext,
pub historical_header: Header,
pub tx_context: TxContext,
pub start_side_effect_counter: u32,
}
// docs:end:private-context-inputs

Expand Down
16 changes: 8 additions & 8 deletions noir-projects/aztec-nr/aztec/src/context/mod.nr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod globals;
mod inputs;
pub mod globals;
pub mod inputs;

mod packed_returns;
mod private_context;
mod public_context;
mod unconstrained_context;
pub mod packed_returns;
pub mod private_context;
pub mod public_context;
pub mod unconstrained_context;

mod call_interfaces;
mod gas;
pub mod call_interfaces;
pub mod gas;

pub use call_interfaces::{
PrivateCallInterface, PrivateStaticCallInterface, PrivateStaticVoidCallInterface,
Expand Down
20 changes: 10 additions & 10 deletions noir-projects/aztec-nr/aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -112,41 +112,41 @@ impl PrivateContext {
}
}

fn msg_sender(self) -> AztecAddress {
pub fn msg_sender(self) -> AztecAddress {
self.inputs.call_context.msg_sender
}

fn this_address(self) -> AztecAddress {
pub fn this_address(self) -> AztecAddress {
self.inputs.call_context.contract_address
}

fn chain_id(self) -> Field {
pub fn chain_id(self) -> Field {
self.inputs.tx_context.chain_id
}

fn version(self) -> Field {
pub fn version(self) -> Field {
self.inputs.tx_context.version
}

fn selector(self) -> FunctionSelector {
pub fn selector(self) -> FunctionSelector {
self.inputs.call_context.function_selector
}

fn get_args_hash(self) -> Field {
pub fn get_args_hash(self) -> Field {
self.args_hash
}

fn push_note_hash(&mut self, note_hash: Field) {
pub fn push_note_hash(&mut self, note_hash: Field) {
self.note_hashes.push(NoteHash { value: note_hash, counter: self.next_counter() });
}

fn push_nullifier(&mut self, nullifier: Field) {
pub fn push_nullifier(&mut self, nullifier: Field) {
self.nullifiers.push(
Nullifier { value: nullifier, note_hash: 0, counter: self.next_counter() },
);
}

fn push_nullifier_for_note_hash(&mut self, nullifier: Field, nullified_note_hash: Field) {
pub fn push_nullifier_for_note_hash(&mut self, nullifier: Field, nullified_note_hash: Field) {
self.nullifiers.push(
Nullifier {
value: nullifier,
Expand All @@ -158,7 +158,7 @@ impl PrivateContext {

// Returns the header of a block whose state is used during private execution (not the block the transaction is
// included in).
fn get_header(self) -> Header {
pub fn get_header(self) -> Header {
self.historical_header
}

Expand Down
44 changes: 22 additions & 22 deletions noir-projects/aztec-nr/aztec/src/context/public_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::hash::{
};
use dep::protocol_types::abis::function_selector::FunctionSelector;
use dep::protocol_types::address::{AztecAddress, EthAddress};
use dep::protocol_types::constants::{MAX_FIELD_VALUE, PUBLIC_DISPATCH_SELECTOR};
use dep::protocol_types::constants::MAX_FIELD_VALUE;
use dep::protocol_types::traits::{Deserialize, Empty, Serialize};

pub struct PublicContext {
Expand Down Expand Up @@ -32,11 +32,11 @@ impl PublicContext {
l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1
}

fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {
pub fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {
nullifier_exists(unsiloed_nullifier, address.to_field()) == 1
}

fn consume_l1_to_l2_message(
pub fn consume_l1_to_l2_message(
&mut self,
content: Field,
secret: Field,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl PublicContext {
self.push_nullifier(nullifier);
}

fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {
pub fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {
send_l2_to_l1_msg(recipient, content);
}

Expand Down Expand Up @@ -108,45 +108,45 @@ impl PublicContext {
result_data
}

fn push_note_hash(_self: &mut Self, note_hash: Field) {
pub fn push_note_hash(_self: &mut Self, note_hash: Field) {
emit_note_hash(note_hash);
}
fn push_nullifier(_self: &mut Self, nullifier: Field) {
pub fn push_nullifier(_self: &mut Self, nullifier: Field) {
emit_nullifier(nullifier);
}

fn this_address(_self: Self) -> AztecAddress {
pub fn this_address(_self: Self) -> AztecAddress {
address()
}
fn msg_sender(_self: Self) -> AztecAddress {
pub fn msg_sender(_self: Self) -> AztecAddress {
sender()
}
fn selector(_self: Self) -> FunctionSelector {
pub fn selector(_self: Self) -> FunctionSelector {
// The selector is the first element of the calldata when calling a public function through dispatch.
let raw_selector: [Field; 1] = calldata_copy(0, 1);
FunctionSelector::from_field(raw_selector[0])
}
fn get_args_hash(mut self) -> Field {
pub fn get_args_hash(mut self) -> Field {
if !self.args_hash.is_some() {
self.args_hash = Option::some((self.compute_args_hash)());
}

self.args_hash.unwrap_unchecked()
}
fn transaction_fee(_self: Self) -> Field {
pub fn transaction_fee(_self: Self) -> Field {
transaction_fee()
}

fn chain_id(_self: Self) -> Field {
pub fn chain_id(_self: Self) -> Field {
chain_id()
}
fn version(_self: Self) -> Field {
pub fn version(_self: Self) -> Field {
version()
}
fn block_number(_self: Self) -> Field {
pub fn block_number(_self: Self) -> Field {
block_number()
}
fn timestamp(_self: Self) -> u64 {
pub fn timestamp(_self: Self) -> u64 {
timestamp()
}
pub fn fee_per_l2_gas(_self: Self) -> Field {
Expand All @@ -156,38 +156,38 @@ impl PublicContext {
fee_per_da_gas()
}

fn l2_gas_left(_self: Self) -> Field {
pub fn l2_gas_left(_self: Self) -> Field {
l2_gas_left()
}
fn da_gas_left(_self: Self) -> Field {
pub fn da_gas_left(_self: Self) -> Field {
da_gas_left()
}
fn is_static_call(_self: Self) -> bool {
pub fn is_static_call(_self: Self) -> bool {
is_static_call() == 1
}

fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {
pub fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {
let mut out = [0; N];
for i in 0..N {
out[i] = storage_read(storage_slot + i as Field);
}
out
}

fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T
pub fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T
where
T: Deserialize<N>,
{
T::deserialize(self.raw_storage_read(storage_slot))
}

fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {
pub fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {
for i in 0..N {
storage_write(storage_slot + i as Field, values[i]);
}
}

fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T)
pub fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T)
where
T: Serialize<N>,
{
Expand Down
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
@@ -1,7 +1,7 @@
use dep::protocol_types::{
address::AztecAddress,
point::Point,
public_keys::{IvpkM, PublicKeys, ToPoint},
public_keys::{IvpkM, ToPoint},
scalar::Scalar,
};

Expand Down
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/mod.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod header;
mod payload;
mod encrypted_note_emission;
mod encrypted_event_emission;
pub mod header;
pub mod payload;
pub mod encrypted_note_emission;
pub mod encrypted_event_emission;
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
@@ -1,7 +1,7 @@
use dep::protocol_types::{
address::AztecAddress,
constants::{GENERATOR_INDEX__SYMMETRIC_KEY, PRIVATE_LOG_SIZE_IN_BYTES},
hash::{poseidon2_hash, poseidon2_hash_with_separator},
hash::poseidon2_hash_with_separator,
point::Point,
public_keys::{AddressPoint, OvpkM},
scalar::Scalar,
Expand Down
12 changes: 6 additions & 6 deletions noir-projects/aztec-nr/aztec/src/generators.nr
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
use dep::protocol_types::point::Point;

// A set of generators generated with `derive_generators(...)` function from noir::std
global Ga1 = Point {
pub global Ga1 = Point {
x: 0x30426e64aee30e998c13c8ceecda3a77807dbead52bc2f3bf0eae851b4b710c1,
y: 0x113156a068f603023240c96b4da5474667db3b8711c521c748212a15bc034ea6,
is_infinite: false,
};
global Ga2 = Point {
pub global Ga2 = Point {
x: 0x2825c79cc6a5cbbeef7d6a8f1b6a12b312aa338440aefeb4396148c89147c049,
y: 0x129bfd1da54b7062d6b544e7e36b90736350f6fba01228c41c72099509f5701e,
is_infinite: false,
};
global Ga3 = Point {
pub global Ga3 = Point {
x: 0x0edb1e293c3ce91bfc04e3ceaa50d2c541fa9d091c72eb403efb1cfa2cb3357f,
y: 0x1341d675fa030ece3113ad53ca34fd13b19b6e9762046734f414824c4d6ade35,
is_infinite: false,
};
global Ga4 = Point {
pub global Ga4 = Point {
x: 0x0e0dad2250583f2a9f0acb04ededf1701b85b0393cae753fe7e14b88af81cb52,
y: 0x0973b02c5caac339ee4ad5dab51329920f7bf1b6a07e1dabe5df67040b300962,
is_infinite: false,
};
global Ga5 = Point {
pub global Ga5 = Point {
x: 0x2f3342e900e8c488a28931aae68970738fdc68afde2910de7b320c00c902087d,
y: 0x1bf958dc63cb09d59230603a0269ae86d6f92494da244910351f1132df20fc08,
is_infinite: false,
};
// If you change this update `G_SLOT` in `yarn-project/simulator/src/client/test_utils.ts` as well
global G_slot = Point {
pub global G_slot = Point {
x: 0x041223147b680850dc82e8a55a952d4df20256fe0593d949a9541ca00f0abf15,
y: 0x0a8c72e60d0e60f5d804549d48f3044d06140b98ed717a9b532af630c1530791,
is_infinite: false,
Expand Down
16 changes: 6 additions & 10 deletions noir-projects/aztec-nr/aztec/src/keys/constants.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ use dep::protocol_types::constants::{
GENERATOR_INDEX__TSK_M,
};

// Note: In fetch_key_from_registry we expect that the shared mutable slot is index * 2 + 1 for the x coordinate and
// index * 2 + 2 for the y coordinate. For example, the npk_m x coordinates will be stored in a map at storage slot
// 0 * 2 + 1 = 1, and the npk_m y coordinates at 2 * 2 + 2 = 6. If this changes the function will need to be
// refactored.
global NULLIFIER_INDEX = 0;
global INCOMING_INDEX = 1;
global OUTGOING_INDEX = 2;
global TAGGING_INDEX = 3;
pub global NULLIFIER_INDEX = 0;
pub global INCOMING_INDEX = 1;
pub global OUTGOING_INDEX = 2;
pub global TAGGING_INDEX = 3;

global NUM_KEY_TYPES = 4;
pub global NUM_KEY_TYPES = 4;

global sk_generators = [
pub global sk_generators = [
GENERATOR_INDEX__NSK_M as Field,
GENERATOR_INDEX__IVSK_M as Field,
GENERATOR_INDEX__OVSK_M as Field,
Expand Down
6 changes: 3 additions & 3 deletions noir-projects/aztec-nr/aztec/src/keys/mod.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod constants;
mod getters;
mod point_to_symmetric_key;
pub mod constants;
pub mod getters;
pub mod point_to_symmetric_key;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
meta::{type_of, unquote},
};

comptime mut global STUBS: UHashMap<Module, [Quoted], BuildHasherDefault<Poseidon2Hasher>> =
pub comptime mut global STUBS: UHashMap<Module, [Quoted], BuildHasherDefault<Poseidon2Hasher>> =
UHashMap::default();

pub(crate) comptime fn create_fn_abi_export(f: FunctionDefinition) -> Quoted {
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/functions/mod.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod interfaces;
pub mod interfaces;

use super::utils::{
add_to_hasher, fn_has_noinitcheck, get_fn_visibility, is_fn_initializer, is_fn_internal,
Expand Down
12 changes: 6 additions & 6 deletions noir-projects/aztec-nr/aztec/src/macros/mod.nr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod dispatch;
mod functions;
mod utils;
mod notes;
mod storage;
mod events;
pub mod dispatch;
pub mod functions;
pub mod utils;
pub mod notes;
pub mod storage;
pub mod events;

use functions::interfaces::STUBS;
use notes::{generate_note_export, NOTES};
Expand Down
Loading

0 comments on commit ddba505

Please sign in to comment.