Skip to content

Commit

Permalink
feat: Sync from noir (#6941)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(elaborator): Lazily elaborate globals
(noir-lang/noir#5191)
chore: schnorr signature verification in noir
(noir-lang/noir#5188)
fix(experimental elaborator): Fix globals which use function calls
(noir-lang/noir#5172)
feat!: restrict noir word size to u32
(noir-lang/noir#5180)
chore: break out helper methods for writing foreign call results
(noir-lang/noir#5181)
fix: Fix panic in `get_global_let_statement`
(noir-lang/noir#5177)
fix(elaborator): Invert unconstrained check
(noir-lang/noir#5176)
chore: loosen trait bounds on impls depending on `AcirField`
(noir-lang/noir#5115)
feat: support casting in globals
(noir-lang/noir#5164)
chore(experimental elaborator): Handle `comptime` expressions in the
elaborator (noir-lang/noir#5169)
chore: avoid manual creation of contract artifact in wasm
(noir-lang/noir#5117)
chore: start moving lints into a separate linting directory
(noir-lang/noir#5165)
chore: move acir docs to code declaration
(noir-lang/noir#5040)
feat!: separate proving from `noir_js`
(noir-lang/noir#5072)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
  • Loading branch information
3 people committed Jun 7, 2024
1 parent b3f0ad3 commit 8dde7a3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl PrivateContext {
|n: NoteHash| n.counter == note_hash_counter
);
assert(
note_exists_index != MAX_NEW_NOTE_HASHES_PER_CALL, "Can only emit a note log for an existing note."
note_exists_index as u32 != MAX_NEW_NOTE_HASHES_PER_CALL, "Can only emit a note log for an existing note."
);

let counter = self.next_counter();
Expand Down
2 changes: 1 addition & 1 deletion aztec/src/encrypted_logs.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod header;
mod incoming_body;
mod outgoing_body;
mod payload;
mod payload;
1 change: 0 additions & 1 deletion aztec/src/encrypted_logs/payload.nr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ fn compute_ivpk_app(ivpk: GrumpkinPoint, contract_address: AztecAddress) -> Grum
// It is useless to compute this, it brings no value to derive fully.
// Issue(#6955)
ivpk

/*
// @todo Just setting infinite to false, but it should be checked.
// for example user could define ivpk = infinity using the registry
Expand Down
4 changes: 2 additions & 2 deletions aztec/src/oracle/get_public_data_witness.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dep::protocol_types::{
utils::arr_copy_slice
};

global LEAF_PREIMAGE_LENGTH: u64 = 4;
global LEAF_PREIMAGE_LENGTH: u32 = 4;
global PUBLIC_DATA_WITNESS: Field = 45;

struct PublicDataWitness {
Expand All @@ -23,7 +23,7 @@ unconstrained pub fn get_public_data_witness(block_number: u32, leaf_slot: Field
let fields = get_public_data_witness_oracle(block_number, leaf_slot);
PublicDataWitness {
index: fields[0],
leaf_preimage: PublicDataTreeLeafPreimage { slot: fields[1], value: fields[2], next_index: fields[3] as u64, next_slot: fields[4] },
leaf_preimage: PublicDataTreeLeafPreimage { slot: fields[1], value: fields[2], next_index: fields[3] as u32, next_slot: fields[4] },
path: arr_copy_slice(fields, [0; PUBLIC_DATA_TREE_HEIGHT], 1 + LEAF_PREIMAGE_LENGTH)
}
}
8 changes: 4 additions & 4 deletions aztec/src/oracle/notes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ unconstrained pub fn get_notes<Note, N, NB, M, S, NS>(
status,
placeholder_fields
);
let num_notes = fields[0] as u64;
let num_notes = fields[0] as u32;
let contract_address = AztecAddress::from_field(fields[1]);
for i in 0..placeholder_opt_notes.len() {
if i < num_notes {
// lengths named as per typescript.
let return_header_length: u64 = 2; // num_notes & contract_address.
let extra_preimage_length: u64 = 2; // nonce & note_hash_counter.
let read_offset: u64 = return_header_length + i * (N + extra_preimage_length);
let return_header_length: u32 = 2; // num_notes & contract_address.
let extra_preimage_length: u32 = 2; // nonce & note_hash_counter.
let read_offset: u32 = return_header_length + i * (N + extra_preimage_length);
let nonce = fields[read_offset];
let note_hash_counter = fields[read_offset + 1] as u32;
let header = NoteHeader { contract_address, nonce, storage_slot, note_hash_counter };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn test_serde() {

#[test]
fn test_serde_large_values() {
let max_u32 = (1 << 32) - 1;
let max_u32: u64 = (1 << 32) - 1;

let pre = max_u32 as u32;
let post = (max_u32 - 1) as u32;
Expand Down

0 comments on commit 8dde7a3

Please sign in to comment.