From d0bdce4dac1dace1e9108c36807df4082e838110 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 17:35:07 +0000 Subject: [PATCH 01/15] test adding gates to 1_mul --- test_programs/execution_success/1_mul/src/main.nr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test_programs/execution_success/1_mul/src/main.nr b/test_programs/execution_success/1_mul/src/main.nr index 8f4032dbd75..6a94c08ce9b 100644 --- a/test_programs/execution_success/1_mul/src/main.nr +++ b/test_programs/execution_success/1_mul/src/main.nr @@ -6,4 +6,10 @@ fn main(mut x: u32, y: u32, z: u32) { x *= x; //20736 x *= x; //429 981 696 assert(x == z); + + let nine = x * x; + assert(nine == 9); + + let sixteen = y * y; + assert(sixteen == 16); } From 12539781f722c7f559fc4f8d988293aa4db86bfd Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 17:53:24 +0000 Subject: [PATCH 02/15] fix 1_mul cause x is mutable --- test_programs/execution_success/1_mul/src/main.nr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test_programs/execution_success/1_mul/src/main.nr b/test_programs/execution_success/1_mul/src/main.nr index 6a94c08ce9b..0c9edc1a84e 100644 --- a/test_programs/execution_success/1_mul/src/main.nr +++ b/test_programs/execution_success/1_mul/src/main.nr @@ -1,15 +1,15 @@ // Test unsafe integer multiplication with overflow: 12^8 = 429 981 696 // The circuit should handle properly the growth of the bit size fn main(mut x: u32, y: u32, z: u32) { - x *= y; - x *= x; //144 - x *= x; //20736 - x *= x; //429 981 696 - assert(x == z); - let nine = x * x; assert(nine == 9); let sixteen = y * y; assert(sixteen == 16); + + x *= y; + x *= x; //144 + x *= x; //20736 + x *= x; //429 981 696 + assert(x == z); } From 3e9f4bf0efe784597b33e224052de92c67f2cd64 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 18:45:08 +0000 Subject: [PATCH 03/15] update commit --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index e694e5fad04..490da6574a4 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@f80ea702d579873ff80f0261c62e2bae5203748e + uses: vezenovm/noir-gates-diff@353d9f552f49872c0b83fb20e8025d9f5a917337 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From affee0c13dcf3e341753ee16e1f93836d865b5cc Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 19:03:05 +0000 Subject: [PATCH 04/15] update commit to force report --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 490da6574a4..c7cb6f848dd 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@353d9f552f49872c0b83fb20e8025d9f5a917337 + uses: vezenovm/noir-gates-diff@575853721458c0c334c8d2f2475d8a5486b65a48 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From f83f269bc3e16b9a5433988a5b0b47408ea65a05 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 19:14:30 +0000 Subject: [PATCH 05/15] pdate commit --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index c7cb6f848dd..31c04849553 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@575853721458c0c334c8d2f2475d8a5486b65a48 + uses: vezenovm/noir-gates-diff@2f807db55737bbf3486c8638df2227194447bb84 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From c348fead559c7f237abe37fe9fa8150e0015e2ec Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 22 Apr 2024 19:22:51 +0000 Subject: [PATCH 06/15] update commit to use debug info --- .github/workflows/gates_report.yml | 2 +- tooling/nargo_cli/src/cli/info_cmd.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 31c04849553..5569acb2038 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@2f807db55737bbf3486c8638df2227194447bb84 + uses: vezenovm/noir-gates-diff@4dabeaa1364e85cab035566fa90e295a185b5f04 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index 67825362f92..b2889a7deb4 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -220,13 +220,13 @@ fn byte_index(string: &str, index: u32) -> usize { byte_index } -#[derive(Debug, Default, Serialize)] +#[derive(Debug, Default, Serialize, Clone)] struct InfoReport { programs: Vec, contracts: Vec, } -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Clone)] struct ProgramInfo { name: String, #[serde(skip)] @@ -248,7 +248,7 @@ impl From for Vec { } } -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Clone)] struct ContractInfo { name: String, #[serde(skip)] @@ -257,7 +257,7 @@ struct ContractInfo { functions: Vec, } -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Clone)] struct FunctionInfo { name: String, acir_opcodes: usize, From ec67f371a1a0a2a9d6fd6a3ff3ee735441ab50b1 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 15:37:56 +0000 Subject: [PATCH 07/15] update commit --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 5569acb2038..55a17134788 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@4dabeaa1364e85cab035566fa90e295a185b5f04 + uses: vezenovm/noir-gates-diff@38e7d36ce69b21f21d4775d28098fab9b6a4ad95 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From a12475d5128e2e302b43c3417fff1ddcaa2661d6 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 16:24:27 +0000 Subject: [PATCH 08/15] print report as json --- tooling/nargo_cli/src/cli/info_cmd.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index b2889a7deb4..03bd65da8f5 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -132,10 +132,11 @@ pub(crate) fn run( .collect::>()?; let info_report = InfoReport { programs: program_info, contracts: contract_info }; - if args.json { // Expose machine-readable JSON data. - println!("{}", serde_json::to_string(&info_report).unwrap()); + let info_report_as_json = serde_json::to_string(&info_report).unwrap(); + dbg!(info_report_as_json.clone()); + println!("{}", info_report_as_json); } else { // Otherwise print human-readable table. if !info_report.programs.is_empty() { From e4bb1f0da7da7cb6b0423ea449b5c40ef8b754a7 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 17:25:02 +0000 Subject: [PATCH 09/15] change commit --- .github/workflows/gates_report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 55a17134788..e805f4b1e54 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -71,10 +71,10 @@ jobs: run: | ./gates_report.sh mv gates_report.json ../gates_report.json - + - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@38e7d36ce69b21f21d4775d28098fab9b6a4ad95 + uses: vezenovm/noir-gates-diff@eee534088d3b3092030e953b35831ac1ae9fd7e7 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From 78d2ad43b395db170090c0a507d2098d66d6b0dc Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 17:58:01 +0000 Subject: [PATCH 10/15] switch to package_name --- .github/workflows/gates_report.yml | 2 +- tooling/nargo_cli/src/cli/info_cmd.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index e805f4b1e54..af4d02b019e 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@eee534088d3b3092030e953b35831ac1ae9fd7e7 + uses: vezenovm/noir-gates-diff@890701668f4a797e1e40bebdb1eedd39a9e2b8e6 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index 03bd65da8f5..892252fc1f9 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -229,7 +229,7 @@ struct InfoReport { #[derive(Debug, Serialize, Clone)] struct ProgramInfo { - name: String, + package_name: String, #[serde(skip)] expression_width: ExpressionWidth, functions: Vec, @@ -239,7 +239,7 @@ impl From for Vec { fn from(program_info: ProgramInfo) -> Self { vecmap(program_info.functions, |function| { row![ - Fm->format!("{}", program_info.name), + Fm->format!("{}", program_info.package_name), Fc->format!("{}", function.name), format!("{:?}", program_info.expression_width), Fc->format!("{}", function.acir_opcodes), @@ -303,7 +303,7 @@ fn count_opcodes_and_gates_in_program( }) .collect::>()?; - Ok(ProgramInfo { name: package.name.to_string(), expression_width, functions }) + Ok(ProgramInfo { package_name: package.name.to_string(), expression_width, functions }) } fn count_opcodes_and_gates_in_contract( From 882f0a715d84776983e91937d2e7c55eab8e0bd5 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 18:41:05 +0000 Subject: [PATCH 11/15] update commit after actually publishing --- .github/workflows/gates_report.yml | 2 +- tooling/nargo_cli/src/cli/info_cmd.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index af4d02b019e..c5e15dbbc4f 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@890701668f4a797e1e40bebdb1eedd39a9e2b8e6 + uses: vezenovm/noir-gates-diff@da26184abb7bda7c7287084711e0e4dec007757e with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index 892252fc1f9..850570587e0 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -132,11 +132,10 @@ pub(crate) fn run( .collect::>()?; let info_report = InfoReport { programs: program_info, contracts: contract_info }; + if args.json { // Expose machine-readable JSON data. - let info_report_as_json = serde_json::to_string(&info_report).unwrap(); - dbg!(info_report_as_json.clone()); - println!("{}", info_report_as_json); + println!("{}", serde_json::to_string(&info_report).unwrap()); } else { // Otherwise print human-readable table. if !info_report.programs.is_empty() { From ca873a790a6343894fa893f540a7412a6e163cc2 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 18:47:01 +0000 Subject: [PATCH 12/15] update commit --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index c5e15dbbc4f..5d11b8ab379 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@da26184abb7bda7c7287084711e0e4dec007757e + uses: vezenovm/noir-gates-diff@80405a32a1750e62d7eedc3f6a660a796f6cb9ec with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From 5ff2e6008345cab7dedd735fabbf26bf2ab4f720 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 18:47:44 +0000 Subject: [PATCH 13/15] remove clone on info cmd structures --- tooling/nargo_cli/src/cli/info_cmd.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index 850570587e0..3695fb57d31 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -220,13 +220,13 @@ fn byte_index(string: &str, index: u32) -> usize { byte_index } -#[derive(Debug, Default, Serialize, Clone)] +#[derive(Debug, Default, Serialize)] struct InfoReport { programs: Vec, contracts: Vec, } -#[derive(Debug, Serialize, Clone)] +#[derive(Debug, Serialize)] struct ProgramInfo { package_name: String, #[serde(skip)] @@ -248,7 +248,7 @@ impl From for Vec { } } -#[derive(Debug, Serialize, Clone)] +#[derive(Debug, Serialize)] struct ContractInfo { name: String, #[serde(skip)] @@ -257,7 +257,7 @@ struct ContractInfo { functions: Vec, } -#[derive(Debug, Serialize, Clone)] +#[derive(Debug, Serialize)] struct FunctionInfo { name: String, acir_opcodes: usize, From 11e7dadf70176feb28b03a9c176d3b2f13f9f6b4 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 19:22:37 +0000 Subject: [PATCH 14/15] update commit --- .github/workflows/gates_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index 5d11b8ab379..71ebd342613 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -74,7 +74,7 @@ jobs: - name: Compare gates reports id: gates_diff - uses: vezenovm/noir-gates-diff@80405a32a1750e62d7eedc3f6a660a796f6cb9ec + uses: vezenovm/noir-gates-diff@45e9c9a21deb236fa7f38138b42b33ddaf7c0985 with: report: gates_report.json summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) From 14d449acbd2e7383fd3e12c24862193163f7d2a6 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Tue, 23 Apr 2024 19:42:45 +0000 Subject: [PATCH 15/15] reevert 1_mul additions --- test_programs/execution_success/1_mul/src/main.nr | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test_programs/execution_success/1_mul/src/main.nr b/test_programs/execution_success/1_mul/src/main.nr index 0c9edc1a84e..8f4032dbd75 100644 --- a/test_programs/execution_success/1_mul/src/main.nr +++ b/test_programs/execution_success/1_mul/src/main.nr @@ -1,12 +1,6 @@ // Test unsafe integer multiplication with overflow: 12^8 = 429 981 696 // The circuit should handle properly the growth of the bit size fn main(mut x: u32, y: u32, z: u32) { - let nine = x * x; - assert(nine == 9); - - let sixteen = y * y; - assert(sixteen == 16); - x *= y; x *= x; //144 x *= x; //20736