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
87 changes: 69 additions & 18 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 avm-transpiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
acvm = { path = "../noir/noir-repo/acvm-repo/acvm", features = ["bn254"] }
noirc_errors = { path = "../noir/noir-repo/compiler/noirc_errors" }
noirc_abi = { path = "../noir/noir-repo/tooling/noirc_abi" }
noirc_evaluator = { path = "../noir/noir-repo/compiler/noirc_evaluator" }
noirc_evaluator = { path = "../noir/noir-repo/compiler/noirc_evaluator", features = ["bn254"] }

# external
base64 = "0.21"
Expand Down
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/aztec/src/macros/notes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ comptime fn generate_note_properties(s: TypeDefinition) -> Quoted {
let note_fields = s.fields_as_written();

let properties_types = note_fields
.map(|(name, _): (Quoted, Type)| quote { pub $name: $property_selector_type })
.map(|(name, _, _)| quote { pub $name: $property_selector_type })
.join(quote {,});

// TODO #8694: Properly handle non-field types https://github.com/AztecProtocol/aztec-packages/issues/8694
let mut properties_list = &[];
for i in 0..note_fields.len() {
let (name, _) = note_fields[i];
let (name, _, _) = note_fields[i];
properties_list = properties_list.push_back(
quote { $name: aztec::note::note_getter_options::PropertySelector { index: $i, offset: 0, length: 32 } },
);
Expand Down Expand Up @@ -276,7 +276,7 @@ comptime fn index_note_fields(
let mut indexed_nullable_fields = &[];
let mut counter: u32 = 0;
for field in s.fields_as_written() {
let (name, typ) = field;
let (name, typ, _) = field;
if nullable_fields.all(|field| field != name) {
indexed_fixed_fields = indexed_fixed_fields.push_back((name, typ, counter));
} else {
Expand Down Expand Up @@ -393,7 +393,7 @@ comptime fn assert_has_owner(note: TypeDefinition) {
let fields = note.fields_as_written();
let mut has_owner = false;
for i in 0..fields.len() {
let (field_name, _) = fields[i];
let (field_name, _, _) = fields[i];
if field_name == quote { owner } {
has_owner = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/storage.nr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub comptime fn storage(s: TypeDefinition) -> Quoted {
//let context_generic = s.add_generic("Context");
for field in s.fields_as_written() {
// FIXME: This doesn't handle field types with generics
let (name, typ) = field;
let (name, typ, _) = field;
let (storage_field_constructor, storage_size) =
generate_storage_field_constructor(typ, quote { $slot });
storage_vars_constructors =
Expand Down
11 changes: 4 additions & 7 deletions noir-projects/aztec-nr/aztec/src/macros/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ comptime fn signature_of_type(typ: Type) -> Quoted {
f"[{element_typ_quote};{array_len}]".quoted_contents()
} else if typ.as_data_type().is_some() {
let (s, generics) = typ.as_data_type().unwrap();
let field_signatures = s
.fields(generics)
.map(|(_, typ): (Quoted, Type)| signature_of_type(typ))
.join(quote {,});
let field_signatures =
s.fields(generics).map(|(_, typ, _)| signature_of_type(typ)).join(quote {,});
f"({field_signatures})".quoted_contents()
} else if typ.as_tuple().is_some() {
// Note that tuples are handled the same way as structs
Expand Down Expand Up @@ -196,8 +194,7 @@ pub(crate) comptime fn compute_fn_selector(f: FunctionDefinition) -> Field {
//
// The signature will be "foo(Field,AztecAddress)".
let fn_name = f.name();
let args_signatures =
f.parameters().map(|(_, typ): (Quoted, Type)| signature_of_type(typ)).join(quote {,});
let args_signatures = f.parameters().map(|(_, typ)| signature_of_type(typ)).join(quote {,});
let signature_quote = quote { $fn_name($args_signatures) };
let (signature_str_quote, _) = signature_quote.as_str_quote();

Expand All @@ -220,7 +217,7 @@ pub(crate) comptime fn compute_event_selector(s: TypeDefinition) -> Field {
let event_name = s.name();
let args_signatures = s
.fields_as_written()
.map(|(_, typ): (Quoted, Type)| {
.map(|(_, typ, _)| {
// signature_of_type can handle structs, so this supports nested structs
// FIXME: Field generics are not handled here!
signature_of_type(typ)
Expand Down
8 changes: 4 additions & 4 deletions noir-projects/noir-protocol-circuits/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function compile {
local program_hash hash bytecode_hash vk vk_fields

# We get the monomorphized program hash from nargo. If this changes, we have to recompile.
local program_hash_cmd="$NARGO check --package $name --silence-warnings --show-program-hash | cut -d' ' -f2"
local program_hash_cmd="ALLOW_EMPTY_INPUT=1 $NARGO check --package $name --silence-warnings --show-program-hash | cut -d' ' -f2"
# echo_stderr $program_hash_cmd
program_hash=$(dump_fail "$program_hash_cmd")
echo_stderr "Hash preimage: $NOIR_HASH-$program_hash"
Expand All @@ -53,7 +53,7 @@ function compile {
SECONDS=0
rm -f $json_path
# TODO(#10754): Remove --skip-brillig-constraints-check
local compile_cmd="$NARGO compile --package $name --skip-brillig-constraints-check"
local compile_cmd="ALLOW_EMPTY_INPUT=1 $NARGO compile --package $name --skip-brillig-constraints-check"
echo_stderr "$compile_cmd"
dump_fail "$compile_cmd"
echo_stderr "Compilation complete for: $name (${SECONDS}s)"
Expand Down Expand Up @@ -153,7 +153,7 @@ function build {
}

function test_cmds {
$NARGO test --list-tests --silence-warnings | sort | while read -r package test; do
ALLOW_EMPTY_INPUT=1 $NARGO test --list-tests --silence-warnings | sort | while read -r package test; do
echo "$circuits_hash noir-projects/scripts/run_test.sh noir-protocol-circuits $package $test"
done
# We don't blindly execute all circuits as some will have no `Prover.toml`.
Expand All @@ -171,7 +171,7 @@ function test_cmds {
"
nargo_root_rel=$(realpath --relative-to=$root $NARGO)
for circuit in $circuits_to_execute; do
echo "$circuits_hash $nargo_root_rel execute --program-dir noir-projects/noir-protocol-circuits/crates/$circuit --silence-warnings --pedantic-solving --skip-brillig-constraints-check"
echo "$circuits_hash ALLOW_EMPTY_INPUT=1 $nargo_root_rel execute --program-dir noir-projects/noir-protocol-circuits/crates/$circuit --silence-warnings --pedantic-solving --skip-brillig-constraints-check"
done
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,4 +934,16 @@ mod test {
unconstrained fn test_constants() {
assert(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL <= MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX);
}

#[test]
unconstrained fn test_grumpkin_point() {
assert_eq(
super::GRUMPKIN_ONE_X,
std::embedded_curve_ops::EmbeddedCurvePoint::generator().x,
);
assert_eq(
super::GRUMPKIN_ONE_Y,
std::embedded_curve_ops::EmbeddedCurvePoint::generator().y,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub comptime fn generate_deserialize_from_fields(

// Iterate over each field in the struct
for field in nested_def.fields(generics) {
let (field_name, field_type) = field;
let (field_name, field_type, _) = field;
// Recursively call `generate_deserialize_from_fields` for each field in the struct
let (deserialized_field, num_consumed_in_recursion) = generate_deserialize_from_fields(
field_name,
Expand Down Expand Up @@ -344,7 +344,7 @@ pub comptime fn generate_serialize_to_fields(
// For struct we pref
let nested_struct = typ.as_data_type().unwrap();
let params = nested_struct.0.fields(nested_struct.1);
let struct_flattened = params.map(|(param_name, param_type): (Quoted, Type)| {
let struct_flattened = params.map(|(param_name, param_type, _)| {
let maybe_prefixed_name = if name == quote {} {
// Triggered when the param name is of a value available in the current scope (e.g. a function
// argument) --> then we don't prefix the name with anything.
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo-ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2025-05-14
79fb4823b47d3ec06d8d26b1bbf03c52fedcd2fa
Loading