Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixer mixer shmixer #8

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions address-note/src/address_note.nr
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ impl NullifiableNote for AddressNote {

impl AddressNote {
pub fn new(address: AztecAddress, owner: AztecAddress) -> Self {
// We use the randomness to preserve the privacy of the note recipient by preventing brute-forcing, so a
// We use randomness to preserve the privacy of the note recipient by preventing brute-forcing, so a
// malicious sender could use non-random values to make the note less private. But they already know the full
// note pre-image anyway, and so the recipient already trusts them to not disclose this information. We can
// note pre-image anyway, so the recipient trusts them not to disclose this information. We can
// therefore assume that the sender will cooperate in the random value generation.
let randomness = unsafe { random() };
AddressNote { address, owner, randomness, header: NoteHeader::empty() }
Expand Down
12 changes: 6 additions & 6 deletions authwit/src/auth.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dep::aztec::protocol_types::{
};

/**
* Authenticaion witness helper library
* Authentication witness helper library
*
* Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties
* (e.g. protocols or other users) to execute an action on their behalf.
Expand Down Expand Up @@ -75,7 +75,7 @@ use dep::aztec::protocol_types::{
* To ensure that the same "approval" cannot be used multiple times, we also compute a `nullifier` for the
* authentication witness, and emit it from the `Token` contract (consumer).
*
* Note that we can do this flow as we are in private were we can do oracle calls out from contracts.
* Note that we can do this flow as we are in private where we can do oracle calls out from contracts.
*
*
* Person Contract Contract Contract
Expand Down Expand Up @@ -186,7 +186,7 @@ use dep::aztec::protocol_types::{
* consumption is done in the same transaction, then we will be able to squash the updates (only final tx state diff is posted to DA), and now it is cheaper.
*
* Q: Why is the chain id and the version part of the message hash?
* A: The chain id and the version is part of the message hash to ensure that the message is only valid on a specific
* A: The chain id and the version are part of the message hash to ensure that the message is only valid on a specific
* chain to avoid a case where the same message could be used across multiple chains.
*/

Expand Down Expand Up @@ -235,7 +235,7 @@ pub fn assert_inner_hash_valid_authwit(
.unpack_into();
assert(result == IS_VALID_SELECTOR, "Message not authorized by account");
// Compute the nullifier, similar computation to the outer hash, but without the chain_id and version.
// Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors.
// Those should already be handled in the verification, so we just need something to nullify, that allows the same inner_hash for multiple actors.
let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash);
context.push_nullifier(nullifier);
}
Expand Down Expand Up @@ -294,8 +294,8 @@ pub unconstrained fn assert_inner_hash_valid_authwit_public(
/**
* Compute the `message_hash` from a function call to be used by an authentication witness
*
* Useful for when you need a non-account contract to approve during execution. For example if you need a contract
* to make a call to nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow
* Useful for when you need a non-account contract to approve during execution. For example, if you need a contract
* to make a call to a nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow
* B to transfer T on its behalf.
*
* @param caller The address of the contract that is calling the function, in the example above, this would be B
Expand Down
2 changes: 1 addition & 1 deletion authwit/src/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
let inner_hash =
compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);
let message_hash = compute_authwit_message_hash(target, chain_id, version, inner_hash);
let mut context = PublicContext::new(|| panic(f"Provide args hash manually"));
let mut context = PublicContext::new(|| panic("Provide args hash manually"));
context.args_hash = Option::some(args_hash);
set_authorized(&mut context, message_hash, true);
cheatcodes::set_contract_address(current_contract);
Expand Down
2 changes: 1 addition & 1 deletion aztec/src/macros/functions/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ comptime fn create_view_check(f: FunctionDefinition) -> Quoted {
/// An initializer function is similar to a constructor:
/// - it can only be called once
/// - if there are multiple initializer functions, only one of them can be called
/// - no non-initializer functions can be called until an initializer has ben called (except `noinitcheck` functions)
/// - no non-initializer functions can be called until an initializer has been called (except `noinitcheck` functions)
pub comptime fn initializer(_f: FunctionDefinition) {
// Marker attribute
}
Expand Down
2 changes: 1 addition & 1 deletion aztec/src/macros/storage/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub comptime mut global STORAGE_LAYOUT_NAME: UHashMap<Module, Quoted, BuildHashe

/// Marks a struct as the one describing the storage layout of a contract. Only a single struct in the entire contract
/// should have this macro (or `storage_no_init`) applied to it.
/// The contract's storage is accessed via the `storage` variable, which will will automatically be made available in
/// The contract's storage is accessed via the `storage` variable, which will automatically be made available in
/// all functions as an instance of the struct this macro was applied to.
pub comptime fn storage(s: StructDefinition) -> Quoted {
// This macro performs three things:
Expand Down
2 changes: 1 addition & 1 deletion aztec/src/macros/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ trait AsStrQuote {
}

impl<let N: u32, Env> AsStrQuote for Quoted {
// Used to convert an arbirary quoted type into a quoted string, removing whitespace between tokens
// Used to convert an arbitrary quoted type into a quoted string, removing whitespace between tokens
comptime fn as_str_quote(self) -> Quoted {
let tokens = self.tokens();
let mut acc: [u8] = &[];
Expand Down
4 changes: 2 additions & 2 deletions aztec/src/note/lifecycle.nr
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ where
} else {
// A non-zero note hash counter implies that we're nullifying a pending note (i.e. one that has not yet been
// persisted in the trees and is instead in the pending new note hashes array). In such a case we populate its
// hash with real value to inform the kernel which note we're nullifyng so that it can either squash both
// the note and the nullifier if it's an inner note hash, or check that the it matches a pending note if it's
// hash with real value to inform the kernel which note we're nullifying so that it can either squash both
// the note and the nullifier if it's an inner note hash, or check that it matches a pending note if it's
// a siloed note hash.
note_hash_for_nullify
};
Expand Down
4 changes: 2 additions & 2 deletions aztec/src/state_vars/private_set.nr
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
}

/// Note that if you obtained the note via `get_notes` it's much better to use `pop_notes` as `pop_notes` results
/// in significantly less constrains due to avoiding an extra hash and read request check.
/// in significantly less constraints due to avoiding an extra hash and read request check.
pub fn remove(self, note: Note) {
let note_hash = compute_note_hash_for_read_request(note);
let has_been_read =
Expand All @@ -93,7 +93,7 @@ where
}

/// Note that if you later on remove the note it's much better to use `pop_notes` as `pop_notes` results
/// in significantly less constrains due to avoiding 1 read request check.
/// in significantly less constraints due to avoiding 1 read request check.
pub fn get_notes<PREPROCESSOR_ARGS, FILTER_ARGS>(
self,
options: NoteGetterOptions<Note, N, PREPROCESSOR_ARGS, FILTER_ARGS>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<let INITIAL_DELAY: u32> ScheduledDelayChange<INITIAL_DELAY> {
// When changing the delay value we must ensure that it is not possible to produce a value change with a delay
// shorter than the current one.
let blocks_until_change = if new > current {
// Increasing the delay value can therefore be done immediately: this does not invalidate prior contraints
// Increasing the delay value can therefore be done immediately: this does not invalidate prior constraints
// about how quickly a value might be changed (indeed it strengthens them).
0
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ unconstrained fn test_schedule_change_to_shorter_delay_after_change() {
let mut delay_change = get_non_initial_delay_change(pre, post, block_of_change);
delay_change.schedule_change(new, current_block_number);

// The schedule time is determined by the different between the current value (ex post, now pre) and new delay.
// The schedule time is determined by the difference between the current value (ex post, now pre) and new delay.
assert_eq(delay_change.pre.unwrap(), post);
assert_eq(delay_change.post.unwrap(), new);
assert_eq(delay_change.block_of_change, current_block_number + post - new);
Expand Down
2 changes: 1 addition & 1 deletion aztec/src/state_vars/shared_mutable/test.nr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ unconstrained fn in_private(
unconstrained fn in_unconstrained(
env: TestEnvironment,
) -> SharedMutable<Field, TEST_INITIAL_DELAY, UnconstrainedContext> {
SharedMutable::new(env.unkonstrained(), storage_slot)
SharedMutable::new(env.unconstrained(), storage_slot)
}

#[test]
Expand Down