Skip to content
Merged
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
7 changes: 5 additions & 2 deletions avm-transpiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ library Constants {
uint256 internal constant DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE =
0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631;
uint256 internal constant DEPLOYER_CONTRACT_ADDRESS =
0x0ccb2a7150ed29533f211e223f98450cf4769ff8938e9d4ad303f71c5e302600;
0x12bcd3e09e8d8559c75d59552db47471f63c72fbbc9decb59c517b4e58634a72;
uint256 internal constant L1_TO_L2_MESSAGE_ORACLE_CALL_LENGTH = 17;
uint256 internal constant MAX_NOTE_FIELDS_LENGTH = 20;
uint256 internal constant GET_NOTE_ORACLE_RETURN_LENGTH = 23;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl<Note> PrivateImmutable<Note> {

// docs:start:view_note
unconstrained pub fn view_note<N>(self) -> Note where Note: NoteInterface<N> {
let options = NoteViewerOptions::new().set_limit(1);
view_notes(self.storage_slot, options)[0].unwrap()
let mut options = NoteViewerOptions::new();
view_notes(self.storage_slot, options.set_limit(1))[0].unwrap()
}
// docs:end:view_note
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<Note> PrivateMutable<Note> {
// docs:start:replace
pub fn replace<N>(self, new_note: &mut Note, broadcast: bool) where Note: NoteInterface<N> {
let context = self.context.unwrap();
let prev_note = get_note(context, self.storage_slot);
let prev_note: Note = get_note(context, self.storage_slot);

// Nullify previous note.
destroy_note(context, prev_note);
Expand Down Expand Up @@ -90,8 +90,8 @@ impl<Note> PrivateMutable<Note> {

// docs:start:view_note
unconstrained pub fn view_note<N>(self) -> Note where Note: NoteInterface<N> {
let options = NoteViewerOptions::new().set_limit(1);
view_notes(self.storage_slot, options)[0].unwrap()
let mut options = NoteViewerOptions::new();
view_notes(self.storage_slot, options.set_limit(1))[0].unwrap()
}
// docs:end:view_note
}
6 changes: 4 additions & 2 deletions noir-projects/aztec-nr/tests/src/note_getter_test.nr
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ fn invalid_selector() {

let storage_slot: Field = 0;

let mut options = NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options = options.select(
PropertySelector { index: 0, offset: 0, length: 32 },
10,
Option::some(Comparator.EQ)
Expand All @@ -97,7 +98,8 @@ fn invalid_note_order() {

let storage_slot: Field = 0;

let mut options = NoteGetterOptions::new().sort(
let mut options = NoteGetterOptions::new();
options = options.sort(
PropertySelector { index: 0, offset: 0, length: 32 },
SortOrder.DESC
);
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/value-note/src/balance_utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ unconstrained pub fn get_balance(set: PrivateSet<ValueNote>) -> Field {
unconstrained pub fn get_balance_with_offset(set: PrivateSet<ValueNote>, offset: u32) -> Field {
let mut balance = 0;
// docs:start:view_notes
let options = NoteViewerOptions::new().set_offset(offset);
let opt_notes = set.view_notes(options);
let mut options = NoteViewerOptions::new();
let opt_notes = set.view_notes(options.set_offset(offset));
// docs:end:view_notes
let len = opt_notes.len();
for i in 0..len {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ contract Benchmarking {
#[aztec(private)]
fn recreate_note(owner: AztecAddress, index: u32) {
let owner_notes = storage.notes.at(owner);
let getter_options = NoteGetterOptions::new().set_limit(1).set_offset(index);
let notes = owner_notes.get_notes(getter_options);
let mut getter_options = NoteGetterOptions::new();
let notes = owner_notes.get_notes(getter_options.set_limit(1).set_offset(index));
let note = notes[0].unwrap_unchecked();
owner_notes.remove(note);
increment(owner_notes, note.value, owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ impl Deck {
}

unconstrained pub fn view_cards(self, offset: u32) -> [Option<Card>; MAX_NOTES_PER_PAGE] {
let options = NoteViewerOptions::new().set_offset(offset);
let opt_notes = self.set.view_notes(options);
let mut options = NoteViewerOptions::new();
let opt_notes = self.set.view_notes(options.set_offset(offset));
let mut opt_cards = [Option::none(); MAX_NOTES_PER_PAGE];

for i in 0..opt_notes.len() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use dep::aztec::protocol_types::{address::AztecAddress, traits::{Serialize, Deserialize}};
use crate::cards::Card;

global NUMBER_OF_PLAYERS = 2;
global NUMBER_OF_CARDS_DECK = 2;
global NUMBER_OF_PLAYERS: u64 = 2;
global NUMBER_OF_CARDS_DECK: u64 = 2;

struct PlayerEntry {
address: AztecAddress,
Expand Down Expand Up @@ -40,8 +40,8 @@ struct Game {
started: bool,
finished: bool,
claimed: bool,
current_player: u32,
current_round: u32,
current_player: u64,
current_round: u64,
}

global GAME_SERIALIZED_LEN: Field = 15;
Expand Down Expand Up @@ -84,8 +84,8 @@ impl Deserialize<GAME_SERIALIZED_LEN> for Game {
started: fields[10] as bool,
finished: fields[11] as bool,
claimed: fields[12] as bool,
current_player: fields[13] as u32,
current_round: fields[14] as u32
current_player: fields[13] as u64,
current_round: fields[14] as u64
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ contract Child {

#[aztec(private)]
fn private_get_value(amount: Field, owner: AztecAddress) -> Field {
let options = NoteGetterOptions::new().select(ValueNote::properties().value, amount, Option::none()).select(
let mut options = NoteGetterOptions::new();
options = options.select(ValueNote::properties().value, amount, Option::none()).select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ contract DelegatedOn {
}

unconstrained fn view_private_value(amount: Field, owner: AztecAddress) -> pub Field {
let options = NoteViewerOptions::new().select(ValueNote::properties().value, amount, Option::none()).select(
let mut options = NoteViewerOptions::new();
options = options.select(ValueNote::properties().value, amount, Option::none()).select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ contract Delegator {
}

unconstrained fn view_private_value(amount: Field, owner: AztecAddress) -> pub Field {
let options = NoteViewerOptions::new().select(ValueNote::properties().value, amount, Option::none()).select(
let mut options = NoteViewerOptions::new();
options = options.select(ValueNote::properties().value, amount, Option::none()).select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,14 @@ contract DocsExample {

// docs:start:state_vars-NoteGetterOptionsComparatorExampleNoir
unconstrained fn read_note(amount: Field, comparator: u8) -> pub [Option<CardNote>; 10] {
let options = NoteViewerOptions::new().select(
CardNote::properties().points,
amount,
Option::some(comparator)
let mut options = NoteViewerOptions::new();
let notes = storage.set.view_notes(
options.select(
CardNote::properties().points,
amount,
Option::some(comparator)
)
);
let notes = storage.set.view_notes(options);

notes
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pub fn create_account_card_getter_options(
account: AztecAddress,
offset: u32
) -> NoteGetterOptions<CardNote, CARD_NOTE_LEN, Field> {
NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options.select(
CardNote::properties().owner,
account.to_field(),
Option::none()
Expand All @@ -25,7 +26,8 @@ pub fn create_exact_card_getter_options(
secret: Field,
account: AztecAddress
) -> NoteGetterOptions<CardNote, CARD_NOTE_LEN, Field> {
NoteGetterOptions::new().select(CardNote::properties().points, points as Field, Option::none()).select(CardNote::properties().randomness, secret, Option::none()).select(
let mut options = NoteGetterOptions::new();
options.select(CardNote::properties().points, points as Field, Option::none()).select(CardNote::properties().randomness, secret, Option::none()).select(
CardNote::properties().owner,
account.to_field(),
Option::none()
Expand Down Expand Up @@ -62,7 +64,8 @@ pub fn create_account_cards_with_min_points_getter_options(account: AztecAddress

// docs:start:state_vars-NoteGetterOptionsPickOne
pub fn create_largest_account_card_getter_options(account: AztecAddress) -> NoteGetterOptions<CardNote, CARD_NOTE_LEN, Field> {
NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options.select(
CardNote::properties().owner,
account.to_field(),
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ contract InclusionProofs {
// docs:start:get_note_from_pxe
// 1) Get the note from PXE.
let private_values = storage.private_values.at(owner);
let mut options = NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options = options.select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down Expand Up @@ -109,7 +110,8 @@ contract InclusionProofs {
) {
// 2) Get the note from PXE
let private_values = storage.private_values.at(owner);
let mut options = NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options = options.select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down Expand Up @@ -139,7 +141,8 @@ contract InclusionProofs {
) {
// 1) Get the note from PXE.
let private_values = storage.private_values.at(owner);
let mut options = NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options = options.select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand All @@ -164,7 +167,8 @@ contract InclusionProofs {
#[aztec(private)]
fn nullify_note(owner: AztecAddress) {
let private_values = storage.private_values.at(owner);
let options = NoteGetterOptions::new().select(
let mut options = NoteGetterOptions::new();
options = options.select(
ValueNote::properties().owner,
owner.to_field(),
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ contract PendingNoteHashes {
fn get_then_nullify_note(expected_value: Field, owner: AztecAddress) -> Field {
let owner_balance = storage.balances.at(owner);

let options = NoteGetterOptions::new().set_limit(1);
let mut options = NoteGetterOptions::new();
options = options.set_limit(1);
let note = owner_balance.get_notes(options)[0].unwrap();

assert(expected_value == note.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ contract Test {
fn consume_note_from_secret(secret: Field) {
let notes_set = storage.example_set;
let secret_hash = compute_secret_hash(secret);
let options = NoteGetterOptions::new().select(FieldNote::properties().value, secret_hash, Option::none()).set_limit(1);
let mut options = NoteGetterOptions::new();
options = options.select(FieldNote::properties().value, secret_hash, Option::none()).set_limit(1);
let notes = notes_set.get_notes(options);
let note = notes[0].unwrap_unchecked();
notes_set.remove(note);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ contract TokenBlacklist {
let secret_hash = compute_secret_hash(secret);
// Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash
// stored in field with index 1 (select(1, secret_hash)).
let options = NoteGetterOptions::new().select(TransparentNote::properties().amount, amount, Option::none()).select(
let mut options = NoteGetterOptions::new();
options = options.select(TransparentNote::properties().amount, amount, Option::none()).select(
TransparentNote::properties().secret_hash,
secret_hash,
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ impl<T> BalancesMap<T> {
) -> U128 where T: NoteInterface<T_SERIALIZED_LEN> + OwnedNote {
let mut balance = U128::from_integer(0);
// docs:start:view_notes
let options = NoteViewerOptions::new().set_offset(offset);
let opt_notes = self.map.at(owner).view_notes(options);
let mut options = NoteViewerOptions::new();
let opt_notes = self.map.at(owner).view_notes(options.set_offset(offset));
// docs:end:view_notes
let len = opt_notes.len();
for i in 0..len {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ contract Token {
let secret_hash = compute_secret_hash(secret);
// Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash
// stored in field with index 1 (select(1, secret_hash)).
let options = NoteGetterOptions::new().select(TransparentNote::properties().amount, amount, Option::none()).select(
let mut options = NoteGetterOptions::new();
options = options.select(TransparentNote::properties().amount, amount, Option::none()).select(
TransparentNote::properties().secret_hash,
secret_hash,
Option::none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl<T> BalancesMap<T> {
) -> U128 where T: NoteInterface<T_SERIALIZED_LEN> + OwnedNote {
let mut balance = U128::from_integer(0);
// docs:start:view_notes
let options = NoteViewerOptions::new().set_offset(offset);
let opt_notes = self.map.at(owner).view_notes(options);
let mut options = NoteViewerOptions::new();
let opt_notes = self.map.at(owner).view_notes(options.set_offset(offset));
// docs:end:view_notes
let len = opt_notes.len();
for i in 0..len {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ global REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE = 0xe7af8166354
// CONTRACT INSTANCE CONSTANTS
// sha224sum 'struct ContractInstanceDeployed'
global DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE = 0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631;
global DEPLOYER_CONTRACT_ADDRESS = 0x0ccb2a7150ed29533f211e223f98450cf4769ff8938e9d4ad303f71c5e302600;
global DEPLOYER_CONTRACT_ADDRESS = 0x12bcd3e09e8d8559c75d59552db47471f63c72fbbc9decb59c517b4e58634a72;

// NOIR CONSTANTS - constants used only in yarn-packages/noir-contracts
// Some are defined here because Noir doesn't yet support globals referencing other globals yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn assert_sorted_array<T, N, Env>(

#[test]
fn smoke_validate_array() {
let valid_array = [];
let valid_array: [Field; 0] = [];
validate_array(valid_array);

let valid_array = [0];
Expand Down Expand Up @@ -164,7 +164,8 @@ fn smoke_validate_array_invalid_case2() {

#[test]
fn test_empty_array_length() {
assert_eq(array_length([]), 0);
let empty_array: [Field; 0] = [];
assert_eq(array_length(empty_array), 0);
assert_eq(array_length([0]), 0);
assert_eq(array_length([0, 0, 0]), 0);
}
Expand Down
1 change: 1 addition & 0 deletions noir/Dockerfile.packages
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ENV COMMIT_HASH=${COMMIT_HASH}

WORKDIR /usr/src/noir
COPY . .

RUN ./scripts/bootstrap_packages.sh

FROM scratch
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/.envrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if [[ -z "${SKIP_NIX:-}" ]] && has nix; then
use nix
fi

fi
fi
1 change: 0 additions & 1 deletion noir/noir-repo/.github/Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
passthrough = [
"HOME",
"RUST_BACKTRACE",
"BARRETENBERG_BIN_DIR"
]
volumes = [
"HOME",
Expand Down
1 change: 1 addition & 0 deletions noir/noir-repo/.github/scripts/acvm_js-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -eu

.github/scripts/wasm-bindgen-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/acvm_js build
1 change: 1 addition & 0 deletions noir/noir-repo/.github/scripts/noir-wasm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
set -eu

.github/scripts/wasm-pack-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/types build
yarn workspace @noir-lang/noir_wasm build
Loading