From 3bb3b03aedab9c7abfeb3d3141e04b07b7aeeffb Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Tue, 25 Jun 2024 10:42:53 -0300 Subject: [PATCH 1/2] fix: don't benchmark the "prove" command as it doesn't exist anymore (#5323) # Description ## Problem Related to #4754 ## Summary In order to improve execution performance we first need to benchmark it... but, the current benchmark code also benchmarks the "prove" command which doesn't exist anymore, so it can't run. This PR remove the benchmark command related to the "prove" command. I considered extracting the strings "prove" and "command" to constants, so that if they are removed we would get a compile error, but... maybe chances of a command getting removed are very low, so probably not worth it. ## Additional Context None. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- tooling/nargo_cli/benches/criterion.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tooling/nargo_cli/benches/criterion.rs b/tooling/nargo_cli/benches/criterion.rs index 9f67bcffd6e..effab7d7c27 100644 --- a/tooling/nargo_cli/benches/criterion.rs +++ b/tooling/nargo_cli/benches/criterion.rs @@ -28,16 +28,10 @@ macro_rules! criterion_command { }; } criterion_command!(execution, "execute"); -criterion_command!(prove, "prove"); criterion_group! { name = execution_benches; config = Criterion::default().sample_size(20).measurement_time(Duration::from_secs(20)).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); targets = criterion_selected_tests_execution } -criterion_group! { - name = prove_benches; - config = Criterion::default().sample_size(10).measurement_time(Duration::from_secs(20)).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); - targets = criterion_selected_tests_prove -} -criterion_main!(execution_benches, prove_benches); +criterion_main!(execution_benches); From 64dd48a19060ccce8758851ea7bcec1f287f1156 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:13:31 +0100 Subject: [PATCH 2/2] fix: fix usage of `#[abi(tag)]` attribute with elaborator (#5298) # Description ## Problem\* Resolves ## Summary\* Followup to #5292 to handle globals as well ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/elaborator/mod.rs | 2 +- .../compile_success_contract/abi_attribute/Nargo.toml | 6 ++++++ .../compile_success_contract/abi_attribute/src/main.nr | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test_programs/compile_success_contract/abi_attribute/Nargo.toml create mode 100644 test_programs/compile_success_contract/abi_attribute/src/main.nr diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index 7b3cc59e341..46406083a09 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -1289,7 +1289,7 @@ impl<'context> Elaborator<'context> { self.current_item = Some(DependencyId::Global(global_id)); let let_stmt = global.stmt_def; - if !self.in_contract + if !self.module_id().module(self.def_maps).is_contract && let_stmt.attributes.iter().any(|attr| matches!(attr, SecondaryAttribute::Abi(_))) { let span = let_stmt.pattern.span(); diff --git a/test_programs/compile_success_contract/abi_attribute/Nargo.toml b/test_programs/compile_success_contract/abi_attribute/Nargo.toml new file mode 100644 index 00000000000..56fa88ccb68 --- /dev/null +++ b/test_programs/compile_success_contract/abi_attribute/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "abi_attribute" +type = "contract" +authors = [""] + +[dependencies] diff --git a/test_programs/compile_success_contract/abi_attribute/src/main.nr b/test_programs/compile_success_contract/abi_attribute/src/main.nr new file mode 100644 index 00000000000..d658823d519 --- /dev/null +++ b/test_programs/compile_success_contract/abi_attribute/src/main.nr @@ -0,0 +1,9 @@ +contract Foo { + #[abi(foo)] + global foo: Field = 42; + + #[abi(bar)] + struct Bar { + inner: Field + } +}