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

feat: Sync from noir #8466

Merged
merged 6 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3dab4dd771b7d8b9242ce3a9aeff5770f4d85cf6
d6f60d70dc41640ad84f7a968927b20818bcaf2a
103 changes: 6 additions & 97 deletions noir/noir-repo/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 noir/noir-repo/acvm-repo/acvm/tests/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ proptest! {
#[test]
fn keccak256_injective(inputs_distinct_inputs in any_distinct_inputs(Some(8), 0, 32)) {
let (inputs, distinct_inputs) = inputs_distinct_inputs;
let (result, message) = prop_assert_injective(inputs, distinct_inputs, 32, Some(32), keccak256_op);
let (result, message) = prop_assert_injective(inputs, distinct_inputs, 32, Some(8), keccak256_op);
prop_assert!(result, "{}", message);
}

Expand Down
10 changes: 8 additions & 2 deletions noir/noir-repo/aztec_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ 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) {
for submodule in
ast.submodules.iter_mut().map(|m| &mut m.item).filter(|submodule| submodule.is_contract)
{
if transform_module(
&file_id,
&mut submodule.contents,
Expand Down Expand Up @@ -111,7 +113,8 @@ fn transform_module(
}

let has_initializer = module.functions.iter().any(|func| {
func.def
func.item
.def
.attributes
.secondary
.iter()
Expand All @@ -121,6 +124,7 @@ fn transform_module(
let mut stubs: Vec<_> = vec![];

for func in module.functions.iter_mut() {
let func = &mut func.item;
let mut is_private = false;
let mut is_public = false;
let mut is_initializer = false;
Expand Down Expand Up @@ -175,6 +179,7 @@ fn transform_module(
let private_functions: Vec<_> = module
.functions
.iter()
.map(|t| &t.item)
.filter(|func| {
func.def
.attributes
Expand All @@ -187,6 +192,7 @@ fn transform_module(
let public_functions: Vec<_> = module
.functions
.iter()
.map(|func| &func.item)
.filter(|func| {
func.def
.attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn generate_compute_note_hash_and_optionally_a_nullifier(
assert_eq!(errors.len(), 0, "Failed to parse Noir macro code. This is either a bug in the compiler or the Noir macro code");

let mut function_ast = function_ast.into_sorted();
function_ast.functions.remove(0)
function_ast.functions.remove(0).item
}

fn generate_compute_note_hash_and_optionally_a_nullifier_source(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use acvm::acir::AcirField;

use noirc_errors::Location;
use noirc_frontend::ast::{Ident, NoirFunction, UnresolvedTypeData};
use noirc_frontend::ast::{Documented, Ident, NoirFunction, UnresolvedTypeData};
use noirc_frontend::{
graph::CrateId,
macros_api::{FieldElement, FileId, HirContext, HirExpression, HirLiteral, HirStatement},
Expand Down Expand Up @@ -267,15 +267,16 @@ pub fn generate_contract_interface(
.methods
.iter()
.enumerate()
.map(|(i, (method, orig_span))| {
.map(|(i, (documented_method, orig_span))| {
let method = &documented_method.item;
if method.name() == "at" || method.name() == "interface" || method.name() == "storage" {
(method.clone(), *orig_span)
(documented_method.clone(), *orig_span)
} else {
let (_, new_location) = stubs[i];
let mut modified_method = method.clone();
modified_method.def.name =
Ident::new(modified_method.name().to_string(), new_location.span);
(modified_method, *orig_span)
(Documented::not_documented(modified_method), *orig_span)
}
})
.collect();
Expand Down
Loading
Loading