Skip to content

Commit

Permalink
chore: aztec sync
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jun 26, 2024
1 parent 7de19f5 commit 02c4cef
Show file tree
Hide file tree
Showing 20 changed files with 1,254 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12af650f0d27c37dca06bb329bf76a5574534d78
9be0ad6b41a69c35ad9737d60da7a16300b87642
69 changes: 63 additions & 6 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"tooling/noirc_abi",
"tooling/noirc_abi_wasm",
"tooling/acvm_cli",
"tooling/profiler",
# ACVM
"acvm-repo/acir_field",
"acvm-repo/acir",
Expand All @@ -34,7 +35,7 @@ members = [
# Utility crates
"utils/iter-extended",
]
default-members = ["tooling/nargo_cli", "tooling/acvm_cli"]
default-members = ["tooling/nargo_cli", "tooling/acvm_cli", "tooling/profiler"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -80,7 +81,7 @@ acvm_cli = { path = "tooling/acvm_cli" }
# Arkworks
ark-bn254 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
grumpkin = { version = "0.1.0", package = "noir_grumpkin", features = ["std"] }
grumpkin = { version = "0.1.0", package = "noir_grumpkin", features = ["std"] }
ark-ec = { version = "^0.4.0", default-features = false }
ark-ff = { version = "^0.4.0", default-features = false }
ark-std = { version = "^0.4.0", default-features = false }
Expand Down Expand Up @@ -139,6 +140,7 @@ similar-asserts = "1.5.0"
tempfile = "3.6.0"
jsonrpc = { version = "0.16.0", features = ["minreq_http"] }
flate2 = "1.0.24"
color-eyre = "0.6.2"
rand = "0.8.5"
proptest = "1.2.0"
proptest-derive = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion aztec_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ noirc_errors.workspace = true
iter-extended.workspace = true
convert_case = "0.6.0"
regex = "1.10"

tiny-keccak = { version = "2.0.0", features = ["keccak"] }
33 changes: 7 additions & 26 deletions aztec_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use transforms::{
contract_interface::{
generate_contract_interface, stub_function, update_fn_signatures_in_contract_interface,
},
events::{generate_selector_impl, transform_events},
events::{generate_event_impls, transform_event_abi},
functions::{
check_for_public_args, export_fn_abi, transform_function, transform_unconstrained,
},
Expand Down Expand Up @@ -65,19 +65,14 @@ fn transform(
// Usage -> mut ast -> aztec_library::transform(&mut ast)
// Covers all functions in the ast
for submodule in ast.submodules.iter_mut().filter(|submodule| submodule.is_contract) {
if transform_module(
crate_id,
&file_id,
context,
&mut submodule.contents,
submodule.name.0.contents.as_str(),
)
.map_err(|err| (err.into(), file_id))?
if transform_module(&file_id, &mut submodule.contents, submodule.name.0.contents.as_str())
.map_err(|err| (err.into(), file_id))?
{
check_for_aztec_dependency(crate_id, context)?;
}
}

generate_event_impls(&mut ast).map_err(|err| (err.into(), file_id))?;
generate_note_interface_impl(&mut ast).map_err(|err| (err.into(), file_id))?;

Ok(ast)
Expand All @@ -87,9 +82,7 @@ fn transform(
/// For annotated functions it calls the `transform` function which will perform the required transformations.
/// Returns true if an annotated node is found, false otherwise
fn transform_module(
crate_id: &CrateId,
file_id: &FileId,
context: &HirContext,
module: &mut SortedModule,
module_name: &str,
) -> Result<bool, AztecMacroError> {
Expand All @@ -106,19 +99,7 @@ fn transform_module(
if !check_for_storage_implementation(module, storage_struct_name) {
generate_storage_implementation(module, storage_struct_name)?;
}
// Make sure we're only generating the storage layout for the root crate
// In case we got a contract importing other contracts for their interface, we
// don't want to generate the storage layout for them
if crate_id == context.root_crate_id() {
generate_storage_layout(module, storage_struct_name.clone())?;
}
}

for structure in module.types.iter_mut() {
if structure.attributes.iter().any(|attr| is_custom_attribute(attr, "aztec(event)")) {
module.impls.push(generate_selector_impl(structure));
has_transformed_module = true;
}
generate_storage_layout(module, storage_struct_name.clone(), module_name)?;
}

let has_initializer = module.functions.iter().any(|func| {
Expand Down Expand Up @@ -219,7 +200,7 @@ fn transform_module(
});
}

generate_contract_interface(module, module_name, &stubs)?;
generate_contract_interface(module, module_name, &stubs, storage_defined)?;
}

Ok(has_transformed_module)
Expand All @@ -235,7 +216,7 @@ fn transform_hir(
context: &mut HirContext,
) -> Result<(), (AztecMacroError, FileId)> {
if has_aztec_dependency(crate_id, context) {
transform_events(crate_id, context)?;
transform_event_abi(crate_id, context)?;
inject_compute_note_hash_and_optionally_a_nullifier(crate_id, context)?;
assign_storage_slots(crate_id, context)?;
inject_note_exports(crate_id, context)?;
Expand Down
Loading

0 comments on commit 02c4cef

Please sign in to comment.