From 3d7746230ac1fd0ddfa06862e72efd8063c35517 Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Wed, 31 Jul 2024 15:09:22 +0000 Subject: [PATCH] chore(avm): codegen improvements --- barretenberg/cpp/src/barretenberg/bb/main.cpp | 2 +- .../relations/generated/avm/alu.hpp | 1 + .../relations/generated/avm/binary.hpp | 1 + .../relations/generated/avm/conversion.hpp | 1 + .../relations/generated/avm/gas.hpp | 1 + .../generated/avm/incl_main_tag_err.hpp | 1 + .../generated/avm/incl_mem_tag_err.hpp | 1 + .../relations/generated/avm/keccakf1600.hpp | 1 + .../relations/generated/avm/kernel.hpp | 1 + .../generated/avm/kernel_output_lookup.hpp | 1 + .../generated/avm/lookup_byte_lengths.hpp | 1 + .../generated/avm/lookup_byte_operations.hpp | 1 + .../generated/avm/lookup_cd_value.hpp | 1 + .../generated/avm/lookup_div_u16_0.hpp | 1 + .../generated/avm/lookup_div_u16_1.hpp | 1 + .../generated/avm/lookup_div_u16_2.hpp | 1 + .../generated/avm/lookup_div_u16_3.hpp | 1 + .../generated/avm/lookup_div_u16_4.hpp | 1 + .../generated/avm/lookup_div_u16_5.hpp | 1 + .../generated/avm/lookup_div_u16_6.hpp | 1 + .../generated/avm/lookup_div_u16_7.hpp | 1 + .../generated/avm/lookup_into_kernel.hpp | 1 + .../generated/avm/lookup_mem_rng_chk_hi.hpp | 1 + .../generated/avm/lookup_mem_rng_chk_lo.hpp | 1 + .../generated/avm/lookup_mem_rng_chk_mid.hpp | 1 + .../generated/avm/lookup_opcode_gas.hpp | 1 + .../generated/avm/lookup_pow_2_0.hpp | 1 + .../generated/avm/lookup_pow_2_1.hpp | 1 + .../generated/avm/lookup_ret_value.hpp | 1 + .../relations/generated/avm/lookup_u16_0.hpp | 1 + .../relations/generated/avm/lookup_u16_1.hpp | 1 + .../relations/generated/avm/lookup_u16_10.hpp | 1 + .../relations/generated/avm/lookup_u16_11.hpp | 1 + .../relations/generated/avm/lookup_u16_12.hpp | 1 + .../relations/generated/avm/lookup_u16_13.hpp | 1 + .../relations/generated/avm/lookup_u16_14.hpp | 1 + .../relations/generated/avm/lookup_u16_2.hpp | 1 + .../relations/generated/avm/lookup_u16_3.hpp | 1 + .../relations/generated/avm/lookup_u16_4.hpp | 1 + .../relations/generated/avm/lookup_u16_5.hpp | 1 + .../relations/generated/avm/lookup_u16_6.hpp | 1 + .../relations/generated/avm/lookup_u16_7.hpp | 1 + .../relations/generated/avm/lookup_u16_8.hpp | 1 + .../relations/generated/avm/lookup_u16_9.hpp | 1 + .../relations/generated/avm/lookup_u8_0.hpp | 1 + .../relations/generated/avm/lookup_u8_1.hpp | 1 + .../relations/generated/avm/main.hpp | 1 + .../relations/generated/avm/mem.hpp | 1 + .../relations/generated/avm/mem_slice.hpp | 1 + .../relations/generated/avm/pedersen.hpp | 1 + .../relations/generated/avm/perm_main_alu.hpp | 1 + .../relations/generated/avm/perm_main_bin.hpp | 1 + .../generated/avm/perm_main_conv.hpp | 1 + .../generated/avm/perm_main_mem_a.hpp | 1 + .../generated/avm/perm_main_mem_b.hpp | 1 + .../generated/avm/perm_main_mem_c.hpp | 1 + .../generated/avm/perm_main_mem_d.hpp | 1 + .../avm/perm_main_mem_ind_addr_a.hpp | 1 + .../avm/perm_main_mem_ind_addr_b.hpp | 1 + .../avm/perm_main_mem_ind_addr_c.hpp | 1 + .../avm/perm_main_mem_ind_addr_d.hpp | 1 + .../generated/avm/perm_main_pedersen.hpp | 1 + .../generated/avm/perm_main_pos2_perm.hpp | 1 + .../generated/avm/perm_main_slice.hpp | 1 + .../generated/avm/perm_slice_mem.hpp | 1 + .../relations/generated/avm/poseidon2.hpp | 1 + .../relations/generated/avm/powers.hpp | 1 + .../generated/avm/range_check_da_gas_hi.hpp | 1 + .../generated/avm/range_check_da_gas_lo.hpp | 1 + .../generated/avm/range_check_l2_gas_hi.hpp | 1 + .../generated/avm/range_check_l2_gas_lo.hpp | 1 + .../relations/generated/avm/sha256.hpp | 1 + .../vm/avm_trace/avm_execution.cpp | 2 +- .../barretenberg/vm/avm_trace/avm_trace.cpp | 2 +- .../vm/generated/avm_circuit_builder.cpp | 474 ++++++ .../vm/generated/avm_circuit_builder.hpp | 472 +----- .../vm/generated/avm_composer.cpp | 1 + .../vm/generated/avm_composer.hpp | 1 + .../barretenberg/vm/generated/avm_flavor.cpp | 1471 +++++++++++++++++ .../barretenberg/vm/generated/avm_flavor.hpp | 1468 +--------------- .../vm/generated/avm_flavor_settings.hpp | 1 + .../vm/generated/avm_full_row.cpp | 1 + .../vm/generated/avm_full_row.hpp | 1 + .../barretenberg/vm/generated/avm_prover.cpp | 3 +- .../barretenberg/vm/generated/avm_prover.hpp | 1 + .../vm/generated/avm_verifier.cpp | 97 +- .../vm/generated/avm_verifier.hpp | 1 + .../barretenberg/vm/{avm_trace => }/stats.cpp | 2 +- .../barretenberg/vm/{avm_trace => }/stats.hpp | 0 .../bb-pil-backend/src/circuit_builder.rs | 27 + .../bb-pil-backend/src/flavor_builder.rs | 63 + bb-pilcom/bb-pil-backend/src/vm_builder.rs | 18 +- .../templates/circuit_builder.cpp.hbs | 122 ++ .../templates/circuit_builder.hpp.hbs | 120 +- .../bb-pil-backend/templates/composer.cpp.hbs | 1 + .../bb-pil-backend/templates/composer.hpp.hbs | 1 + .../bb-pil-backend/templates/flavor.cpp.hbs | 112 ++ .../bb-pil-backend/templates/flavor.hpp.hbs | 112 +- .../templates/flavor_settings.hpp.hbs | 1 + .../bb-pil-backend/templates/full_row.cpp.hbs | 1 + .../bb-pil-backend/templates/full_row.hpp.hbs | 1 + .../bb-pil-backend/templates/lookup.hpp.hbs | 1 + .../templates/permutation.hpp.hbs | 1 + .../bb-pil-backend/templates/prover.cpp.hbs | 3 +- .../bb-pil-backend/templates/prover.hpp.hbs | 1 + .../bb-pil-backend/templates/relation.hpp.hbs | 1 + .../bb-pil-backend/templates/verifier.cpp.hbs | 7 +- .../bb-pil-backend/templates/verifier.hpp.hbs | 1 + 108 files changed, 2416 insertions(+), 2249 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp create mode 100644 barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.cpp rename barretenberg/cpp/src/barretenberg/vm/{avm_trace => }/stats.cpp (96%) rename barretenberg/cpp/src/barretenberg/vm/{avm_trace => }/stats.hpp (100%) create mode 100644 bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs create mode 100644 bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 9fabba8c996..a7a010f0ef2 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -15,7 +15,7 @@ #ifndef DISABLE_AZTEC_VM #include "barretenberg/vm/avm_trace/avm_common.hpp" #include "barretenberg/vm/avm_trace/avm_execution.hpp" -#include "barretenberg/vm/avm_trace/stats.hpp" +#include "barretenberg/vm/stats.hpp" #endif #include "config.hpp" #include "get_bn254_crs.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp index f1f8714e80a..464c67f0c8f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/binary.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/binary.hpp index dc0f110e875..91e9160af75 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/binary.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/binary.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/conversion.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/conversion.hpp index 759f82b4fbf..3b1c8ebb0ff 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/conversion.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/conversion.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/gas.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/gas.hpp index c5779ccb6e6..98333d9b9b9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/gas.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/gas.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp index 4b6eab5c924..cd157ae28c9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp index 04cfbb2e754..8ea3c0be818 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/keccakf1600.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/keccakf1600.hpp index df3f032d111..e065ece9dbf 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/keccakf1600.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/keccakf1600.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel.hpp index 9d4d2f1f9ce..8d4339c50f1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp index 797627d4abe..27a4f3b034d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp index c9e955f5c5d..48306c678ff 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp index d75b148d8f8..990e68f8694 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp index 928e027579f..d79010b79e8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp index 17d91f7a8fb..6d5eb914bf1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp index aa75b041c2f..10b95f3109a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp index fdbc101c196..980139dca14 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp index 811751452c9..78f146e20fc 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp index beccfbfe262..286c1c2f375 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp index e3d88dbc9cc..ca7d2337de3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp index 71caffd331c..2c90e085116 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp index 2658b60ad6b..2cfd36db9ba 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp index 37c92e25584..b4f60e4a2bf 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp index 3b46f851c31..5c8aaa6fc3b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp index c16c955dbb1..0703aedb9b1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp index 6401efe9a16..c94810b17a4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp index 86a5593712a..e5710c1fba5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp index 4130b070028..863fcfeac24 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp index 45e2674d889..051051f5ac4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_ret_value.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_ret_value.hpp index e3a5b83ba58..ebdda1877a3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_ret_value.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_ret_value.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp index 80fb8d8fc1f..df8468fa309 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp index d21789a78a3..b32bf947096 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp index c5c53ca7001..cbc6159e660 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp index 667d62ee80c..c851e3174e7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp index b996d90712e..897d9aa182b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp index 9a2be9b7a42..adcb2988599 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp index 41cf86dc012..b9fb986d084 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp index 591d5569418..765f529a0f7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp index 2a8aa71231f..9ea811735f7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp index d8a08585227..5dcfff11f66 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp index 2a5df1d947f..43cc658542f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp index 0c3d77a4ba4..46d4b80a693 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp index 58c4b7aaf95..576cc99c002 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp index 009ba72de36..866e349c377 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp index c1ce89d9253..0e3716af788 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp index 8b73711893c..17d5956c9e2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp index 0f0bad11ee1..5c194db8b1a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp index 0ad1a01ba60..b208ffbd2b4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp index 6fa40fcaed1..8f3b67f85d6 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp index 4f97e128975..9fb9f5bf8a7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/pedersen.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/pedersen.hpp index 6be8889e978..c1793ee084e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/pedersen.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp index 8e4ae3525da..6afb59543ff 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp index fbfbd4a9915..872e6b6dce4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp index 3f0ac59654c..9014c3af10c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp index fb822164ac3..069e757eb05 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp index da7afb490b7..78c234553b4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp index 8b96595d294..c8644cbf456 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp index 3d8c9b16ef5..cba0b47f08e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp index de3276a762a..5ed5c2b0068 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp index 18a655012eb..8533af76d93 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp index 14a43accda3..03efaa45c4b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp index 78e201106c1..8f8a2195066 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp index 7753ff50e8b..f91956a8870 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp index 20b1d24dd74..d2788291864 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_slice.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_slice.hpp index e74fa08bf5f..abdd10c9300 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_slice.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_slice_mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_slice_mem.hpp index 7bd0a9ff343..c42c3329075 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_slice_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_slice_mem.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/poseidon2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/poseidon2.hpp index 6b23fc5c205..a687f1b7e9d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/poseidon2.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/powers.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/powers.hpp index b6a9da83692..655c420a7e1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/powers.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/powers.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp index 4a13a744389..2a940db495e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp index 400306ca4b7..63c17060e85 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp index deb10a672a2..7722789c2ed 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp index 2acda771158..a2de806c54b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/sha256.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/sha256.hpp index c7e2013f19b..77f8bee4487 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/sha256.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generated/avm/declare_views.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp index 6acb5b58b31..dd62fca665f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp @@ -12,11 +12,11 @@ #include "barretenberg/vm/avm_trace/avm_trace.hpp" #include "barretenberg/vm/avm_trace/aztec_constants.hpp" #include "barretenberg/vm/avm_trace/constants.hpp" -#include "barretenberg/vm/avm_trace/stats.hpp" #include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_composer.hpp" #include "barretenberg/vm/generated/avm_flavor.hpp" #include "barretenberg/vm/generated/avm_verifier.hpp" +#include "barretenberg/vm/stats.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp index 620d264c7c7..8141cd87f6c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp @@ -25,7 +25,7 @@ #include "barretenberg/vm/avm_trace/fixed_gas.hpp" #include "barretenberg/vm/avm_trace/fixed_powers.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp" -#include "barretenberg/vm/avm_trace/stats.hpp" +#include "barretenberg/vm/stats.hpp" namespace bb::avm_trace { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp new file mode 100644 index 00000000000..649f7b91ed8 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp @@ -0,0 +1,474 @@ +// AUTOGENERATED FILE +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" + +#include + +#include "barretenberg/common/constexpr_utils.hpp" +#include "barretenberg/common/thread.hpp" +#include "barretenberg/common/throw_or_abort.hpp" +#include "barretenberg/ecc/curves/bn254/fr.hpp" +#include "barretenberg/honk/proof_system/logderivative_library.hpp" +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +namespace bb { + +AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() const +{ + const auto num_rows = get_circuit_subgroup_size(); + ProverPolynomials polys; + + // Allocate mem for each column + for (auto& poly : polys.get_all()) { + poly = Polynomial(num_rows); + } + + for (size_t i = 0; i < rows.size(); i++) { + polys.main_clk[i] = rows[i].main_clk; + polys.main_sel_first[i] = rows[i].main_sel_first; + polys.kernel_kernel_inputs[i] = rows[i].kernel_kernel_inputs; + polys.kernel_kernel_value_out[i] = rows[i].kernel_kernel_value_out; + polys.kernel_kernel_side_effect_out[i] = rows[i].kernel_kernel_side_effect_out; + polys.kernel_kernel_metadata_out[i] = rows[i].kernel_kernel_metadata_out; + polys.main_calldata[i] = rows[i].main_calldata; + polys.main_returndata[i] = rows[i].main_returndata; + polys.alu_a_hi[i] = rows[i].alu_a_hi; + polys.alu_a_lo[i] = rows[i].alu_a_lo; + polys.alu_b_hi[i] = rows[i].alu_b_hi; + polys.alu_b_lo[i] = rows[i].alu_b_lo; + polys.alu_borrow[i] = rows[i].alu_borrow; + polys.alu_cf[i] = rows[i].alu_cf; + polys.alu_clk[i] = rows[i].alu_clk; + polys.alu_cmp_rng_ctr[i] = rows[i].alu_cmp_rng_ctr; + polys.alu_div_u16_r0[i] = rows[i].alu_div_u16_r0; + polys.alu_div_u16_r1[i] = rows[i].alu_div_u16_r1; + polys.alu_div_u16_r2[i] = rows[i].alu_div_u16_r2; + polys.alu_div_u16_r3[i] = rows[i].alu_div_u16_r3; + polys.alu_div_u16_r4[i] = rows[i].alu_div_u16_r4; + polys.alu_div_u16_r5[i] = rows[i].alu_div_u16_r5; + polys.alu_div_u16_r6[i] = rows[i].alu_div_u16_r6; + polys.alu_div_u16_r7[i] = rows[i].alu_div_u16_r7; + polys.alu_divisor_hi[i] = rows[i].alu_divisor_hi; + polys.alu_divisor_lo[i] = rows[i].alu_divisor_lo; + polys.alu_ff_tag[i] = rows[i].alu_ff_tag; + polys.alu_ia[i] = rows[i].alu_ia; + polys.alu_ib[i] = rows[i].alu_ib; + polys.alu_ic[i] = rows[i].alu_ic; + polys.alu_in_tag[i] = rows[i].alu_in_tag; + polys.alu_op_add[i] = rows[i].alu_op_add; + polys.alu_op_cast[i] = rows[i].alu_op_cast; + polys.alu_op_cast_prev[i] = rows[i].alu_op_cast_prev; + polys.alu_op_div[i] = rows[i].alu_op_div; + polys.alu_op_div_a_lt_b[i] = rows[i].alu_op_div_a_lt_b; + polys.alu_op_div_std[i] = rows[i].alu_op_div_std; + polys.alu_op_eq[i] = rows[i].alu_op_eq; + polys.alu_op_eq_diff_inv[i] = rows[i].alu_op_eq_diff_inv; + polys.alu_op_lt[i] = rows[i].alu_op_lt; + polys.alu_op_lte[i] = rows[i].alu_op_lte; + polys.alu_op_mul[i] = rows[i].alu_op_mul; + polys.alu_op_not[i] = rows[i].alu_op_not; + polys.alu_op_shl[i] = rows[i].alu_op_shl; + polys.alu_op_shr[i] = rows[i].alu_op_shr; + polys.alu_op_sub[i] = rows[i].alu_op_sub; + polys.alu_p_a_borrow[i] = rows[i].alu_p_a_borrow; + polys.alu_p_b_borrow[i] = rows[i].alu_p_b_borrow; + polys.alu_p_sub_a_hi[i] = rows[i].alu_p_sub_a_hi; + polys.alu_p_sub_a_lo[i] = rows[i].alu_p_sub_a_lo; + polys.alu_p_sub_b_hi[i] = rows[i].alu_p_sub_b_hi; + polys.alu_p_sub_b_lo[i] = rows[i].alu_p_sub_b_lo; + polys.alu_partial_prod_hi[i] = rows[i].alu_partial_prod_hi; + polys.alu_partial_prod_lo[i] = rows[i].alu_partial_prod_lo; + polys.alu_quotient_hi[i] = rows[i].alu_quotient_hi; + polys.alu_quotient_lo[i] = rows[i].alu_quotient_lo; + polys.alu_remainder[i] = rows[i].alu_remainder; + polys.alu_res_hi[i] = rows[i].alu_res_hi; + polys.alu_res_lo[i] = rows[i].alu_res_lo; + polys.alu_sel_alu[i] = rows[i].alu_sel_alu; + polys.alu_sel_cmp[i] = rows[i].alu_sel_cmp; + polys.alu_sel_div_rng_chk[i] = rows[i].alu_sel_div_rng_chk; + polys.alu_sel_rng_chk[i] = rows[i].alu_sel_rng_chk; + polys.alu_sel_rng_chk_lookup[i] = rows[i].alu_sel_rng_chk_lookup; + polys.alu_sel_shift_which[i] = rows[i].alu_sel_shift_which; + polys.alu_shift_lt_bit_len[i] = rows[i].alu_shift_lt_bit_len; + polys.alu_t_sub_s_bits[i] = rows[i].alu_t_sub_s_bits; + polys.alu_two_pow_s[i] = rows[i].alu_two_pow_s; + polys.alu_two_pow_t_sub_s[i] = rows[i].alu_two_pow_t_sub_s; + polys.alu_u128_tag[i] = rows[i].alu_u128_tag; + polys.alu_u16_r0[i] = rows[i].alu_u16_r0; + polys.alu_u16_r1[i] = rows[i].alu_u16_r1; + polys.alu_u16_r10[i] = rows[i].alu_u16_r10; + polys.alu_u16_r11[i] = rows[i].alu_u16_r11; + polys.alu_u16_r12[i] = rows[i].alu_u16_r12; + polys.alu_u16_r13[i] = rows[i].alu_u16_r13; + polys.alu_u16_r14[i] = rows[i].alu_u16_r14; + polys.alu_u16_r2[i] = rows[i].alu_u16_r2; + polys.alu_u16_r3[i] = rows[i].alu_u16_r3; + polys.alu_u16_r4[i] = rows[i].alu_u16_r4; + polys.alu_u16_r5[i] = rows[i].alu_u16_r5; + polys.alu_u16_r6[i] = rows[i].alu_u16_r6; + polys.alu_u16_r7[i] = rows[i].alu_u16_r7; + polys.alu_u16_r8[i] = rows[i].alu_u16_r8; + polys.alu_u16_r9[i] = rows[i].alu_u16_r9; + polys.alu_u16_tag[i] = rows[i].alu_u16_tag; + polys.alu_u32_tag[i] = rows[i].alu_u32_tag; + polys.alu_u64_tag[i] = rows[i].alu_u64_tag; + polys.alu_u8_r0[i] = rows[i].alu_u8_r0; + polys.alu_u8_r1[i] = rows[i].alu_u8_r1; + polys.alu_u8_tag[i] = rows[i].alu_u8_tag; + polys.binary_acc_ia[i] = rows[i].binary_acc_ia; + polys.binary_acc_ib[i] = rows[i].binary_acc_ib; + polys.binary_acc_ic[i] = rows[i].binary_acc_ic; + polys.binary_clk[i] = rows[i].binary_clk; + polys.binary_ia_bytes[i] = rows[i].binary_ia_bytes; + polys.binary_ib_bytes[i] = rows[i].binary_ib_bytes; + polys.binary_ic_bytes[i] = rows[i].binary_ic_bytes; + polys.binary_in_tag[i] = rows[i].binary_in_tag; + polys.binary_mem_tag_ctr[i] = rows[i].binary_mem_tag_ctr; + polys.binary_mem_tag_ctr_inv[i] = rows[i].binary_mem_tag_ctr_inv; + polys.binary_op_id[i] = rows[i].binary_op_id; + polys.binary_sel_bin[i] = rows[i].binary_sel_bin; + polys.binary_start[i] = rows[i].binary_start; + polys.byte_lookup_sel_bin[i] = rows[i].byte_lookup_sel_bin; + polys.byte_lookup_table_byte_lengths[i] = rows[i].byte_lookup_table_byte_lengths; + polys.byte_lookup_table_in_tags[i] = rows[i].byte_lookup_table_in_tags; + polys.byte_lookup_table_input_a[i] = rows[i].byte_lookup_table_input_a; + polys.byte_lookup_table_input_b[i] = rows[i].byte_lookup_table_input_b; + polys.byte_lookup_table_op_id[i] = rows[i].byte_lookup_table_op_id; + polys.byte_lookup_table_output[i] = rows[i].byte_lookup_table_output; + polys.conversion_clk[i] = rows[i].conversion_clk; + polys.conversion_input[i] = rows[i].conversion_input; + polys.conversion_num_limbs[i] = rows[i].conversion_num_limbs; + polys.conversion_radix[i] = rows[i].conversion_radix; + polys.conversion_sel_to_radix_le[i] = rows[i].conversion_sel_to_radix_le; + polys.gas_da_gas_fixed_table[i] = rows[i].gas_da_gas_fixed_table; + polys.gas_l2_gas_fixed_table[i] = rows[i].gas_l2_gas_fixed_table; + polys.gas_sel_gas_cost[i] = rows[i].gas_sel_gas_cost; + polys.keccakf1600_clk[i] = rows[i].keccakf1600_clk; + polys.keccakf1600_input[i] = rows[i].keccakf1600_input; + polys.keccakf1600_output[i] = rows[i].keccakf1600_output; + polys.keccakf1600_sel_keccakf1600[i] = rows[i].keccakf1600_sel_keccakf1600; + polys.kernel_emit_l2_to_l1_msg_write_offset[i] = rows[i].kernel_emit_l2_to_l1_msg_write_offset; + polys.kernel_emit_note_hash_write_offset[i] = rows[i].kernel_emit_note_hash_write_offset; + polys.kernel_emit_nullifier_write_offset[i] = rows[i].kernel_emit_nullifier_write_offset; + polys.kernel_emit_unencrypted_log_write_offset[i] = rows[i].kernel_emit_unencrypted_log_write_offset; + polys.kernel_kernel_in_offset[i] = rows[i].kernel_kernel_in_offset; + polys.kernel_kernel_out_offset[i] = rows[i].kernel_kernel_out_offset; + polys.kernel_l1_to_l2_msg_exists_write_offset[i] = rows[i].kernel_l1_to_l2_msg_exists_write_offset; + polys.kernel_note_hash_exist_write_offset[i] = rows[i].kernel_note_hash_exist_write_offset; + polys.kernel_nullifier_exists_write_offset[i] = rows[i].kernel_nullifier_exists_write_offset; + polys.kernel_nullifier_non_exists_write_offset[i] = rows[i].kernel_nullifier_non_exists_write_offset; + polys.kernel_q_public_input_kernel_add_to_table[i] = rows[i].kernel_q_public_input_kernel_add_to_table; + polys.kernel_q_public_input_kernel_out_add_to_table[i] = rows[i].kernel_q_public_input_kernel_out_add_to_table; + polys.kernel_side_effect_counter[i] = rows[i].kernel_side_effect_counter; + polys.kernel_sload_write_offset[i] = rows[i].kernel_sload_write_offset; + polys.kernel_sstore_write_offset[i] = rows[i].kernel_sstore_write_offset; + polys.main_abs_da_rem_gas_hi[i] = rows[i].main_abs_da_rem_gas_hi; + polys.main_abs_da_rem_gas_lo[i] = rows[i].main_abs_da_rem_gas_lo; + polys.main_abs_l2_rem_gas_hi[i] = rows[i].main_abs_l2_rem_gas_hi; + polys.main_abs_l2_rem_gas_lo[i] = rows[i].main_abs_l2_rem_gas_lo; + polys.main_alu_in_tag[i] = rows[i].main_alu_in_tag; + polys.main_bin_op_id[i] = rows[i].main_bin_op_id; + polys.main_call_ptr[i] = rows[i].main_call_ptr; + polys.main_da_gas_op_cost[i] = rows[i].main_da_gas_op_cost; + polys.main_da_gas_remaining[i] = rows[i].main_da_gas_remaining; + polys.main_da_out_of_gas[i] = rows[i].main_da_out_of_gas; + polys.main_ia[i] = rows[i].main_ia; + polys.main_ib[i] = rows[i].main_ib; + polys.main_ic[i] = rows[i].main_ic; + polys.main_id[i] = rows[i].main_id; + polys.main_id_zero[i] = rows[i].main_id_zero; + polys.main_ind_addr_a[i] = rows[i].main_ind_addr_a; + polys.main_ind_addr_b[i] = rows[i].main_ind_addr_b; + polys.main_ind_addr_c[i] = rows[i].main_ind_addr_c; + polys.main_ind_addr_d[i] = rows[i].main_ind_addr_d; + polys.main_internal_return_ptr[i] = rows[i].main_internal_return_ptr; + polys.main_inv[i] = rows[i].main_inv; + polys.main_l2_gas_op_cost[i] = rows[i].main_l2_gas_op_cost; + polys.main_l2_gas_remaining[i] = rows[i].main_l2_gas_remaining; + polys.main_l2_out_of_gas[i] = rows[i].main_l2_out_of_gas; + polys.main_mem_addr_a[i] = rows[i].main_mem_addr_a; + polys.main_mem_addr_b[i] = rows[i].main_mem_addr_b; + polys.main_mem_addr_c[i] = rows[i].main_mem_addr_c; + polys.main_mem_addr_d[i] = rows[i].main_mem_addr_d; + polys.main_op_err[i] = rows[i].main_op_err; + polys.main_opcode_val[i] = rows[i].main_opcode_val; + polys.main_pc[i] = rows[i].main_pc; + polys.main_r_in_tag[i] = rows[i].main_r_in_tag; + polys.main_rwa[i] = rows[i].main_rwa; + polys.main_rwb[i] = rows[i].main_rwb; + polys.main_rwc[i] = rows[i].main_rwc; + polys.main_rwd[i] = rows[i].main_rwd; + polys.main_sel_alu[i] = rows[i].main_sel_alu; + polys.main_sel_bin[i] = rows[i].main_sel_bin; + polys.main_sel_calldata[i] = rows[i].main_sel_calldata; + polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; + polys.main_sel_last[i] = rows[i].main_sel_last; + polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; + polys.main_sel_mem_op_activate_gas[i] = rows[i].main_sel_mem_op_activate_gas; + polys.main_sel_mem_op_b[i] = rows[i].main_sel_mem_op_b; + polys.main_sel_mem_op_c[i] = rows[i].main_sel_mem_op_c; + polys.main_sel_mem_op_d[i] = rows[i].main_sel_mem_op_d; + polys.main_sel_mov_ia_to_ic[i] = rows[i].main_sel_mov_ia_to_ic; + polys.main_sel_mov_ib_to_ic[i] = rows[i].main_sel_mov_ib_to_ic; + polys.main_sel_op_add[i] = rows[i].main_sel_op_add; + polys.main_sel_op_address[i] = rows[i].main_sel_op_address; + polys.main_sel_op_and[i] = rows[i].main_sel_op_and; + polys.main_sel_op_block_number[i] = rows[i].main_sel_op_block_number; + polys.main_sel_op_calldata_copy[i] = rows[i].main_sel_op_calldata_copy; + polys.main_sel_op_cast[i] = rows[i].main_sel_op_cast; + polys.main_sel_op_chain_id[i] = rows[i].main_sel_op_chain_id; + polys.main_sel_op_cmov[i] = rows[i].main_sel_op_cmov; + polys.main_sel_op_coinbase[i] = rows[i].main_sel_op_coinbase; + polys.main_sel_op_dagasleft[i] = rows[i].main_sel_op_dagasleft; + polys.main_sel_op_div[i] = rows[i].main_sel_op_div; + polys.main_sel_op_emit_l2_to_l1_msg[i] = rows[i].main_sel_op_emit_l2_to_l1_msg; + polys.main_sel_op_emit_note_hash[i] = rows[i].main_sel_op_emit_note_hash; + polys.main_sel_op_emit_nullifier[i] = rows[i].main_sel_op_emit_nullifier; + polys.main_sel_op_emit_unencrypted_log[i] = rows[i].main_sel_op_emit_unencrypted_log; + polys.main_sel_op_eq[i] = rows[i].main_sel_op_eq; + polys.main_sel_op_external_call[i] = rows[i].main_sel_op_external_call; + polys.main_sel_op_external_return[i] = rows[i].main_sel_op_external_return; + polys.main_sel_op_fdiv[i] = rows[i].main_sel_op_fdiv; + polys.main_sel_op_fee_per_da_gas[i] = rows[i].main_sel_op_fee_per_da_gas; + polys.main_sel_op_fee_per_l2_gas[i] = rows[i].main_sel_op_fee_per_l2_gas; + polys.main_sel_op_function_selector[i] = rows[i].main_sel_op_function_selector; + polys.main_sel_op_get_contract_instance[i] = rows[i].main_sel_op_get_contract_instance; + polys.main_sel_op_halt[i] = rows[i].main_sel_op_halt; + polys.main_sel_op_internal_call[i] = rows[i].main_sel_op_internal_call; + polys.main_sel_op_internal_return[i] = rows[i].main_sel_op_internal_return; + polys.main_sel_op_jump[i] = rows[i].main_sel_op_jump; + polys.main_sel_op_jumpi[i] = rows[i].main_sel_op_jumpi; + polys.main_sel_op_keccak[i] = rows[i].main_sel_op_keccak; + polys.main_sel_op_l1_to_l2_msg_exists[i] = rows[i].main_sel_op_l1_to_l2_msg_exists; + polys.main_sel_op_l2gasleft[i] = rows[i].main_sel_op_l2gasleft; + polys.main_sel_op_lt[i] = rows[i].main_sel_op_lt; + polys.main_sel_op_lte[i] = rows[i].main_sel_op_lte; + polys.main_sel_op_mov[i] = rows[i].main_sel_op_mov; + polys.main_sel_op_mul[i] = rows[i].main_sel_op_mul; + polys.main_sel_op_not[i] = rows[i].main_sel_op_not; + polys.main_sel_op_note_hash_exists[i] = rows[i].main_sel_op_note_hash_exists; + polys.main_sel_op_nullifier_exists[i] = rows[i].main_sel_op_nullifier_exists; + polys.main_sel_op_or[i] = rows[i].main_sel_op_or; + polys.main_sel_op_pedersen[i] = rows[i].main_sel_op_pedersen; + polys.main_sel_op_poseidon2[i] = rows[i].main_sel_op_poseidon2; + polys.main_sel_op_radix_le[i] = rows[i].main_sel_op_radix_le; + polys.main_sel_op_sender[i] = rows[i].main_sel_op_sender; + polys.main_sel_op_sha256[i] = rows[i].main_sel_op_sha256; + polys.main_sel_op_shl[i] = rows[i].main_sel_op_shl; + polys.main_sel_op_shr[i] = rows[i].main_sel_op_shr; + polys.main_sel_op_sload[i] = rows[i].main_sel_op_sload; + polys.main_sel_op_sstore[i] = rows[i].main_sel_op_sstore; + polys.main_sel_op_storage_address[i] = rows[i].main_sel_op_storage_address; + polys.main_sel_op_sub[i] = rows[i].main_sel_op_sub; + polys.main_sel_op_timestamp[i] = rows[i].main_sel_op_timestamp; + polys.main_sel_op_transaction_fee[i] = rows[i].main_sel_op_transaction_fee; + polys.main_sel_op_version[i] = rows[i].main_sel_op_version; + polys.main_sel_op_xor[i] = rows[i].main_sel_op_xor; + polys.main_sel_q_kernel_lookup[i] = rows[i].main_sel_q_kernel_lookup; + polys.main_sel_q_kernel_output_lookup[i] = rows[i].main_sel_q_kernel_output_lookup; + polys.main_sel_resolve_ind_addr_a[i] = rows[i].main_sel_resolve_ind_addr_a; + polys.main_sel_resolve_ind_addr_b[i] = rows[i].main_sel_resolve_ind_addr_b; + polys.main_sel_resolve_ind_addr_c[i] = rows[i].main_sel_resolve_ind_addr_c; + polys.main_sel_resolve_ind_addr_d[i] = rows[i].main_sel_resolve_ind_addr_d; + polys.main_sel_returndata[i] = rows[i].main_sel_returndata; + polys.main_sel_rng_16[i] = rows[i].main_sel_rng_16; + polys.main_sel_rng_8[i] = rows[i].main_sel_rng_8; + polys.main_sel_slice_gadget[i] = rows[i].main_sel_slice_gadget; + polys.main_space_id[i] = rows[i].main_space_id; + polys.main_tag_err[i] = rows[i].main_tag_err; + polys.main_w_in_tag[i] = rows[i].main_w_in_tag; + polys.mem_addr[i] = rows[i].mem_addr; + polys.mem_clk[i] = rows[i].mem_clk; + polys.mem_diff_hi[i] = rows[i].mem_diff_hi; + polys.mem_diff_lo[i] = rows[i].mem_diff_lo; + polys.mem_diff_mid[i] = rows[i].mem_diff_mid; + polys.mem_glob_addr[i] = rows[i].mem_glob_addr; + polys.mem_last[i] = rows[i].mem_last; + polys.mem_lastAccess[i] = rows[i].mem_lastAccess; + polys.mem_one_min_inv[i] = rows[i].mem_one_min_inv; + polys.mem_r_in_tag[i] = rows[i].mem_r_in_tag; + polys.mem_rw[i] = rows[i].mem_rw; + polys.mem_sel_mem[i] = rows[i].mem_sel_mem; + polys.mem_sel_mov_ia_to_ic[i] = rows[i].mem_sel_mov_ia_to_ic; + polys.mem_sel_mov_ib_to_ic[i] = rows[i].mem_sel_mov_ib_to_ic; + polys.mem_sel_op_a[i] = rows[i].mem_sel_op_a; + polys.mem_sel_op_b[i] = rows[i].mem_sel_op_b; + polys.mem_sel_op_c[i] = rows[i].mem_sel_op_c; + polys.mem_sel_op_cmov[i] = rows[i].mem_sel_op_cmov; + polys.mem_sel_op_d[i] = rows[i].mem_sel_op_d; + polys.mem_sel_op_slice[i] = rows[i].mem_sel_op_slice; + polys.mem_sel_resolve_ind_addr_a[i] = rows[i].mem_sel_resolve_ind_addr_a; + polys.mem_sel_resolve_ind_addr_b[i] = rows[i].mem_sel_resolve_ind_addr_b; + polys.mem_sel_resolve_ind_addr_c[i] = rows[i].mem_sel_resolve_ind_addr_c; + polys.mem_sel_resolve_ind_addr_d[i] = rows[i].mem_sel_resolve_ind_addr_d; + polys.mem_sel_rng_chk[i] = rows[i].mem_sel_rng_chk; + polys.mem_skip_check_tag[i] = rows[i].mem_skip_check_tag; + polys.mem_space_id[i] = rows[i].mem_space_id; + polys.mem_tag[i] = rows[i].mem_tag; + polys.mem_tag_err[i] = rows[i].mem_tag_err; + polys.mem_tsp[i] = rows[i].mem_tsp; + polys.mem_val[i] = rows[i].mem_val; + polys.mem_w_in_tag[i] = rows[i].mem_w_in_tag; + polys.pedersen_clk[i] = rows[i].pedersen_clk; + polys.pedersen_input[i] = rows[i].pedersen_input; + polys.pedersen_output[i] = rows[i].pedersen_output; + polys.pedersen_sel_pedersen[i] = rows[i].pedersen_sel_pedersen; + polys.poseidon2_clk[i] = rows[i].poseidon2_clk; + polys.poseidon2_input[i] = rows[i].poseidon2_input; + polys.poseidon2_output[i] = rows[i].poseidon2_output; + polys.poseidon2_sel_poseidon_perm[i] = rows[i].poseidon2_sel_poseidon_perm; + polys.powers_power_of_2[i] = rows[i].powers_power_of_2; + polys.sha256_clk[i] = rows[i].sha256_clk; + polys.sha256_input[i] = rows[i].sha256_input; + polys.sha256_output[i] = rows[i].sha256_output; + polys.sha256_sel_sha256_compression[i] = rows[i].sha256_sel_sha256_compression; + polys.sha256_state[i] = rows[i].sha256_state; + polys.slice_addr[i] = rows[i].slice_addr; + polys.slice_clk[i] = rows[i].slice_clk; + polys.slice_cnt[i] = rows[i].slice_cnt; + polys.slice_col_offset[i] = rows[i].slice_col_offset; + polys.slice_one_min_inv[i] = rows[i].slice_one_min_inv; + polys.slice_sel_cd_cpy[i] = rows[i].slice_sel_cd_cpy; + polys.slice_sel_mem_active[i] = rows[i].slice_sel_mem_active; + polys.slice_sel_return[i] = rows[i].slice_sel_return; + polys.slice_sel_start[i] = rows[i].slice_sel_start; + polys.slice_space_id[i] = rows[i].slice_space_id; + polys.slice_val[i] = rows[i].slice_val; + polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts; + polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts; + polys.lookup_cd_value_counts[i] = rows[i].lookup_cd_value_counts; + polys.lookup_ret_value_counts[i] = rows[i].lookup_ret_value_counts; + polys.lookup_opcode_gas_counts[i] = rows[i].lookup_opcode_gas_counts; + polys.range_check_l2_gas_hi_counts[i] = rows[i].range_check_l2_gas_hi_counts; + polys.range_check_l2_gas_lo_counts[i] = rows[i].range_check_l2_gas_lo_counts; + polys.range_check_da_gas_hi_counts[i] = rows[i].range_check_da_gas_hi_counts; + polys.range_check_da_gas_lo_counts[i] = rows[i].range_check_da_gas_lo_counts; + polys.kernel_output_lookup_counts[i] = rows[i].kernel_output_lookup_counts; + polys.lookup_into_kernel_counts[i] = rows[i].lookup_into_kernel_counts; + polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts; + polys.incl_mem_tag_err_counts[i] = rows[i].incl_mem_tag_err_counts; + polys.lookup_mem_rng_chk_lo_counts[i] = rows[i].lookup_mem_rng_chk_lo_counts; + polys.lookup_mem_rng_chk_mid_counts[i] = rows[i].lookup_mem_rng_chk_mid_counts; + polys.lookup_mem_rng_chk_hi_counts[i] = rows[i].lookup_mem_rng_chk_hi_counts; + polys.lookup_pow_2_0_counts[i] = rows[i].lookup_pow_2_0_counts; + polys.lookup_pow_2_1_counts[i] = rows[i].lookup_pow_2_1_counts; + polys.lookup_u8_0_counts[i] = rows[i].lookup_u8_0_counts; + polys.lookup_u8_1_counts[i] = rows[i].lookup_u8_1_counts; + polys.lookup_u16_0_counts[i] = rows[i].lookup_u16_0_counts; + polys.lookup_u16_1_counts[i] = rows[i].lookup_u16_1_counts; + polys.lookup_u16_2_counts[i] = rows[i].lookup_u16_2_counts; + polys.lookup_u16_3_counts[i] = rows[i].lookup_u16_3_counts; + polys.lookup_u16_4_counts[i] = rows[i].lookup_u16_4_counts; + polys.lookup_u16_5_counts[i] = rows[i].lookup_u16_5_counts; + polys.lookup_u16_6_counts[i] = rows[i].lookup_u16_6_counts; + polys.lookup_u16_7_counts[i] = rows[i].lookup_u16_7_counts; + polys.lookup_u16_8_counts[i] = rows[i].lookup_u16_8_counts; + polys.lookup_u16_9_counts[i] = rows[i].lookup_u16_9_counts; + polys.lookup_u16_10_counts[i] = rows[i].lookup_u16_10_counts; + polys.lookup_u16_11_counts[i] = rows[i].lookup_u16_11_counts; + polys.lookup_u16_12_counts[i] = rows[i].lookup_u16_12_counts; + polys.lookup_u16_13_counts[i] = rows[i].lookup_u16_13_counts; + polys.lookup_u16_14_counts[i] = rows[i].lookup_u16_14_counts; + polys.lookup_div_u16_0_counts[i] = rows[i].lookup_div_u16_0_counts; + polys.lookup_div_u16_1_counts[i] = rows[i].lookup_div_u16_1_counts; + polys.lookup_div_u16_2_counts[i] = rows[i].lookup_div_u16_2_counts; + polys.lookup_div_u16_3_counts[i] = rows[i].lookup_div_u16_3_counts; + polys.lookup_div_u16_4_counts[i] = rows[i].lookup_div_u16_4_counts; + polys.lookup_div_u16_5_counts[i] = rows[i].lookup_div_u16_5_counts; + polys.lookup_div_u16_6_counts[i] = rows[i].lookup_div_u16_6_counts; + polys.lookup_div_u16_7_counts[i] = rows[i].lookup_div_u16_7_counts; + } + + for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) { + shifted = to_be_shifted.shifted(); + } + + return polys; +} + +bool AvmCircuitBuilder::check_circuit() const +{ + const FF gamma = FF::random_element(); + const FF beta = FF::random_element(); + bb::RelationParameters params{ + .eta = 0, + .beta = beta, + .gamma = gamma, + .public_input_delta = 0, + .lookup_grand_product_delta = 0, + .beta_sqr = 0, + .beta_cube = 0, + .eccvm_set_permutation_delta = 0, + }; + + auto polys = compute_polynomials(); + const size_t num_rows = polys.get_polynomial_size(); + + // Checks that we will run. + using SignalErrorFn = const std::function&; + std::vector> checks; + + // Add relation checks. + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + using Relation = std::tuple_element_t; + checks.push_back([&](SignalErrorFn signal_error) { + typename Relation::SumcheckArrayOfValuesOverSubrelations result; + for (auto& r : result) { + r = 0; + } + constexpr size_t NUM_SUBRELATIONS = result.size(); + + for (size_t r = 0; r < num_rows; ++r) { + Relation::accumulate(result, polys.get_row(r), {}, 1); + for (size_t j = 0; j < NUM_SUBRELATIONS; ++j) { + if (result[j] != 0) { + signal_error(format("Relation ", + Relation::NAME, + ", subrelation ", + Relation::get_subrelation_label(j), + " failed at row ", + r)); + } + } + } + }); + }); + + // Add calculation of logderivatives and lookup/permutation checks. + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + using Relation = std::tuple_element_t; + checks.push_back([&, num_rows](SignalErrorFn signal_error) { + // Check the logderivative relation + bb::compute_logderivative_inverse(polys, params, num_rows); + + typename Relation::SumcheckArrayOfValuesOverSubrelations lookup_result; + + for (auto& r : lookup_result) { + r = 0; + } + for (size_t r = 0; r < num_rows; ++r) { + Relation::accumulate(lookup_result, polys.get_row(r), params, 1); + } + for (auto r : lookup_result) { + if (r != 0) { + signal_error(format("Lookup ", Relation::NAME, " failed.")); + } + } + }); + }); + + std::string errors; + std::mutex m; + auto signal_error = [&](const std::string& error) { + std::lock_guard lock(m); + errors += error + "\n"; + }; + bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); }); + if (!errors.empty()) { + throw_or_abort(errors); + } + + return errors.empty(); +} + +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index 9db07fe5038..40a2844a71e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -1,16 +1,8 @@ // AUTOGENERATED FILE #pragma once -#include #include -#include "barretenberg/common/constexpr_utils.hpp" -#include "barretenberg/common/thread.hpp" -#include "barretenberg/common/throw_or_abort.hpp" -#include "barretenberg/ecc/curves/bn254/fr.hpp" -#include "barretenberg/honk/proof_system/logderivative_library.hpp" -#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" -#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" #include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" #include "barretenberg/vm/generated/avm_flavor.hpp" @@ -34,469 +26,13 @@ class AvmCircuitBuilder { void set_trace(std::vector&& trace) { rows = std::move(trace); } - ProverPolynomials compute_polynomials() - { - const auto num_rows = get_circuit_subgroup_size(); - ProverPolynomials polys; - - // Allocate mem for each column - for (auto& poly : polys.get_all()) { - poly = Polynomial(num_rows); - } - - for (size_t i = 0; i < rows.size(); i++) { - polys.main_clk[i] = rows[i].main_clk; - polys.main_sel_first[i] = rows[i].main_sel_first; - polys.kernel_kernel_inputs[i] = rows[i].kernel_kernel_inputs; - polys.kernel_kernel_value_out[i] = rows[i].kernel_kernel_value_out; - polys.kernel_kernel_side_effect_out[i] = rows[i].kernel_kernel_side_effect_out; - polys.kernel_kernel_metadata_out[i] = rows[i].kernel_kernel_metadata_out; - polys.main_calldata[i] = rows[i].main_calldata; - polys.main_returndata[i] = rows[i].main_returndata; - polys.alu_a_hi[i] = rows[i].alu_a_hi; - polys.alu_a_lo[i] = rows[i].alu_a_lo; - polys.alu_b_hi[i] = rows[i].alu_b_hi; - polys.alu_b_lo[i] = rows[i].alu_b_lo; - polys.alu_borrow[i] = rows[i].alu_borrow; - polys.alu_cf[i] = rows[i].alu_cf; - polys.alu_clk[i] = rows[i].alu_clk; - polys.alu_cmp_rng_ctr[i] = rows[i].alu_cmp_rng_ctr; - polys.alu_div_u16_r0[i] = rows[i].alu_div_u16_r0; - polys.alu_div_u16_r1[i] = rows[i].alu_div_u16_r1; - polys.alu_div_u16_r2[i] = rows[i].alu_div_u16_r2; - polys.alu_div_u16_r3[i] = rows[i].alu_div_u16_r3; - polys.alu_div_u16_r4[i] = rows[i].alu_div_u16_r4; - polys.alu_div_u16_r5[i] = rows[i].alu_div_u16_r5; - polys.alu_div_u16_r6[i] = rows[i].alu_div_u16_r6; - polys.alu_div_u16_r7[i] = rows[i].alu_div_u16_r7; - polys.alu_divisor_hi[i] = rows[i].alu_divisor_hi; - polys.alu_divisor_lo[i] = rows[i].alu_divisor_lo; - polys.alu_ff_tag[i] = rows[i].alu_ff_tag; - polys.alu_ia[i] = rows[i].alu_ia; - polys.alu_ib[i] = rows[i].alu_ib; - polys.alu_ic[i] = rows[i].alu_ic; - polys.alu_in_tag[i] = rows[i].alu_in_tag; - polys.alu_op_add[i] = rows[i].alu_op_add; - polys.alu_op_cast[i] = rows[i].alu_op_cast; - polys.alu_op_cast_prev[i] = rows[i].alu_op_cast_prev; - polys.alu_op_div[i] = rows[i].alu_op_div; - polys.alu_op_div_a_lt_b[i] = rows[i].alu_op_div_a_lt_b; - polys.alu_op_div_std[i] = rows[i].alu_op_div_std; - polys.alu_op_eq[i] = rows[i].alu_op_eq; - polys.alu_op_eq_diff_inv[i] = rows[i].alu_op_eq_diff_inv; - polys.alu_op_lt[i] = rows[i].alu_op_lt; - polys.alu_op_lte[i] = rows[i].alu_op_lte; - polys.alu_op_mul[i] = rows[i].alu_op_mul; - polys.alu_op_not[i] = rows[i].alu_op_not; - polys.alu_op_shl[i] = rows[i].alu_op_shl; - polys.alu_op_shr[i] = rows[i].alu_op_shr; - polys.alu_op_sub[i] = rows[i].alu_op_sub; - polys.alu_p_a_borrow[i] = rows[i].alu_p_a_borrow; - polys.alu_p_b_borrow[i] = rows[i].alu_p_b_borrow; - polys.alu_p_sub_a_hi[i] = rows[i].alu_p_sub_a_hi; - polys.alu_p_sub_a_lo[i] = rows[i].alu_p_sub_a_lo; - polys.alu_p_sub_b_hi[i] = rows[i].alu_p_sub_b_hi; - polys.alu_p_sub_b_lo[i] = rows[i].alu_p_sub_b_lo; - polys.alu_partial_prod_hi[i] = rows[i].alu_partial_prod_hi; - polys.alu_partial_prod_lo[i] = rows[i].alu_partial_prod_lo; - polys.alu_quotient_hi[i] = rows[i].alu_quotient_hi; - polys.alu_quotient_lo[i] = rows[i].alu_quotient_lo; - polys.alu_remainder[i] = rows[i].alu_remainder; - polys.alu_res_hi[i] = rows[i].alu_res_hi; - polys.alu_res_lo[i] = rows[i].alu_res_lo; - polys.alu_sel_alu[i] = rows[i].alu_sel_alu; - polys.alu_sel_cmp[i] = rows[i].alu_sel_cmp; - polys.alu_sel_div_rng_chk[i] = rows[i].alu_sel_div_rng_chk; - polys.alu_sel_rng_chk[i] = rows[i].alu_sel_rng_chk; - polys.alu_sel_rng_chk_lookup[i] = rows[i].alu_sel_rng_chk_lookup; - polys.alu_sel_shift_which[i] = rows[i].alu_sel_shift_which; - polys.alu_shift_lt_bit_len[i] = rows[i].alu_shift_lt_bit_len; - polys.alu_t_sub_s_bits[i] = rows[i].alu_t_sub_s_bits; - polys.alu_two_pow_s[i] = rows[i].alu_two_pow_s; - polys.alu_two_pow_t_sub_s[i] = rows[i].alu_two_pow_t_sub_s; - polys.alu_u128_tag[i] = rows[i].alu_u128_tag; - polys.alu_u16_r0[i] = rows[i].alu_u16_r0; - polys.alu_u16_r1[i] = rows[i].alu_u16_r1; - polys.alu_u16_r10[i] = rows[i].alu_u16_r10; - polys.alu_u16_r11[i] = rows[i].alu_u16_r11; - polys.alu_u16_r12[i] = rows[i].alu_u16_r12; - polys.alu_u16_r13[i] = rows[i].alu_u16_r13; - polys.alu_u16_r14[i] = rows[i].alu_u16_r14; - polys.alu_u16_r2[i] = rows[i].alu_u16_r2; - polys.alu_u16_r3[i] = rows[i].alu_u16_r3; - polys.alu_u16_r4[i] = rows[i].alu_u16_r4; - polys.alu_u16_r5[i] = rows[i].alu_u16_r5; - polys.alu_u16_r6[i] = rows[i].alu_u16_r6; - polys.alu_u16_r7[i] = rows[i].alu_u16_r7; - polys.alu_u16_r8[i] = rows[i].alu_u16_r8; - polys.alu_u16_r9[i] = rows[i].alu_u16_r9; - polys.alu_u16_tag[i] = rows[i].alu_u16_tag; - polys.alu_u32_tag[i] = rows[i].alu_u32_tag; - polys.alu_u64_tag[i] = rows[i].alu_u64_tag; - polys.alu_u8_r0[i] = rows[i].alu_u8_r0; - polys.alu_u8_r1[i] = rows[i].alu_u8_r1; - polys.alu_u8_tag[i] = rows[i].alu_u8_tag; - polys.binary_acc_ia[i] = rows[i].binary_acc_ia; - polys.binary_acc_ib[i] = rows[i].binary_acc_ib; - polys.binary_acc_ic[i] = rows[i].binary_acc_ic; - polys.binary_clk[i] = rows[i].binary_clk; - polys.binary_ia_bytes[i] = rows[i].binary_ia_bytes; - polys.binary_ib_bytes[i] = rows[i].binary_ib_bytes; - polys.binary_ic_bytes[i] = rows[i].binary_ic_bytes; - polys.binary_in_tag[i] = rows[i].binary_in_tag; - polys.binary_mem_tag_ctr[i] = rows[i].binary_mem_tag_ctr; - polys.binary_mem_tag_ctr_inv[i] = rows[i].binary_mem_tag_ctr_inv; - polys.binary_op_id[i] = rows[i].binary_op_id; - polys.binary_sel_bin[i] = rows[i].binary_sel_bin; - polys.binary_start[i] = rows[i].binary_start; - polys.byte_lookup_sel_bin[i] = rows[i].byte_lookup_sel_bin; - polys.byte_lookup_table_byte_lengths[i] = rows[i].byte_lookup_table_byte_lengths; - polys.byte_lookup_table_in_tags[i] = rows[i].byte_lookup_table_in_tags; - polys.byte_lookup_table_input_a[i] = rows[i].byte_lookup_table_input_a; - polys.byte_lookup_table_input_b[i] = rows[i].byte_lookup_table_input_b; - polys.byte_lookup_table_op_id[i] = rows[i].byte_lookup_table_op_id; - polys.byte_lookup_table_output[i] = rows[i].byte_lookup_table_output; - polys.conversion_clk[i] = rows[i].conversion_clk; - polys.conversion_input[i] = rows[i].conversion_input; - polys.conversion_num_limbs[i] = rows[i].conversion_num_limbs; - polys.conversion_radix[i] = rows[i].conversion_radix; - polys.conversion_sel_to_radix_le[i] = rows[i].conversion_sel_to_radix_le; - polys.gas_da_gas_fixed_table[i] = rows[i].gas_da_gas_fixed_table; - polys.gas_l2_gas_fixed_table[i] = rows[i].gas_l2_gas_fixed_table; - polys.gas_sel_gas_cost[i] = rows[i].gas_sel_gas_cost; - polys.keccakf1600_clk[i] = rows[i].keccakf1600_clk; - polys.keccakf1600_input[i] = rows[i].keccakf1600_input; - polys.keccakf1600_output[i] = rows[i].keccakf1600_output; - polys.keccakf1600_sel_keccakf1600[i] = rows[i].keccakf1600_sel_keccakf1600; - polys.kernel_emit_l2_to_l1_msg_write_offset[i] = rows[i].kernel_emit_l2_to_l1_msg_write_offset; - polys.kernel_emit_note_hash_write_offset[i] = rows[i].kernel_emit_note_hash_write_offset; - polys.kernel_emit_nullifier_write_offset[i] = rows[i].kernel_emit_nullifier_write_offset; - polys.kernel_emit_unencrypted_log_write_offset[i] = rows[i].kernel_emit_unencrypted_log_write_offset; - polys.kernel_kernel_in_offset[i] = rows[i].kernel_kernel_in_offset; - polys.kernel_kernel_out_offset[i] = rows[i].kernel_kernel_out_offset; - polys.kernel_l1_to_l2_msg_exists_write_offset[i] = rows[i].kernel_l1_to_l2_msg_exists_write_offset; - polys.kernel_note_hash_exist_write_offset[i] = rows[i].kernel_note_hash_exist_write_offset; - polys.kernel_nullifier_exists_write_offset[i] = rows[i].kernel_nullifier_exists_write_offset; - polys.kernel_nullifier_non_exists_write_offset[i] = rows[i].kernel_nullifier_non_exists_write_offset; - polys.kernel_q_public_input_kernel_add_to_table[i] = rows[i].kernel_q_public_input_kernel_add_to_table; - polys.kernel_q_public_input_kernel_out_add_to_table[i] = - rows[i].kernel_q_public_input_kernel_out_add_to_table; - polys.kernel_side_effect_counter[i] = rows[i].kernel_side_effect_counter; - polys.kernel_sload_write_offset[i] = rows[i].kernel_sload_write_offset; - polys.kernel_sstore_write_offset[i] = rows[i].kernel_sstore_write_offset; - polys.main_abs_da_rem_gas_hi[i] = rows[i].main_abs_da_rem_gas_hi; - polys.main_abs_da_rem_gas_lo[i] = rows[i].main_abs_da_rem_gas_lo; - polys.main_abs_l2_rem_gas_hi[i] = rows[i].main_abs_l2_rem_gas_hi; - polys.main_abs_l2_rem_gas_lo[i] = rows[i].main_abs_l2_rem_gas_lo; - polys.main_alu_in_tag[i] = rows[i].main_alu_in_tag; - polys.main_bin_op_id[i] = rows[i].main_bin_op_id; - polys.main_call_ptr[i] = rows[i].main_call_ptr; - polys.main_da_gas_op_cost[i] = rows[i].main_da_gas_op_cost; - polys.main_da_gas_remaining[i] = rows[i].main_da_gas_remaining; - polys.main_da_out_of_gas[i] = rows[i].main_da_out_of_gas; - polys.main_ia[i] = rows[i].main_ia; - polys.main_ib[i] = rows[i].main_ib; - polys.main_ic[i] = rows[i].main_ic; - polys.main_id[i] = rows[i].main_id; - polys.main_id_zero[i] = rows[i].main_id_zero; - polys.main_ind_addr_a[i] = rows[i].main_ind_addr_a; - polys.main_ind_addr_b[i] = rows[i].main_ind_addr_b; - polys.main_ind_addr_c[i] = rows[i].main_ind_addr_c; - polys.main_ind_addr_d[i] = rows[i].main_ind_addr_d; - polys.main_internal_return_ptr[i] = rows[i].main_internal_return_ptr; - polys.main_inv[i] = rows[i].main_inv; - polys.main_l2_gas_op_cost[i] = rows[i].main_l2_gas_op_cost; - polys.main_l2_gas_remaining[i] = rows[i].main_l2_gas_remaining; - polys.main_l2_out_of_gas[i] = rows[i].main_l2_out_of_gas; - polys.main_mem_addr_a[i] = rows[i].main_mem_addr_a; - polys.main_mem_addr_b[i] = rows[i].main_mem_addr_b; - polys.main_mem_addr_c[i] = rows[i].main_mem_addr_c; - polys.main_mem_addr_d[i] = rows[i].main_mem_addr_d; - polys.main_op_err[i] = rows[i].main_op_err; - polys.main_opcode_val[i] = rows[i].main_opcode_val; - polys.main_pc[i] = rows[i].main_pc; - polys.main_r_in_tag[i] = rows[i].main_r_in_tag; - polys.main_rwa[i] = rows[i].main_rwa; - polys.main_rwb[i] = rows[i].main_rwb; - polys.main_rwc[i] = rows[i].main_rwc; - polys.main_rwd[i] = rows[i].main_rwd; - polys.main_sel_alu[i] = rows[i].main_sel_alu; - polys.main_sel_bin[i] = rows[i].main_sel_bin; - polys.main_sel_calldata[i] = rows[i].main_sel_calldata; - polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; - polys.main_sel_last[i] = rows[i].main_sel_last; - polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; - polys.main_sel_mem_op_activate_gas[i] = rows[i].main_sel_mem_op_activate_gas; - polys.main_sel_mem_op_b[i] = rows[i].main_sel_mem_op_b; - polys.main_sel_mem_op_c[i] = rows[i].main_sel_mem_op_c; - polys.main_sel_mem_op_d[i] = rows[i].main_sel_mem_op_d; - polys.main_sel_mov_ia_to_ic[i] = rows[i].main_sel_mov_ia_to_ic; - polys.main_sel_mov_ib_to_ic[i] = rows[i].main_sel_mov_ib_to_ic; - polys.main_sel_op_add[i] = rows[i].main_sel_op_add; - polys.main_sel_op_address[i] = rows[i].main_sel_op_address; - polys.main_sel_op_and[i] = rows[i].main_sel_op_and; - polys.main_sel_op_block_number[i] = rows[i].main_sel_op_block_number; - polys.main_sel_op_calldata_copy[i] = rows[i].main_sel_op_calldata_copy; - polys.main_sel_op_cast[i] = rows[i].main_sel_op_cast; - polys.main_sel_op_chain_id[i] = rows[i].main_sel_op_chain_id; - polys.main_sel_op_cmov[i] = rows[i].main_sel_op_cmov; - polys.main_sel_op_coinbase[i] = rows[i].main_sel_op_coinbase; - polys.main_sel_op_dagasleft[i] = rows[i].main_sel_op_dagasleft; - polys.main_sel_op_div[i] = rows[i].main_sel_op_div; - polys.main_sel_op_emit_l2_to_l1_msg[i] = rows[i].main_sel_op_emit_l2_to_l1_msg; - polys.main_sel_op_emit_note_hash[i] = rows[i].main_sel_op_emit_note_hash; - polys.main_sel_op_emit_nullifier[i] = rows[i].main_sel_op_emit_nullifier; - polys.main_sel_op_emit_unencrypted_log[i] = rows[i].main_sel_op_emit_unencrypted_log; - polys.main_sel_op_eq[i] = rows[i].main_sel_op_eq; - polys.main_sel_op_external_call[i] = rows[i].main_sel_op_external_call; - polys.main_sel_op_external_return[i] = rows[i].main_sel_op_external_return; - polys.main_sel_op_fdiv[i] = rows[i].main_sel_op_fdiv; - polys.main_sel_op_fee_per_da_gas[i] = rows[i].main_sel_op_fee_per_da_gas; - polys.main_sel_op_fee_per_l2_gas[i] = rows[i].main_sel_op_fee_per_l2_gas; - polys.main_sel_op_function_selector[i] = rows[i].main_sel_op_function_selector; - polys.main_sel_op_get_contract_instance[i] = rows[i].main_sel_op_get_contract_instance; - polys.main_sel_op_halt[i] = rows[i].main_sel_op_halt; - polys.main_sel_op_internal_call[i] = rows[i].main_sel_op_internal_call; - polys.main_sel_op_internal_return[i] = rows[i].main_sel_op_internal_return; - polys.main_sel_op_jump[i] = rows[i].main_sel_op_jump; - polys.main_sel_op_jumpi[i] = rows[i].main_sel_op_jumpi; - polys.main_sel_op_keccak[i] = rows[i].main_sel_op_keccak; - polys.main_sel_op_l1_to_l2_msg_exists[i] = rows[i].main_sel_op_l1_to_l2_msg_exists; - polys.main_sel_op_l2gasleft[i] = rows[i].main_sel_op_l2gasleft; - polys.main_sel_op_lt[i] = rows[i].main_sel_op_lt; - polys.main_sel_op_lte[i] = rows[i].main_sel_op_lte; - polys.main_sel_op_mov[i] = rows[i].main_sel_op_mov; - polys.main_sel_op_mul[i] = rows[i].main_sel_op_mul; - polys.main_sel_op_not[i] = rows[i].main_sel_op_not; - polys.main_sel_op_note_hash_exists[i] = rows[i].main_sel_op_note_hash_exists; - polys.main_sel_op_nullifier_exists[i] = rows[i].main_sel_op_nullifier_exists; - polys.main_sel_op_or[i] = rows[i].main_sel_op_or; - polys.main_sel_op_pedersen[i] = rows[i].main_sel_op_pedersen; - polys.main_sel_op_poseidon2[i] = rows[i].main_sel_op_poseidon2; - polys.main_sel_op_radix_le[i] = rows[i].main_sel_op_radix_le; - polys.main_sel_op_sender[i] = rows[i].main_sel_op_sender; - polys.main_sel_op_sha256[i] = rows[i].main_sel_op_sha256; - polys.main_sel_op_shl[i] = rows[i].main_sel_op_shl; - polys.main_sel_op_shr[i] = rows[i].main_sel_op_shr; - polys.main_sel_op_sload[i] = rows[i].main_sel_op_sload; - polys.main_sel_op_sstore[i] = rows[i].main_sel_op_sstore; - polys.main_sel_op_storage_address[i] = rows[i].main_sel_op_storage_address; - polys.main_sel_op_sub[i] = rows[i].main_sel_op_sub; - polys.main_sel_op_timestamp[i] = rows[i].main_sel_op_timestamp; - polys.main_sel_op_transaction_fee[i] = rows[i].main_sel_op_transaction_fee; - polys.main_sel_op_version[i] = rows[i].main_sel_op_version; - polys.main_sel_op_xor[i] = rows[i].main_sel_op_xor; - polys.main_sel_q_kernel_lookup[i] = rows[i].main_sel_q_kernel_lookup; - polys.main_sel_q_kernel_output_lookup[i] = rows[i].main_sel_q_kernel_output_lookup; - polys.main_sel_resolve_ind_addr_a[i] = rows[i].main_sel_resolve_ind_addr_a; - polys.main_sel_resolve_ind_addr_b[i] = rows[i].main_sel_resolve_ind_addr_b; - polys.main_sel_resolve_ind_addr_c[i] = rows[i].main_sel_resolve_ind_addr_c; - polys.main_sel_resolve_ind_addr_d[i] = rows[i].main_sel_resolve_ind_addr_d; - polys.main_sel_returndata[i] = rows[i].main_sel_returndata; - polys.main_sel_rng_16[i] = rows[i].main_sel_rng_16; - polys.main_sel_rng_8[i] = rows[i].main_sel_rng_8; - polys.main_sel_slice_gadget[i] = rows[i].main_sel_slice_gadget; - polys.main_space_id[i] = rows[i].main_space_id; - polys.main_tag_err[i] = rows[i].main_tag_err; - polys.main_w_in_tag[i] = rows[i].main_w_in_tag; - polys.mem_addr[i] = rows[i].mem_addr; - polys.mem_clk[i] = rows[i].mem_clk; - polys.mem_diff_hi[i] = rows[i].mem_diff_hi; - polys.mem_diff_lo[i] = rows[i].mem_diff_lo; - polys.mem_diff_mid[i] = rows[i].mem_diff_mid; - polys.mem_glob_addr[i] = rows[i].mem_glob_addr; - polys.mem_last[i] = rows[i].mem_last; - polys.mem_lastAccess[i] = rows[i].mem_lastAccess; - polys.mem_one_min_inv[i] = rows[i].mem_one_min_inv; - polys.mem_r_in_tag[i] = rows[i].mem_r_in_tag; - polys.mem_rw[i] = rows[i].mem_rw; - polys.mem_sel_mem[i] = rows[i].mem_sel_mem; - polys.mem_sel_mov_ia_to_ic[i] = rows[i].mem_sel_mov_ia_to_ic; - polys.mem_sel_mov_ib_to_ic[i] = rows[i].mem_sel_mov_ib_to_ic; - polys.mem_sel_op_a[i] = rows[i].mem_sel_op_a; - polys.mem_sel_op_b[i] = rows[i].mem_sel_op_b; - polys.mem_sel_op_c[i] = rows[i].mem_sel_op_c; - polys.mem_sel_op_cmov[i] = rows[i].mem_sel_op_cmov; - polys.mem_sel_op_d[i] = rows[i].mem_sel_op_d; - polys.mem_sel_op_slice[i] = rows[i].mem_sel_op_slice; - polys.mem_sel_resolve_ind_addr_a[i] = rows[i].mem_sel_resolve_ind_addr_a; - polys.mem_sel_resolve_ind_addr_b[i] = rows[i].mem_sel_resolve_ind_addr_b; - polys.mem_sel_resolve_ind_addr_c[i] = rows[i].mem_sel_resolve_ind_addr_c; - polys.mem_sel_resolve_ind_addr_d[i] = rows[i].mem_sel_resolve_ind_addr_d; - polys.mem_sel_rng_chk[i] = rows[i].mem_sel_rng_chk; - polys.mem_skip_check_tag[i] = rows[i].mem_skip_check_tag; - polys.mem_space_id[i] = rows[i].mem_space_id; - polys.mem_tag[i] = rows[i].mem_tag; - polys.mem_tag_err[i] = rows[i].mem_tag_err; - polys.mem_tsp[i] = rows[i].mem_tsp; - polys.mem_val[i] = rows[i].mem_val; - polys.mem_w_in_tag[i] = rows[i].mem_w_in_tag; - polys.pedersen_clk[i] = rows[i].pedersen_clk; - polys.pedersen_input[i] = rows[i].pedersen_input; - polys.pedersen_output[i] = rows[i].pedersen_output; - polys.pedersen_sel_pedersen[i] = rows[i].pedersen_sel_pedersen; - polys.poseidon2_clk[i] = rows[i].poseidon2_clk; - polys.poseidon2_input[i] = rows[i].poseidon2_input; - polys.poseidon2_output[i] = rows[i].poseidon2_output; - polys.poseidon2_sel_poseidon_perm[i] = rows[i].poseidon2_sel_poseidon_perm; - polys.powers_power_of_2[i] = rows[i].powers_power_of_2; - polys.sha256_clk[i] = rows[i].sha256_clk; - polys.sha256_input[i] = rows[i].sha256_input; - polys.sha256_output[i] = rows[i].sha256_output; - polys.sha256_sel_sha256_compression[i] = rows[i].sha256_sel_sha256_compression; - polys.sha256_state[i] = rows[i].sha256_state; - polys.slice_addr[i] = rows[i].slice_addr; - polys.slice_clk[i] = rows[i].slice_clk; - polys.slice_cnt[i] = rows[i].slice_cnt; - polys.slice_col_offset[i] = rows[i].slice_col_offset; - polys.slice_one_min_inv[i] = rows[i].slice_one_min_inv; - polys.slice_sel_cd_cpy[i] = rows[i].slice_sel_cd_cpy; - polys.slice_sel_mem_active[i] = rows[i].slice_sel_mem_active; - polys.slice_sel_return[i] = rows[i].slice_sel_return; - polys.slice_sel_start[i] = rows[i].slice_sel_start; - polys.slice_space_id[i] = rows[i].slice_space_id; - polys.slice_val[i] = rows[i].slice_val; - polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts; - polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts; - polys.lookup_cd_value_counts[i] = rows[i].lookup_cd_value_counts; - polys.lookup_ret_value_counts[i] = rows[i].lookup_ret_value_counts; - polys.lookup_opcode_gas_counts[i] = rows[i].lookup_opcode_gas_counts; - polys.range_check_l2_gas_hi_counts[i] = rows[i].range_check_l2_gas_hi_counts; - polys.range_check_l2_gas_lo_counts[i] = rows[i].range_check_l2_gas_lo_counts; - polys.range_check_da_gas_hi_counts[i] = rows[i].range_check_da_gas_hi_counts; - polys.range_check_da_gas_lo_counts[i] = rows[i].range_check_da_gas_lo_counts; - polys.kernel_output_lookup_counts[i] = rows[i].kernel_output_lookup_counts; - polys.lookup_into_kernel_counts[i] = rows[i].lookup_into_kernel_counts; - polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts; - polys.incl_mem_tag_err_counts[i] = rows[i].incl_mem_tag_err_counts; - polys.lookup_mem_rng_chk_lo_counts[i] = rows[i].lookup_mem_rng_chk_lo_counts; - polys.lookup_mem_rng_chk_mid_counts[i] = rows[i].lookup_mem_rng_chk_mid_counts; - polys.lookup_mem_rng_chk_hi_counts[i] = rows[i].lookup_mem_rng_chk_hi_counts; - polys.lookup_pow_2_0_counts[i] = rows[i].lookup_pow_2_0_counts; - polys.lookup_pow_2_1_counts[i] = rows[i].lookup_pow_2_1_counts; - polys.lookup_u8_0_counts[i] = rows[i].lookup_u8_0_counts; - polys.lookup_u8_1_counts[i] = rows[i].lookup_u8_1_counts; - polys.lookup_u16_0_counts[i] = rows[i].lookup_u16_0_counts; - polys.lookup_u16_1_counts[i] = rows[i].lookup_u16_1_counts; - polys.lookup_u16_2_counts[i] = rows[i].lookup_u16_2_counts; - polys.lookup_u16_3_counts[i] = rows[i].lookup_u16_3_counts; - polys.lookup_u16_4_counts[i] = rows[i].lookup_u16_4_counts; - polys.lookup_u16_5_counts[i] = rows[i].lookup_u16_5_counts; - polys.lookup_u16_6_counts[i] = rows[i].lookup_u16_6_counts; - polys.lookup_u16_7_counts[i] = rows[i].lookup_u16_7_counts; - polys.lookup_u16_8_counts[i] = rows[i].lookup_u16_8_counts; - polys.lookup_u16_9_counts[i] = rows[i].lookup_u16_9_counts; - polys.lookup_u16_10_counts[i] = rows[i].lookup_u16_10_counts; - polys.lookup_u16_11_counts[i] = rows[i].lookup_u16_11_counts; - polys.lookup_u16_12_counts[i] = rows[i].lookup_u16_12_counts; - polys.lookup_u16_13_counts[i] = rows[i].lookup_u16_13_counts; - polys.lookup_u16_14_counts[i] = rows[i].lookup_u16_14_counts; - polys.lookup_div_u16_0_counts[i] = rows[i].lookup_div_u16_0_counts; - polys.lookup_div_u16_1_counts[i] = rows[i].lookup_div_u16_1_counts; - polys.lookup_div_u16_2_counts[i] = rows[i].lookup_div_u16_2_counts; - polys.lookup_div_u16_3_counts[i] = rows[i].lookup_div_u16_3_counts; - polys.lookup_div_u16_4_counts[i] = rows[i].lookup_div_u16_4_counts; - polys.lookup_div_u16_5_counts[i] = rows[i].lookup_div_u16_5_counts; - polys.lookup_div_u16_6_counts[i] = rows[i].lookup_div_u16_6_counts; - polys.lookup_div_u16_7_counts[i] = rows[i].lookup_div_u16_7_counts; - } - - for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) { - shifted = to_be_shifted.shifted(); - } - - return polys; - } - - [[maybe_unused]] bool check_circuit() - { - const FF gamma = FF::random_element(); - const FF beta = FF::random_element(); - bb::RelationParameters params{ - .eta = 0, - .beta = beta, - .gamma = gamma, - .public_input_delta = 0, - .lookup_grand_product_delta = 0, - .beta_sqr = 0, - .beta_cube = 0, - .eccvm_set_permutation_delta = 0, - }; - - auto polys = compute_polynomials(); - const size_t num_rows = polys.get_polynomial_size(); + ProverPolynomials compute_polynomials() const; - // Checks that we will run. - using SignalErrorFn = const std::function&; - std::vector> checks; - - // Add relation checks. - bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { - using Relation = std::tuple_element_t; - checks.push_back([&](SignalErrorFn signal_error) { - typename Relation::SumcheckArrayOfValuesOverSubrelations result; - for (auto& r : result) { - r = 0; - } - constexpr size_t NUM_SUBRELATIONS = result.size(); - - for (size_t r = 0; r < num_rows; ++r) { - Relation::accumulate(result, polys.get_row(r), {}, 1); - for (size_t j = 0; j < NUM_SUBRELATIONS; ++j) { - if (result[j] != 0) { - signal_error(format("Relation ", - Relation::NAME, - ", subrelation ", - Relation::get_subrelation_label(j), - " failed at row ", - r)); - } - } - } - }); - }); - - // Add calculation of logderivatives and lookup/permutation checks. - bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { - using Relation = std::tuple_element_t; - checks.push_back([&, num_rows](SignalErrorFn signal_error) { - // Check the logderivative relation - bb::compute_logderivative_inverse(polys, params, num_rows); - - typename Relation::SumcheckArrayOfValuesOverSubrelations lookup_result; - - for (auto& r : lookup_result) { - r = 0; - } - for (size_t r = 0; r < num_rows; ++r) { - Relation::accumulate(lookup_result, polys.get_row(r), params, 1); - } - for (auto r : lookup_result) { - if (r != 0) { - signal_error(format("Lookup ", Relation::NAME, " failed.")); - } - } - }); - }); - - std::string errors; - auto signal_error = [&](const std::string& error) { - // Thread safety first! - static std::mutex m; - std::lock_guard lock(m); - errors += error + "\n"; - }; - bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); }); - if (!errors.empty()) { - throw_or_abort(errors); - } - - return errors.empty(); - } + bool check_circuit() const; - [[nodiscard]] size_t get_num_gates() const { return rows.size(); } + size_t get_num_gates() const { return rows.size(); } - [[nodiscard]] size_t get_circuit_subgroup_size() const + size_t get_circuit_subgroup_size() const { const size_t num_rows = get_num_gates(); const auto num_rows_log2 = static_cast(numeric::get_msb64(num_rows)); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp index e0086cfeab0..3694d429693 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/avm_composer.hpp" #include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp index 796e85f346c..bf1e0f381b0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.cpp new file mode 100644 index 00000000000..59874f2bca6 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.cpp @@ -0,0 +1,1471 @@ +// AUTOGENERATED FILE +#include "barretenberg/vm/generated/avm_flavor.hpp" + +namespace bb { + +AvmFlavor::AllConstRefValues::AllConstRefValues(const RefArray& il) + : main_clk(il[0]) + , main_sel_first(il[1]) + , kernel_kernel_inputs(il[2]) + , kernel_kernel_value_out(il[3]) + , kernel_kernel_side_effect_out(il[4]) + , kernel_kernel_metadata_out(il[5]) + , main_calldata(il[6]) + , main_returndata(il[7]) + , alu_a_hi(il[8]) + , alu_a_lo(il[9]) + , alu_b_hi(il[10]) + , alu_b_lo(il[11]) + , alu_borrow(il[12]) + , alu_cf(il[13]) + , alu_clk(il[14]) + , alu_cmp_rng_ctr(il[15]) + , alu_div_u16_r0(il[16]) + , alu_div_u16_r1(il[17]) + , alu_div_u16_r2(il[18]) + , alu_div_u16_r3(il[19]) + , alu_div_u16_r4(il[20]) + , alu_div_u16_r5(il[21]) + , alu_div_u16_r6(il[22]) + , alu_div_u16_r7(il[23]) + , alu_divisor_hi(il[24]) + , alu_divisor_lo(il[25]) + , alu_ff_tag(il[26]) + , alu_ia(il[27]) + , alu_ib(il[28]) + , alu_ic(il[29]) + , alu_in_tag(il[30]) + , alu_op_add(il[31]) + , alu_op_cast(il[32]) + , alu_op_cast_prev(il[33]) + , alu_op_div(il[34]) + , alu_op_div_a_lt_b(il[35]) + , alu_op_div_std(il[36]) + , alu_op_eq(il[37]) + , alu_op_eq_diff_inv(il[38]) + , alu_op_lt(il[39]) + , alu_op_lte(il[40]) + , alu_op_mul(il[41]) + , alu_op_not(il[42]) + , alu_op_shl(il[43]) + , alu_op_shr(il[44]) + , alu_op_sub(il[45]) + , alu_p_a_borrow(il[46]) + , alu_p_b_borrow(il[47]) + , alu_p_sub_a_hi(il[48]) + , alu_p_sub_a_lo(il[49]) + , alu_p_sub_b_hi(il[50]) + , alu_p_sub_b_lo(il[51]) + , alu_partial_prod_hi(il[52]) + , alu_partial_prod_lo(il[53]) + , alu_quotient_hi(il[54]) + , alu_quotient_lo(il[55]) + , alu_remainder(il[56]) + , alu_res_hi(il[57]) + , alu_res_lo(il[58]) + , alu_sel_alu(il[59]) + , alu_sel_cmp(il[60]) + , alu_sel_div_rng_chk(il[61]) + , alu_sel_rng_chk(il[62]) + , alu_sel_rng_chk_lookup(il[63]) + , alu_sel_shift_which(il[64]) + , alu_shift_lt_bit_len(il[65]) + , alu_t_sub_s_bits(il[66]) + , alu_two_pow_s(il[67]) + , alu_two_pow_t_sub_s(il[68]) + , alu_u128_tag(il[69]) + , alu_u16_r0(il[70]) + , alu_u16_r1(il[71]) + , alu_u16_r10(il[72]) + , alu_u16_r11(il[73]) + , alu_u16_r12(il[74]) + , alu_u16_r13(il[75]) + , alu_u16_r14(il[76]) + , alu_u16_r2(il[77]) + , alu_u16_r3(il[78]) + , alu_u16_r4(il[79]) + , alu_u16_r5(il[80]) + , alu_u16_r6(il[81]) + , alu_u16_r7(il[82]) + , alu_u16_r8(il[83]) + , alu_u16_r9(il[84]) + , alu_u16_tag(il[85]) + , alu_u32_tag(il[86]) + , alu_u64_tag(il[87]) + , alu_u8_r0(il[88]) + , alu_u8_r1(il[89]) + , alu_u8_tag(il[90]) + , binary_acc_ia(il[91]) + , binary_acc_ib(il[92]) + , binary_acc_ic(il[93]) + , binary_clk(il[94]) + , binary_ia_bytes(il[95]) + , binary_ib_bytes(il[96]) + , binary_ic_bytes(il[97]) + , binary_in_tag(il[98]) + , binary_mem_tag_ctr(il[99]) + , binary_mem_tag_ctr_inv(il[100]) + , binary_op_id(il[101]) + , binary_sel_bin(il[102]) + , binary_start(il[103]) + , byte_lookup_sel_bin(il[104]) + , byte_lookup_table_byte_lengths(il[105]) + , byte_lookup_table_in_tags(il[106]) + , byte_lookup_table_input_a(il[107]) + , byte_lookup_table_input_b(il[108]) + , byte_lookup_table_op_id(il[109]) + , byte_lookup_table_output(il[110]) + , conversion_clk(il[111]) + , conversion_input(il[112]) + , conversion_num_limbs(il[113]) + , conversion_radix(il[114]) + , conversion_sel_to_radix_le(il[115]) + , gas_da_gas_fixed_table(il[116]) + , gas_l2_gas_fixed_table(il[117]) + , gas_sel_gas_cost(il[118]) + , keccakf1600_clk(il[119]) + , keccakf1600_input(il[120]) + , keccakf1600_output(il[121]) + , keccakf1600_sel_keccakf1600(il[122]) + , kernel_emit_l2_to_l1_msg_write_offset(il[123]) + , kernel_emit_note_hash_write_offset(il[124]) + , kernel_emit_nullifier_write_offset(il[125]) + , kernel_emit_unencrypted_log_write_offset(il[126]) + , kernel_kernel_in_offset(il[127]) + , kernel_kernel_out_offset(il[128]) + , kernel_l1_to_l2_msg_exists_write_offset(il[129]) + , kernel_note_hash_exist_write_offset(il[130]) + , kernel_nullifier_exists_write_offset(il[131]) + , kernel_nullifier_non_exists_write_offset(il[132]) + , kernel_q_public_input_kernel_add_to_table(il[133]) + , kernel_q_public_input_kernel_out_add_to_table(il[134]) + , kernel_side_effect_counter(il[135]) + , kernel_sload_write_offset(il[136]) + , kernel_sstore_write_offset(il[137]) + , main_abs_da_rem_gas_hi(il[138]) + , main_abs_da_rem_gas_lo(il[139]) + , main_abs_l2_rem_gas_hi(il[140]) + , main_abs_l2_rem_gas_lo(il[141]) + , main_alu_in_tag(il[142]) + , main_bin_op_id(il[143]) + , main_call_ptr(il[144]) + , main_da_gas_op_cost(il[145]) + , main_da_gas_remaining(il[146]) + , main_da_out_of_gas(il[147]) + , main_ia(il[148]) + , main_ib(il[149]) + , main_ic(il[150]) + , main_id(il[151]) + , main_id_zero(il[152]) + , main_ind_addr_a(il[153]) + , main_ind_addr_b(il[154]) + , main_ind_addr_c(il[155]) + , main_ind_addr_d(il[156]) + , main_internal_return_ptr(il[157]) + , main_inv(il[158]) + , main_l2_gas_op_cost(il[159]) + , main_l2_gas_remaining(il[160]) + , main_l2_out_of_gas(il[161]) + , main_mem_addr_a(il[162]) + , main_mem_addr_b(il[163]) + , main_mem_addr_c(il[164]) + , main_mem_addr_d(il[165]) + , main_op_err(il[166]) + , main_opcode_val(il[167]) + , main_pc(il[168]) + , main_r_in_tag(il[169]) + , main_rwa(il[170]) + , main_rwb(il[171]) + , main_rwc(il[172]) + , main_rwd(il[173]) + , main_sel_alu(il[174]) + , main_sel_bin(il[175]) + , main_sel_calldata(il[176]) + , main_sel_gas_accounting_active(il[177]) + , main_sel_last(il[178]) + , main_sel_mem_op_a(il[179]) + , main_sel_mem_op_activate_gas(il[180]) + , main_sel_mem_op_b(il[181]) + , main_sel_mem_op_c(il[182]) + , main_sel_mem_op_d(il[183]) + , main_sel_mov_ia_to_ic(il[184]) + , main_sel_mov_ib_to_ic(il[185]) + , main_sel_op_add(il[186]) + , main_sel_op_address(il[187]) + , main_sel_op_and(il[188]) + , main_sel_op_block_number(il[189]) + , main_sel_op_calldata_copy(il[190]) + , main_sel_op_cast(il[191]) + , main_sel_op_chain_id(il[192]) + , main_sel_op_cmov(il[193]) + , main_sel_op_coinbase(il[194]) + , main_sel_op_dagasleft(il[195]) + , main_sel_op_div(il[196]) + , main_sel_op_emit_l2_to_l1_msg(il[197]) + , main_sel_op_emit_note_hash(il[198]) + , main_sel_op_emit_nullifier(il[199]) + , main_sel_op_emit_unencrypted_log(il[200]) + , main_sel_op_eq(il[201]) + , main_sel_op_external_call(il[202]) + , main_sel_op_external_return(il[203]) + , main_sel_op_fdiv(il[204]) + , main_sel_op_fee_per_da_gas(il[205]) + , main_sel_op_fee_per_l2_gas(il[206]) + , main_sel_op_function_selector(il[207]) + , main_sel_op_get_contract_instance(il[208]) + , main_sel_op_halt(il[209]) + , main_sel_op_internal_call(il[210]) + , main_sel_op_internal_return(il[211]) + , main_sel_op_jump(il[212]) + , main_sel_op_jumpi(il[213]) + , main_sel_op_keccak(il[214]) + , main_sel_op_l1_to_l2_msg_exists(il[215]) + , main_sel_op_l2gasleft(il[216]) + , main_sel_op_lt(il[217]) + , main_sel_op_lte(il[218]) + , main_sel_op_mov(il[219]) + , main_sel_op_mul(il[220]) + , main_sel_op_not(il[221]) + , main_sel_op_note_hash_exists(il[222]) + , main_sel_op_nullifier_exists(il[223]) + , main_sel_op_or(il[224]) + , main_sel_op_pedersen(il[225]) + , main_sel_op_poseidon2(il[226]) + , main_sel_op_radix_le(il[227]) + , main_sel_op_sender(il[228]) + , main_sel_op_sha256(il[229]) + , main_sel_op_shl(il[230]) + , main_sel_op_shr(il[231]) + , main_sel_op_sload(il[232]) + , main_sel_op_sstore(il[233]) + , main_sel_op_storage_address(il[234]) + , main_sel_op_sub(il[235]) + , main_sel_op_timestamp(il[236]) + , main_sel_op_transaction_fee(il[237]) + , main_sel_op_version(il[238]) + , main_sel_op_xor(il[239]) + , main_sel_q_kernel_lookup(il[240]) + , main_sel_q_kernel_output_lookup(il[241]) + , main_sel_resolve_ind_addr_a(il[242]) + , main_sel_resolve_ind_addr_b(il[243]) + , main_sel_resolve_ind_addr_c(il[244]) + , main_sel_resolve_ind_addr_d(il[245]) + , main_sel_returndata(il[246]) + , main_sel_rng_16(il[247]) + , main_sel_rng_8(il[248]) + , main_sel_slice_gadget(il[249]) + , main_space_id(il[250]) + , main_tag_err(il[251]) + , main_w_in_tag(il[252]) + , mem_addr(il[253]) + , mem_clk(il[254]) + , mem_diff_hi(il[255]) + , mem_diff_lo(il[256]) + , mem_diff_mid(il[257]) + , mem_glob_addr(il[258]) + , mem_last(il[259]) + , mem_lastAccess(il[260]) + , mem_one_min_inv(il[261]) + , mem_r_in_tag(il[262]) + , mem_rw(il[263]) + , mem_sel_mem(il[264]) + , mem_sel_mov_ia_to_ic(il[265]) + , mem_sel_mov_ib_to_ic(il[266]) + , mem_sel_op_a(il[267]) + , mem_sel_op_b(il[268]) + , mem_sel_op_c(il[269]) + , mem_sel_op_cmov(il[270]) + , mem_sel_op_d(il[271]) + , mem_sel_op_slice(il[272]) + , mem_sel_resolve_ind_addr_a(il[273]) + , mem_sel_resolve_ind_addr_b(il[274]) + , mem_sel_resolve_ind_addr_c(il[275]) + , mem_sel_resolve_ind_addr_d(il[276]) + , mem_sel_rng_chk(il[277]) + , mem_skip_check_tag(il[278]) + , mem_space_id(il[279]) + , mem_tag(il[280]) + , mem_tag_err(il[281]) + , mem_tsp(il[282]) + , mem_val(il[283]) + , mem_w_in_tag(il[284]) + , pedersen_clk(il[285]) + , pedersen_input(il[286]) + , pedersen_output(il[287]) + , pedersen_sel_pedersen(il[288]) + , poseidon2_clk(il[289]) + , poseidon2_input(il[290]) + , poseidon2_output(il[291]) + , poseidon2_sel_poseidon_perm(il[292]) + , powers_power_of_2(il[293]) + , sha256_clk(il[294]) + , sha256_input(il[295]) + , sha256_output(il[296]) + , sha256_sel_sha256_compression(il[297]) + , sha256_state(il[298]) + , slice_addr(il[299]) + , slice_clk(il[300]) + , slice_cnt(il[301]) + , slice_col_offset(il[302]) + , slice_one_min_inv(il[303]) + , slice_sel_cd_cpy(il[304]) + , slice_sel_mem_active(il[305]) + , slice_sel_return(il[306]) + , slice_sel_start(il[307]) + , slice_space_id(il[308]) + , slice_val(il[309]) + , lookup_byte_lengths_counts(il[310]) + , lookup_byte_operations_counts(il[311]) + , lookup_cd_value_counts(il[312]) + , lookup_ret_value_counts(il[313]) + , lookup_opcode_gas_counts(il[314]) + , range_check_l2_gas_hi_counts(il[315]) + , range_check_l2_gas_lo_counts(il[316]) + , range_check_da_gas_hi_counts(il[317]) + , range_check_da_gas_lo_counts(il[318]) + , kernel_output_lookup_counts(il[319]) + , lookup_into_kernel_counts(il[320]) + , incl_main_tag_err_counts(il[321]) + , incl_mem_tag_err_counts(il[322]) + , lookup_mem_rng_chk_lo_counts(il[323]) + , lookup_mem_rng_chk_mid_counts(il[324]) + , lookup_mem_rng_chk_hi_counts(il[325]) + , lookup_pow_2_0_counts(il[326]) + , lookup_pow_2_1_counts(il[327]) + , lookup_u8_0_counts(il[328]) + , lookup_u8_1_counts(il[329]) + , lookup_u16_0_counts(il[330]) + , lookup_u16_1_counts(il[331]) + , lookup_u16_2_counts(il[332]) + , lookup_u16_3_counts(il[333]) + , lookup_u16_4_counts(il[334]) + , lookup_u16_5_counts(il[335]) + , lookup_u16_6_counts(il[336]) + , lookup_u16_7_counts(il[337]) + , lookup_u16_8_counts(il[338]) + , lookup_u16_9_counts(il[339]) + , lookup_u16_10_counts(il[340]) + , lookup_u16_11_counts(il[341]) + , lookup_u16_12_counts(il[342]) + , lookup_u16_13_counts(il[343]) + , lookup_u16_14_counts(il[344]) + , lookup_div_u16_0_counts(il[345]) + , lookup_div_u16_1_counts(il[346]) + , lookup_div_u16_2_counts(il[347]) + , lookup_div_u16_3_counts(il[348]) + , lookup_div_u16_4_counts(il[349]) + , lookup_div_u16_5_counts(il[350]) + , lookup_div_u16_6_counts(il[351]) + , lookup_div_u16_7_counts(il[352]) + , perm_slice_mem(il[353]) + , perm_main_alu(il[354]) + , perm_main_bin(il[355]) + , perm_main_conv(il[356]) + , perm_main_pos2_perm(il[357]) + , perm_main_pedersen(il[358]) + , perm_main_slice(il[359]) + , perm_main_mem_a(il[360]) + , perm_main_mem_b(il[361]) + , perm_main_mem_c(il[362]) + , perm_main_mem_d(il[363]) + , perm_main_mem_ind_addr_a(il[364]) + , perm_main_mem_ind_addr_b(il[365]) + , perm_main_mem_ind_addr_c(il[366]) + , perm_main_mem_ind_addr_d(il[367]) + , lookup_byte_lengths(il[368]) + , lookup_byte_operations(il[369]) + , lookup_cd_value(il[370]) + , lookup_ret_value(il[371]) + , lookup_opcode_gas(il[372]) + , range_check_l2_gas_hi(il[373]) + , range_check_l2_gas_lo(il[374]) + , range_check_da_gas_hi(il[375]) + , range_check_da_gas_lo(il[376]) + , kernel_output_lookup(il[377]) + , lookup_into_kernel(il[378]) + , incl_main_tag_err(il[379]) + , incl_mem_tag_err(il[380]) + , lookup_mem_rng_chk_lo(il[381]) + , lookup_mem_rng_chk_mid(il[382]) + , lookup_mem_rng_chk_hi(il[383]) + , lookup_pow_2_0(il[384]) + , lookup_pow_2_1(il[385]) + , lookup_u8_0(il[386]) + , lookup_u8_1(il[387]) + , lookup_u16_0(il[388]) + , lookup_u16_1(il[389]) + , lookup_u16_2(il[390]) + , lookup_u16_3(il[391]) + , lookup_u16_4(il[392]) + , lookup_u16_5(il[393]) + , lookup_u16_6(il[394]) + , lookup_u16_7(il[395]) + , lookup_u16_8(il[396]) + , lookup_u16_9(il[397]) + , lookup_u16_10(il[398]) + , lookup_u16_11(il[399]) + , lookup_u16_12(il[400]) + , lookup_u16_13(il[401]) + , lookup_u16_14(il[402]) + , lookup_div_u16_0(il[403]) + , lookup_div_u16_1(il[404]) + , lookup_div_u16_2(il[405]) + , lookup_div_u16_3(il[406]) + , lookup_div_u16_4(il[407]) + , lookup_div_u16_5(il[408]) + , lookup_div_u16_6(il[409]) + , lookup_div_u16_7(il[410]) + , alu_a_hi_shift(il[411]) + , alu_a_lo_shift(il[412]) + , alu_b_hi_shift(il[413]) + , alu_b_lo_shift(il[414]) + , alu_cmp_rng_ctr_shift(il[415]) + , alu_div_u16_r0_shift(il[416]) + , alu_div_u16_r1_shift(il[417]) + , alu_div_u16_r2_shift(il[418]) + , alu_div_u16_r3_shift(il[419]) + , alu_div_u16_r4_shift(il[420]) + , alu_div_u16_r5_shift(il[421]) + , alu_div_u16_r6_shift(il[422]) + , alu_div_u16_r7_shift(il[423]) + , alu_op_add_shift(il[424]) + , alu_op_cast_prev_shift(il[425]) + , alu_op_cast_shift(il[426]) + , alu_op_div_shift(il[427]) + , alu_op_mul_shift(il[428]) + , alu_op_shl_shift(il[429]) + , alu_op_shr_shift(il[430]) + , alu_op_sub_shift(il[431]) + , alu_p_sub_a_hi_shift(il[432]) + , alu_p_sub_a_lo_shift(il[433]) + , alu_p_sub_b_hi_shift(il[434]) + , alu_p_sub_b_lo_shift(il[435]) + , alu_sel_alu_shift(il[436]) + , alu_sel_cmp_shift(il[437]) + , alu_sel_div_rng_chk_shift(il[438]) + , alu_sel_rng_chk_lookup_shift(il[439]) + , alu_sel_rng_chk_shift(il[440]) + , alu_u16_r0_shift(il[441]) + , alu_u16_r1_shift(il[442]) + , alu_u16_r2_shift(il[443]) + , alu_u16_r3_shift(il[444]) + , alu_u16_r4_shift(il[445]) + , alu_u16_r5_shift(il[446]) + , alu_u16_r6_shift(il[447]) + , alu_u8_r0_shift(il[448]) + , alu_u8_r1_shift(il[449]) + , binary_acc_ia_shift(il[450]) + , binary_acc_ib_shift(il[451]) + , binary_acc_ic_shift(il[452]) + , binary_mem_tag_ctr_shift(il[453]) + , binary_op_id_shift(il[454]) + , kernel_emit_l2_to_l1_msg_write_offset_shift(il[455]) + , kernel_emit_note_hash_write_offset_shift(il[456]) + , kernel_emit_nullifier_write_offset_shift(il[457]) + , kernel_emit_unencrypted_log_write_offset_shift(il[458]) + , kernel_l1_to_l2_msg_exists_write_offset_shift(il[459]) + , kernel_note_hash_exist_write_offset_shift(il[460]) + , kernel_nullifier_exists_write_offset_shift(il[461]) + , kernel_nullifier_non_exists_write_offset_shift(il[462]) + , kernel_side_effect_counter_shift(il[463]) + , kernel_sload_write_offset_shift(il[464]) + , kernel_sstore_write_offset_shift(il[465]) + , main_da_gas_remaining_shift(il[466]) + , main_internal_return_ptr_shift(il[467]) + , main_l2_gas_remaining_shift(il[468]) + , main_pc_shift(il[469]) + , mem_glob_addr_shift(il[470]) + , mem_rw_shift(il[471]) + , mem_sel_mem_shift(il[472]) + , mem_tag_shift(il[473]) + , mem_tsp_shift(il[474]) + , mem_val_shift(il[475]) + , slice_addr_shift(il[476]) + , slice_clk_shift(il[477]) + , slice_cnt_shift(il[478]) + , slice_col_offset_shift(il[479]) + , slice_sel_cd_cpy_shift(il[480]) + , slice_sel_mem_active_shift(il[481]) + , slice_sel_return_shift(il[482]) + , slice_sel_start_shift(il[483]) + , slice_space_id_shift(il[484]) +{} + +AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) +{ + for (auto [prover_poly, key_poly] : zip_view(this->get_unshifted(), proving_key.get_all())) { + ASSERT(flavor_get_label(*this, prover_poly) == flavor_get_label(proving_key, key_poly)); + prover_poly = key_poly.share(); + } + for (auto [prover_poly, key_poly] : zip_view(this->get_shifted(), proving_key.get_to_be_shifted())) { + ASSERT(flavor_get_label(*this, prover_poly) == (flavor_get_label(proving_key, key_poly) + "_shift")); + prover_poly = key_poly.shifted(); + } +} + +AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_idx) const +{ + return AllConstRefValues(RefArray{ main_clk[row_idx], + main_sel_first[row_idx], + kernel_kernel_inputs[row_idx], + kernel_kernel_value_out[row_idx], + kernel_kernel_side_effect_out[row_idx], + kernel_kernel_metadata_out[row_idx], + main_calldata[row_idx], + main_returndata[row_idx], + alu_a_hi[row_idx], + alu_a_lo[row_idx], + alu_b_hi[row_idx], + alu_b_lo[row_idx], + alu_borrow[row_idx], + alu_cf[row_idx], + alu_clk[row_idx], + alu_cmp_rng_ctr[row_idx], + alu_div_u16_r0[row_idx], + alu_div_u16_r1[row_idx], + alu_div_u16_r2[row_idx], + alu_div_u16_r3[row_idx], + alu_div_u16_r4[row_idx], + alu_div_u16_r5[row_idx], + alu_div_u16_r6[row_idx], + alu_div_u16_r7[row_idx], + alu_divisor_hi[row_idx], + alu_divisor_lo[row_idx], + alu_ff_tag[row_idx], + alu_ia[row_idx], + alu_ib[row_idx], + alu_ic[row_idx], + alu_in_tag[row_idx], + alu_op_add[row_idx], + alu_op_cast[row_idx], + alu_op_cast_prev[row_idx], + alu_op_div[row_idx], + alu_op_div_a_lt_b[row_idx], + alu_op_div_std[row_idx], + alu_op_eq[row_idx], + alu_op_eq_diff_inv[row_idx], + alu_op_lt[row_idx], + alu_op_lte[row_idx], + alu_op_mul[row_idx], + alu_op_not[row_idx], + alu_op_shl[row_idx], + alu_op_shr[row_idx], + alu_op_sub[row_idx], + alu_p_a_borrow[row_idx], + alu_p_b_borrow[row_idx], + alu_p_sub_a_hi[row_idx], + alu_p_sub_a_lo[row_idx], + alu_p_sub_b_hi[row_idx], + alu_p_sub_b_lo[row_idx], + alu_partial_prod_hi[row_idx], + alu_partial_prod_lo[row_idx], + alu_quotient_hi[row_idx], + alu_quotient_lo[row_idx], + alu_remainder[row_idx], + alu_res_hi[row_idx], + alu_res_lo[row_idx], + alu_sel_alu[row_idx], + alu_sel_cmp[row_idx], + alu_sel_div_rng_chk[row_idx], + alu_sel_rng_chk[row_idx], + alu_sel_rng_chk_lookup[row_idx], + alu_sel_shift_which[row_idx], + alu_shift_lt_bit_len[row_idx], + alu_t_sub_s_bits[row_idx], + alu_two_pow_s[row_idx], + alu_two_pow_t_sub_s[row_idx], + alu_u128_tag[row_idx], + alu_u16_r0[row_idx], + alu_u16_r1[row_idx], + alu_u16_r10[row_idx], + alu_u16_r11[row_idx], + alu_u16_r12[row_idx], + alu_u16_r13[row_idx], + alu_u16_r14[row_idx], + alu_u16_r2[row_idx], + alu_u16_r3[row_idx], + alu_u16_r4[row_idx], + alu_u16_r5[row_idx], + alu_u16_r6[row_idx], + alu_u16_r7[row_idx], + alu_u16_r8[row_idx], + alu_u16_r9[row_idx], + alu_u16_tag[row_idx], + alu_u32_tag[row_idx], + alu_u64_tag[row_idx], + alu_u8_r0[row_idx], + alu_u8_r1[row_idx], + alu_u8_tag[row_idx], + binary_acc_ia[row_idx], + binary_acc_ib[row_idx], + binary_acc_ic[row_idx], + binary_clk[row_idx], + binary_ia_bytes[row_idx], + binary_ib_bytes[row_idx], + binary_ic_bytes[row_idx], + binary_in_tag[row_idx], + binary_mem_tag_ctr[row_idx], + binary_mem_tag_ctr_inv[row_idx], + binary_op_id[row_idx], + binary_sel_bin[row_idx], + binary_start[row_idx], + byte_lookup_sel_bin[row_idx], + byte_lookup_table_byte_lengths[row_idx], + byte_lookup_table_in_tags[row_idx], + byte_lookup_table_input_a[row_idx], + byte_lookup_table_input_b[row_idx], + byte_lookup_table_op_id[row_idx], + byte_lookup_table_output[row_idx], + conversion_clk[row_idx], + conversion_input[row_idx], + conversion_num_limbs[row_idx], + conversion_radix[row_idx], + conversion_sel_to_radix_le[row_idx], + gas_da_gas_fixed_table[row_idx], + gas_l2_gas_fixed_table[row_idx], + gas_sel_gas_cost[row_idx], + keccakf1600_clk[row_idx], + keccakf1600_input[row_idx], + keccakf1600_output[row_idx], + keccakf1600_sel_keccakf1600[row_idx], + kernel_emit_l2_to_l1_msg_write_offset[row_idx], + kernel_emit_note_hash_write_offset[row_idx], + kernel_emit_nullifier_write_offset[row_idx], + kernel_emit_unencrypted_log_write_offset[row_idx], + kernel_kernel_in_offset[row_idx], + kernel_kernel_out_offset[row_idx], + kernel_l1_to_l2_msg_exists_write_offset[row_idx], + kernel_note_hash_exist_write_offset[row_idx], + kernel_nullifier_exists_write_offset[row_idx], + kernel_nullifier_non_exists_write_offset[row_idx], + kernel_q_public_input_kernel_add_to_table[row_idx], + kernel_q_public_input_kernel_out_add_to_table[row_idx], + kernel_side_effect_counter[row_idx], + kernel_sload_write_offset[row_idx], + kernel_sstore_write_offset[row_idx], + main_abs_da_rem_gas_hi[row_idx], + main_abs_da_rem_gas_lo[row_idx], + main_abs_l2_rem_gas_hi[row_idx], + main_abs_l2_rem_gas_lo[row_idx], + main_alu_in_tag[row_idx], + main_bin_op_id[row_idx], + main_call_ptr[row_idx], + main_da_gas_op_cost[row_idx], + main_da_gas_remaining[row_idx], + main_da_out_of_gas[row_idx], + main_ia[row_idx], + main_ib[row_idx], + main_ic[row_idx], + main_id[row_idx], + main_id_zero[row_idx], + main_ind_addr_a[row_idx], + main_ind_addr_b[row_idx], + main_ind_addr_c[row_idx], + main_ind_addr_d[row_idx], + main_internal_return_ptr[row_idx], + main_inv[row_idx], + main_l2_gas_op_cost[row_idx], + main_l2_gas_remaining[row_idx], + main_l2_out_of_gas[row_idx], + main_mem_addr_a[row_idx], + main_mem_addr_b[row_idx], + main_mem_addr_c[row_idx], + main_mem_addr_d[row_idx], + main_op_err[row_idx], + main_opcode_val[row_idx], + main_pc[row_idx], + main_r_in_tag[row_idx], + main_rwa[row_idx], + main_rwb[row_idx], + main_rwc[row_idx], + main_rwd[row_idx], + main_sel_alu[row_idx], + main_sel_bin[row_idx], + main_sel_calldata[row_idx], + main_sel_gas_accounting_active[row_idx], + main_sel_last[row_idx], + main_sel_mem_op_a[row_idx], + main_sel_mem_op_activate_gas[row_idx], + main_sel_mem_op_b[row_idx], + main_sel_mem_op_c[row_idx], + main_sel_mem_op_d[row_idx], + main_sel_mov_ia_to_ic[row_idx], + main_sel_mov_ib_to_ic[row_idx], + main_sel_op_add[row_idx], + main_sel_op_address[row_idx], + main_sel_op_and[row_idx], + main_sel_op_block_number[row_idx], + main_sel_op_calldata_copy[row_idx], + main_sel_op_cast[row_idx], + main_sel_op_chain_id[row_idx], + main_sel_op_cmov[row_idx], + main_sel_op_coinbase[row_idx], + main_sel_op_dagasleft[row_idx], + main_sel_op_div[row_idx], + main_sel_op_emit_l2_to_l1_msg[row_idx], + main_sel_op_emit_note_hash[row_idx], + main_sel_op_emit_nullifier[row_idx], + main_sel_op_emit_unencrypted_log[row_idx], + main_sel_op_eq[row_idx], + main_sel_op_external_call[row_idx], + main_sel_op_external_return[row_idx], + main_sel_op_fdiv[row_idx], + main_sel_op_fee_per_da_gas[row_idx], + main_sel_op_fee_per_l2_gas[row_idx], + main_sel_op_function_selector[row_idx], + main_sel_op_get_contract_instance[row_idx], + main_sel_op_halt[row_idx], + main_sel_op_internal_call[row_idx], + main_sel_op_internal_return[row_idx], + main_sel_op_jump[row_idx], + main_sel_op_jumpi[row_idx], + main_sel_op_keccak[row_idx], + main_sel_op_l1_to_l2_msg_exists[row_idx], + main_sel_op_l2gasleft[row_idx], + main_sel_op_lt[row_idx], + main_sel_op_lte[row_idx], + main_sel_op_mov[row_idx], + main_sel_op_mul[row_idx], + main_sel_op_not[row_idx], + main_sel_op_note_hash_exists[row_idx], + main_sel_op_nullifier_exists[row_idx], + main_sel_op_or[row_idx], + main_sel_op_pedersen[row_idx], + main_sel_op_poseidon2[row_idx], + main_sel_op_radix_le[row_idx], + main_sel_op_sender[row_idx], + main_sel_op_sha256[row_idx], + main_sel_op_shl[row_idx], + main_sel_op_shr[row_idx], + main_sel_op_sload[row_idx], + main_sel_op_sstore[row_idx], + main_sel_op_storage_address[row_idx], + main_sel_op_sub[row_idx], + main_sel_op_timestamp[row_idx], + main_sel_op_transaction_fee[row_idx], + main_sel_op_version[row_idx], + main_sel_op_xor[row_idx], + main_sel_q_kernel_lookup[row_idx], + main_sel_q_kernel_output_lookup[row_idx], + main_sel_resolve_ind_addr_a[row_idx], + main_sel_resolve_ind_addr_b[row_idx], + main_sel_resolve_ind_addr_c[row_idx], + main_sel_resolve_ind_addr_d[row_idx], + main_sel_returndata[row_idx], + main_sel_rng_16[row_idx], + main_sel_rng_8[row_idx], + main_sel_slice_gadget[row_idx], + main_space_id[row_idx], + main_tag_err[row_idx], + main_w_in_tag[row_idx], + mem_addr[row_idx], + mem_clk[row_idx], + mem_diff_hi[row_idx], + mem_diff_lo[row_idx], + mem_diff_mid[row_idx], + mem_glob_addr[row_idx], + mem_last[row_idx], + mem_lastAccess[row_idx], + mem_one_min_inv[row_idx], + mem_r_in_tag[row_idx], + mem_rw[row_idx], + mem_sel_mem[row_idx], + mem_sel_mov_ia_to_ic[row_idx], + mem_sel_mov_ib_to_ic[row_idx], + mem_sel_op_a[row_idx], + mem_sel_op_b[row_idx], + mem_sel_op_c[row_idx], + mem_sel_op_cmov[row_idx], + mem_sel_op_d[row_idx], + mem_sel_op_slice[row_idx], + mem_sel_resolve_ind_addr_a[row_idx], + mem_sel_resolve_ind_addr_b[row_idx], + mem_sel_resolve_ind_addr_c[row_idx], + mem_sel_resolve_ind_addr_d[row_idx], + mem_sel_rng_chk[row_idx], + mem_skip_check_tag[row_idx], + mem_space_id[row_idx], + mem_tag[row_idx], + mem_tag_err[row_idx], + mem_tsp[row_idx], + mem_val[row_idx], + mem_w_in_tag[row_idx], + pedersen_clk[row_idx], + pedersen_input[row_idx], + pedersen_output[row_idx], + pedersen_sel_pedersen[row_idx], + poseidon2_clk[row_idx], + poseidon2_input[row_idx], + poseidon2_output[row_idx], + poseidon2_sel_poseidon_perm[row_idx], + powers_power_of_2[row_idx], + sha256_clk[row_idx], + sha256_input[row_idx], + sha256_output[row_idx], + sha256_sel_sha256_compression[row_idx], + sha256_state[row_idx], + slice_addr[row_idx], + slice_clk[row_idx], + slice_cnt[row_idx], + slice_col_offset[row_idx], + slice_one_min_inv[row_idx], + slice_sel_cd_cpy[row_idx], + slice_sel_mem_active[row_idx], + slice_sel_return[row_idx], + slice_sel_start[row_idx], + slice_space_id[row_idx], + slice_val[row_idx], + lookup_byte_lengths_counts[row_idx], + lookup_byte_operations_counts[row_idx], + lookup_cd_value_counts[row_idx], + lookup_ret_value_counts[row_idx], + lookup_opcode_gas_counts[row_idx], + range_check_l2_gas_hi_counts[row_idx], + range_check_l2_gas_lo_counts[row_idx], + range_check_da_gas_hi_counts[row_idx], + range_check_da_gas_lo_counts[row_idx], + kernel_output_lookup_counts[row_idx], + lookup_into_kernel_counts[row_idx], + incl_main_tag_err_counts[row_idx], + incl_mem_tag_err_counts[row_idx], + lookup_mem_rng_chk_lo_counts[row_idx], + lookup_mem_rng_chk_mid_counts[row_idx], + lookup_mem_rng_chk_hi_counts[row_idx], + lookup_pow_2_0_counts[row_idx], + lookup_pow_2_1_counts[row_idx], + lookup_u8_0_counts[row_idx], + lookup_u8_1_counts[row_idx], + lookup_u16_0_counts[row_idx], + lookup_u16_1_counts[row_idx], + lookup_u16_2_counts[row_idx], + lookup_u16_3_counts[row_idx], + lookup_u16_4_counts[row_idx], + lookup_u16_5_counts[row_idx], + lookup_u16_6_counts[row_idx], + lookup_u16_7_counts[row_idx], + lookup_u16_8_counts[row_idx], + lookup_u16_9_counts[row_idx], + lookup_u16_10_counts[row_idx], + lookup_u16_11_counts[row_idx], + lookup_u16_12_counts[row_idx], + lookup_u16_13_counts[row_idx], + lookup_u16_14_counts[row_idx], + lookup_div_u16_0_counts[row_idx], + lookup_div_u16_1_counts[row_idx], + lookup_div_u16_2_counts[row_idx], + lookup_div_u16_3_counts[row_idx], + lookup_div_u16_4_counts[row_idx], + lookup_div_u16_5_counts[row_idx], + lookup_div_u16_6_counts[row_idx], + lookup_div_u16_7_counts[row_idx], + perm_slice_mem[row_idx], + perm_main_alu[row_idx], + perm_main_bin[row_idx], + perm_main_conv[row_idx], + perm_main_pos2_perm[row_idx], + perm_main_pedersen[row_idx], + perm_main_slice[row_idx], + perm_main_mem_a[row_idx], + perm_main_mem_b[row_idx], + perm_main_mem_c[row_idx], + perm_main_mem_d[row_idx], + perm_main_mem_ind_addr_a[row_idx], + perm_main_mem_ind_addr_b[row_idx], + perm_main_mem_ind_addr_c[row_idx], + perm_main_mem_ind_addr_d[row_idx], + lookup_byte_lengths[row_idx], + lookup_byte_operations[row_idx], + lookup_cd_value[row_idx], + lookup_ret_value[row_idx], + lookup_opcode_gas[row_idx], + range_check_l2_gas_hi[row_idx], + range_check_l2_gas_lo[row_idx], + range_check_da_gas_hi[row_idx], + range_check_da_gas_lo[row_idx], + kernel_output_lookup[row_idx], + lookup_into_kernel[row_idx], + incl_main_tag_err[row_idx], + incl_mem_tag_err[row_idx], + lookup_mem_rng_chk_lo[row_idx], + lookup_mem_rng_chk_mid[row_idx], + lookup_mem_rng_chk_hi[row_idx], + lookup_pow_2_0[row_idx], + lookup_pow_2_1[row_idx], + lookup_u8_0[row_idx], + lookup_u8_1[row_idx], + lookup_u16_0[row_idx], + lookup_u16_1[row_idx], + lookup_u16_2[row_idx], + lookup_u16_3[row_idx], + lookup_u16_4[row_idx], + lookup_u16_5[row_idx], + lookup_u16_6[row_idx], + lookup_u16_7[row_idx], + lookup_u16_8[row_idx], + lookup_u16_9[row_idx], + lookup_u16_10[row_idx], + lookup_u16_11[row_idx], + lookup_u16_12[row_idx], + lookup_u16_13[row_idx], + lookup_u16_14[row_idx], + lookup_div_u16_0[row_idx], + lookup_div_u16_1[row_idx], + lookup_div_u16_2[row_idx], + lookup_div_u16_3[row_idx], + lookup_div_u16_4[row_idx], + lookup_div_u16_5[row_idx], + lookup_div_u16_6[row_idx], + lookup_div_u16_7[row_idx], + alu_a_hi_shift[row_idx], + alu_a_lo_shift[row_idx], + alu_b_hi_shift[row_idx], + alu_b_lo_shift[row_idx], + alu_cmp_rng_ctr_shift[row_idx], + alu_div_u16_r0_shift[row_idx], + alu_div_u16_r1_shift[row_idx], + alu_div_u16_r2_shift[row_idx], + alu_div_u16_r3_shift[row_idx], + alu_div_u16_r4_shift[row_idx], + alu_div_u16_r5_shift[row_idx], + alu_div_u16_r6_shift[row_idx], + alu_div_u16_r7_shift[row_idx], + alu_op_add_shift[row_idx], + alu_op_cast_prev_shift[row_idx], + alu_op_cast_shift[row_idx], + alu_op_div_shift[row_idx], + alu_op_mul_shift[row_idx], + alu_op_shl_shift[row_idx], + alu_op_shr_shift[row_idx], + alu_op_sub_shift[row_idx], + alu_p_sub_a_hi_shift[row_idx], + alu_p_sub_a_lo_shift[row_idx], + alu_p_sub_b_hi_shift[row_idx], + alu_p_sub_b_lo_shift[row_idx], + alu_sel_alu_shift[row_idx], + alu_sel_cmp_shift[row_idx], + alu_sel_div_rng_chk_shift[row_idx], + alu_sel_rng_chk_lookup_shift[row_idx], + alu_sel_rng_chk_shift[row_idx], + alu_u16_r0_shift[row_idx], + alu_u16_r1_shift[row_idx], + alu_u16_r2_shift[row_idx], + alu_u16_r3_shift[row_idx], + alu_u16_r4_shift[row_idx], + alu_u16_r5_shift[row_idx], + alu_u16_r6_shift[row_idx], + alu_u8_r0_shift[row_idx], + alu_u8_r1_shift[row_idx], + binary_acc_ia_shift[row_idx], + binary_acc_ib_shift[row_idx], + binary_acc_ic_shift[row_idx], + binary_mem_tag_ctr_shift[row_idx], + binary_op_id_shift[row_idx], + kernel_emit_l2_to_l1_msg_write_offset_shift[row_idx], + kernel_emit_note_hash_write_offset_shift[row_idx], + kernel_emit_nullifier_write_offset_shift[row_idx], + kernel_emit_unencrypted_log_write_offset_shift[row_idx], + kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], + kernel_note_hash_exist_write_offset_shift[row_idx], + kernel_nullifier_exists_write_offset_shift[row_idx], + kernel_nullifier_non_exists_write_offset_shift[row_idx], + kernel_side_effect_counter_shift[row_idx], + kernel_sload_write_offset_shift[row_idx], + kernel_sstore_write_offset_shift[row_idx], + main_da_gas_remaining_shift[row_idx], + main_internal_return_ptr_shift[row_idx], + main_l2_gas_remaining_shift[row_idx], + main_pc_shift[row_idx], + mem_glob_addr_shift[row_idx], + mem_rw_shift[row_idx], + mem_sel_mem_shift[row_idx], + mem_tag_shift[row_idx], + mem_tsp_shift[row_idx], + mem_val_shift[row_idx], + slice_addr_shift[row_idx], + slice_clk_shift[row_idx], + slice_cnt_shift[row_idx], + slice_col_offset_shift[row_idx], + slice_sel_cd_cpy_shift[row_idx], + slice_sel_mem_active_shift[row_idx], + slice_sel_return_shift[row_idx], + slice_sel_start_shift[row_idx], + slice_space_id_shift[row_idx] }); +} + +AvmFlavor::CommitmentLabels::CommitmentLabels() +{ + Base::main_clk = "MAIN_CLK"; + Base::main_sel_first = "MAIN_SEL_FIRST"; + Base::kernel_kernel_inputs = "KERNEL_KERNEL_INPUTS"; + Base::kernel_kernel_value_out = "KERNEL_KERNEL_VALUE_OUT"; + Base::kernel_kernel_side_effect_out = "KERNEL_KERNEL_SIDE_EFFECT_OUT"; + Base::kernel_kernel_metadata_out = "KERNEL_KERNEL_METADATA_OUT"; + Base::main_calldata = "MAIN_CALLDATA"; + Base::main_returndata = "MAIN_RETURNDATA"; + Base::alu_a_hi = "ALU_A_HI"; + Base::alu_a_lo = "ALU_A_LO"; + Base::alu_b_hi = "ALU_B_HI"; + Base::alu_b_lo = "ALU_B_LO"; + Base::alu_borrow = "ALU_BORROW"; + Base::alu_cf = "ALU_CF"; + Base::alu_clk = "ALU_CLK"; + Base::alu_cmp_rng_ctr = "ALU_CMP_RNG_CTR"; + Base::alu_div_u16_r0 = "ALU_DIV_U16_R0"; + Base::alu_div_u16_r1 = "ALU_DIV_U16_R1"; + Base::alu_div_u16_r2 = "ALU_DIV_U16_R2"; + Base::alu_div_u16_r3 = "ALU_DIV_U16_R3"; + Base::alu_div_u16_r4 = "ALU_DIV_U16_R4"; + Base::alu_div_u16_r5 = "ALU_DIV_U16_R5"; + Base::alu_div_u16_r6 = "ALU_DIV_U16_R6"; + Base::alu_div_u16_r7 = "ALU_DIV_U16_R7"; + Base::alu_divisor_hi = "ALU_DIVISOR_HI"; + Base::alu_divisor_lo = "ALU_DIVISOR_LO"; + Base::alu_ff_tag = "ALU_FF_TAG"; + Base::alu_ia = "ALU_IA"; + Base::alu_ib = "ALU_IB"; + Base::alu_ic = "ALU_IC"; + Base::alu_in_tag = "ALU_IN_TAG"; + Base::alu_op_add = "ALU_OP_ADD"; + Base::alu_op_cast = "ALU_OP_CAST"; + Base::alu_op_cast_prev = "ALU_OP_CAST_PREV"; + Base::alu_op_div = "ALU_OP_DIV"; + Base::alu_op_div_a_lt_b = "ALU_OP_DIV_A_LT_B"; + Base::alu_op_div_std = "ALU_OP_DIV_STD"; + Base::alu_op_eq = "ALU_OP_EQ"; + Base::alu_op_eq_diff_inv = "ALU_OP_EQ_DIFF_INV"; + Base::alu_op_lt = "ALU_OP_LT"; + Base::alu_op_lte = "ALU_OP_LTE"; + Base::alu_op_mul = "ALU_OP_MUL"; + Base::alu_op_not = "ALU_OP_NOT"; + Base::alu_op_shl = "ALU_OP_SHL"; + Base::alu_op_shr = "ALU_OP_SHR"; + Base::alu_op_sub = "ALU_OP_SUB"; + Base::alu_p_a_borrow = "ALU_P_A_BORROW"; + Base::alu_p_b_borrow = "ALU_P_B_BORROW"; + Base::alu_p_sub_a_hi = "ALU_P_SUB_A_HI"; + Base::alu_p_sub_a_lo = "ALU_P_SUB_A_LO"; + Base::alu_p_sub_b_hi = "ALU_P_SUB_B_HI"; + Base::alu_p_sub_b_lo = "ALU_P_SUB_B_LO"; + Base::alu_partial_prod_hi = "ALU_PARTIAL_PROD_HI"; + Base::alu_partial_prod_lo = "ALU_PARTIAL_PROD_LO"; + Base::alu_quotient_hi = "ALU_QUOTIENT_HI"; + Base::alu_quotient_lo = "ALU_QUOTIENT_LO"; + Base::alu_remainder = "ALU_REMAINDER"; + Base::alu_res_hi = "ALU_RES_HI"; + Base::alu_res_lo = "ALU_RES_LO"; + Base::alu_sel_alu = "ALU_SEL_ALU"; + Base::alu_sel_cmp = "ALU_SEL_CMP"; + Base::alu_sel_div_rng_chk = "ALU_SEL_DIV_RNG_CHK"; + Base::alu_sel_rng_chk = "ALU_SEL_RNG_CHK"; + Base::alu_sel_rng_chk_lookup = "ALU_SEL_RNG_CHK_LOOKUP"; + Base::alu_sel_shift_which = "ALU_SEL_SHIFT_WHICH"; + Base::alu_shift_lt_bit_len = "ALU_SHIFT_LT_BIT_LEN"; + Base::alu_t_sub_s_bits = "ALU_T_SUB_S_BITS"; + Base::alu_two_pow_s = "ALU_TWO_POW_S"; + Base::alu_two_pow_t_sub_s = "ALU_TWO_POW_T_SUB_S"; + Base::alu_u128_tag = "ALU_U128_TAG"; + Base::alu_u16_r0 = "ALU_U16_R0"; + Base::alu_u16_r1 = "ALU_U16_R1"; + Base::alu_u16_r10 = "ALU_U16_R10"; + Base::alu_u16_r11 = "ALU_U16_R11"; + Base::alu_u16_r12 = "ALU_U16_R12"; + Base::alu_u16_r13 = "ALU_U16_R13"; + Base::alu_u16_r14 = "ALU_U16_R14"; + Base::alu_u16_r2 = "ALU_U16_R2"; + Base::alu_u16_r3 = "ALU_U16_R3"; + Base::alu_u16_r4 = "ALU_U16_R4"; + Base::alu_u16_r5 = "ALU_U16_R5"; + Base::alu_u16_r6 = "ALU_U16_R6"; + Base::alu_u16_r7 = "ALU_U16_R7"; + Base::alu_u16_r8 = "ALU_U16_R8"; + Base::alu_u16_r9 = "ALU_U16_R9"; + Base::alu_u16_tag = "ALU_U16_TAG"; + Base::alu_u32_tag = "ALU_U32_TAG"; + Base::alu_u64_tag = "ALU_U64_TAG"; + Base::alu_u8_r0 = "ALU_U8_R0"; + Base::alu_u8_r1 = "ALU_U8_R1"; + Base::alu_u8_tag = "ALU_U8_TAG"; + Base::binary_acc_ia = "BINARY_ACC_IA"; + Base::binary_acc_ib = "BINARY_ACC_IB"; + Base::binary_acc_ic = "BINARY_ACC_IC"; + Base::binary_clk = "BINARY_CLK"; + Base::binary_ia_bytes = "BINARY_IA_BYTES"; + Base::binary_ib_bytes = "BINARY_IB_BYTES"; + Base::binary_ic_bytes = "BINARY_IC_BYTES"; + Base::binary_in_tag = "BINARY_IN_TAG"; + Base::binary_mem_tag_ctr = "BINARY_MEM_TAG_CTR"; + Base::binary_mem_tag_ctr_inv = "BINARY_MEM_TAG_CTR_INV"; + Base::binary_op_id = "BINARY_OP_ID"; + Base::binary_sel_bin = "BINARY_SEL_BIN"; + Base::binary_start = "BINARY_START"; + Base::byte_lookup_sel_bin = "BYTE_LOOKUP_SEL_BIN"; + Base::byte_lookup_table_byte_lengths = "BYTE_LOOKUP_TABLE_BYTE_LENGTHS"; + Base::byte_lookup_table_in_tags = "BYTE_LOOKUP_TABLE_IN_TAGS"; + Base::byte_lookup_table_input_a = "BYTE_LOOKUP_TABLE_INPUT_A"; + Base::byte_lookup_table_input_b = "BYTE_LOOKUP_TABLE_INPUT_B"; + Base::byte_lookup_table_op_id = "BYTE_LOOKUP_TABLE_OP_ID"; + Base::byte_lookup_table_output = "BYTE_LOOKUP_TABLE_OUTPUT"; + Base::conversion_clk = "CONVERSION_CLK"; + Base::conversion_input = "CONVERSION_INPUT"; + Base::conversion_num_limbs = "CONVERSION_NUM_LIMBS"; + Base::conversion_radix = "CONVERSION_RADIX"; + Base::conversion_sel_to_radix_le = "CONVERSION_SEL_TO_RADIX_LE"; + Base::gas_da_gas_fixed_table = "GAS_DA_GAS_FIXED_TABLE"; + Base::gas_l2_gas_fixed_table = "GAS_L2_GAS_FIXED_TABLE"; + Base::gas_sel_gas_cost = "GAS_SEL_GAS_COST"; + Base::keccakf1600_clk = "KECCAKF1600_CLK"; + Base::keccakf1600_input = "KECCAKF1600_INPUT"; + Base::keccakf1600_output = "KECCAKF1600_OUTPUT"; + Base::keccakf1600_sel_keccakf1600 = "KECCAKF1600_SEL_KECCAKF1600"; + Base::kernel_emit_l2_to_l1_msg_write_offset = "KERNEL_EMIT_L2_TO_L1_MSG_WRITE_OFFSET"; + Base::kernel_emit_note_hash_write_offset = "KERNEL_EMIT_NOTE_HASH_WRITE_OFFSET"; + Base::kernel_emit_nullifier_write_offset = "KERNEL_EMIT_NULLIFIER_WRITE_OFFSET"; + Base::kernel_emit_unencrypted_log_write_offset = "KERNEL_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET"; + Base::kernel_kernel_in_offset = "KERNEL_KERNEL_IN_OFFSET"; + Base::kernel_kernel_out_offset = "KERNEL_KERNEL_OUT_OFFSET"; + Base::kernel_l1_to_l2_msg_exists_write_offset = "KERNEL_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET"; + Base::kernel_note_hash_exist_write_offset = "KERNEL_NOTE_HASH_EXIST_WRITE_OFFSET"; + Base::kernel_nullifier_exists_write_offset = "KERNEL_NULLIFIER_EXISTS_WRITE_OFFSET"; + Base::kernel_nullifier_non_exists_write_offset = "KERNEL_NULLIFIER_NON_EXISTS_WRITE_OFFSET"; + Base::kernel_q_public_input_kernel_add_to_table = "KERNEL_Q_PUBLIC_INPUT_KERNEL_ADD_TO_TABLE"; + Base::kernel_q_public_input_kernel_out_add_to_table = "KERNEL_Q_PUBLIC_INPUT_KERNEL_OUT_ADD_TO_TABLE"; + Base::kernel_side_effect_counter = "KERNEL_SIDE_EFFECT_COUNTER"; + Base::kernel_sload_write_offset = "KERNEL_SLOAD_WRITE_OFFSET"; + Base::kernel_sstore_write_offset = "KERNEL_SSTORE_WRITE_OFFSET"; + Base::main_abs_da_rem_gas_hi = "MAIN_ABS_DA_REM_GAS_HI"; + Base::main_abs_da_rem_gas_lo = "MAIN_ABS_DA_REM_GAS_LO"; + Base::main_abs_l2_rem_gas_hi = "MAIN_ABS_L2_REM_GAS_HI"; + Base::main_abs_l2_rem_gas_lo = "MAIN_ABS_L2_REM_GAS_LO"; + Base::main_alu_in_tag = "MAIN_ALU_IN_TAG"; + Base::main_bin_op_id = "MAIN_BIN_OP_ID"; + Base::main_call_ptr = "MAIN_CALL_PTR"; + Base::main_da_gas_op_cost = "MAIN_DA_GAS_OP_COST"; + Base::main_da_gas_remaining = "MAIN_DA_GAS_REMAINING"; + Base::main_da_out_of_gas = "MAIN_DA_OUT_OF_GAS"; + Base::main_ia = "MAIN_IA"; + Base::main_ib = "MAIN_IB"; + Base::main_ic = "MAIN_IC"; + Base::main_id = "MAIN_ID"; + Base::main_id_zero = "MAIN_ID_ZERO"; + Base::main_ind_addr_a = "MAIN_IND_ADDR_A"; + Base::main_ind_addr_b = "MAIN_IND_ADDR_B"; + Base::main_ind_addr_c = "MAIN_IND_ADDR_C"; + Base::main_ind_addr_d = "MAIN_IND_ADDR_D"; + Base::main_internal_return_ptr = "MAIN_INTERNAL_RETURN_PTR"; + Base::main_inv = "MAIN_INV"; + Base::main_l2_gas_op_cost = "MAIN_L2_GAS_OP_COST"; + Base::main_l2_gas_remaining = "MAIN_L2_GAS_REMAINING"; + Base::main_l2_out_of_gas = "MAIN_L2_OUT_OF_GAS"; + Base::main_mem_addr_a = "MAIN_MEM_ADDR_A"; + Base::main_mem_addr_b = "MAIN_MEM_ADDR_B"; + Base::main_mem_addr_c = "MAIN_MEM_ADDR_C"; + Base::main_mem_addr_d = "MAIN_MEM_ADDR_D"; + Base::main_op_err = "MAIN_OP_ERR"; + Base::main_opcode_val = "MAIN_OPCODE_VAL"; + Base::main_pc = "MAIN_PC"; + Base::main_r_in_tag = "MAIN_R_IN_TAG"; + Base::main_rwa = "MAIN_RWA"; + Base::main_rwb = "MAIN_RWB"; + Base::main_rwc = "MAIN_RWC"; + Base::main_rwd = "MAIN_RWD"; + Base::main_sel_alu = "MAIN_SEL_ALU"; + Base::main_sel_bin = "MAIN_SEL_BIN"; + Base::main_sel_calldata = "MAIN_SEL_CALLDATA"; + Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; + Base::main_sel_last = "MAIN_SEL_LAST"; + Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; + Base::main_sel_mem_op_activate_gas = "MAIN_SEL_MEM_OP_ACTIVATE_GAS"; + Base::main_sel_mem_op_b = "MAIN_SEL_MEM_OP_B"; + Base::main_sel_mem_op_c = "MAIN_SEL_MEM_OP_C"; + Base::main_sel_mem_op_d = "MAIN_SEL_MEM_OP_D"; + Base::main_sel_mov_ia_to_ic = "MAIN_SEL_MOV_IA_TO_IC"; + Base::main_sel_mov_ib_to_ic = "MAIN_SEL_MOV_IB_TO_IC"; + Base::main_sel_op_add = "MAIN_SEL_OP_ADD"; + Base::main_sel_op_address = "MAIN_SEL_OP_ADDRESS"; + Base::main_sel_op_and = "MAIN_SEL_OP_AND"; + Base::main_sel_op_block_number = "MAIN_SEL_OP_BLOCK_NUMBER"; + Base::main_sel_op_calldata_copy = "MAIN_SEL_OP_CALLDATA_COPY"; + Base::main_sel_op_cast = "MAIN_SEL_OP_CAST"; + Base::main_sel_op_chain_id = "MAIN_SEL_OP_CHAIN_ID"; + Base::main_sel_op_cmov = "MAIN_SEL_OP_CMOV"; + Base::main_sel_op_coinbase = "MAIN_SEL_OP_COINBASE"; + Base::main_sel_op_dagasleft = "MAIN_SEL_OP_DAGASLEFT"; + Base::main_sel_op_div = "MAIN_SEL_OP_DIV"; + Base::main_sel_op_emit_l2_to_l1_msg = "MAIN_SEL_OP_EMIT_L2_TO_L1_MSG"; + Base::main_sel_op_emit_note_hash = "MAIN_SEL_OP_EMIT_NOTE_HASH"; + Base::main_sel_op_emit_nullifier = "MAIN_SEL_OP_EMIT_NULLIFIER"; + Base::main_sel_op_emit_unencrypted_log = "MAIN_SEL_OP_EMIT_UNENCRYPTED_LOG"; + Base::main_sel_op_eq = "MAIN_SEL_OP_EQ"; + Base::main_sel_op_external_call = "MAIN_SEL_OP_EXTERNAL_CALL"; + Base::main_sel_op_external_return = "MAIN_SEL_OP_EXTERNAL_RETURN"; + Base::main_sel_op_fdiv = "MAIN_SEL_OP_FDIV"; + Base::main_sel_op_fee_per_da_gas = "MAIN_SEL_OP_FEE_PER_DA_GAS"; + Base::main_sel_op_fee_per_l2_gas = "MAIN_SEL_OP_FEE_PER_L2_GAS"; + Base::main_sel_op_function_selector = "MAIN_SEL_OP_FUNCTION_SELECTOR"; + Base::main_sel_op_get_contract_instance = "MAIN_SEL_OP_GET_CONTRACT_INSTANCE"; + Base::main_sel_op_halt = "MAIN_SEL_OP_HALT"; + Base::main_sel_op_internal_call = "MAIN_SEL_OP_INTERNAL_CALL"; + Base::main_sel_op_internal_return = "MAIN_SEL_OP_INTERNAL_RETURN"; + Base::main_sel_op_jump = "MAIN_SEL_OP_JUMP"; + Base::main_sel_op_jumpi = "MAIN_SEL_OP_JUMPI"; + Base::main_sel_op_keccak = "MAIN_SEL_OP_KECCAK"; + Base::main_sel_op_l1_to_l2_msg_exists = "MAIN_SEL_OP_L1_TO_L2_MSG_EXISTS"; + Base::main_sel_op_l2gasleft = "MAIN_SEL_OP_L2GASLEFT"; + Base::main_sel_op_lt = "MAIN_SEL_OP_LT"; + Base::main_sel_op_lte = "MAIN_SEL_OP_LTE"; + Base::main_sel_op_mov = "MAIN_SEL_OP_MOV"; + Base::main_sel_op_mul = "MAIN_SEL_OP_MUL"; + Base::main_sel_op_not = "MAIN_SEL_OP_NOT"; + Base::main_sel_op_note_hash_exists = "MAIN_SEL_OP_NOTE_HASH_EXISTS"; + Base::main_sel_op_nullifier_exists = "MAIN_SEL_OP_NULLIFIER_EXISTS"; + Base::main_sel_op_or = "MAIN_SEL_OP_OR"; + Base::main_sel_op_pedersen = "MAIN_SEL_OP_PEDERSEN"; + Base::main_sel_op_poseidon2 = "MAIN_SEL_OP_POSEIDON2"; + Base::main_sel_op_radix_le = "MAIN_SEL_OP_RADIX_LE"; + Base::main_sel_op_sender = "MAIN_SEL_OP_SENDER"; + Base::main_sel_op_sha256 = "MAIN_SEL_OP_SHA256"; + Base::main_sel_op_shl = "MAIN_SEL_OP_SHL"; + Base::main_sel_op_shr = "MAIN_SEL_OP_SHR"; + Base::main_sel_op_sload = "MAIN_SEL_OP_SLOAD"; + Base::main_sel_op_sstore = "MAIN_SEL_OP_SSTORE"; + Base::main_sel_op_storage_address = "MAIN_SEL_OP_STORAGE_ADDRESS"; + Base::main_sel_op_sub = "MAIN_SEL_OP_SUB"; + Base::main_sel_op_timestamp = "MAIN_SEL_OP_TIMESTAMP"; + Base::main_sel_op_transaction_fee = "MAIN_SEL_OP_TRANSACTION_FEE"; + Base::main_sel_op_version = "MAIN_SEL_OP_VERSION"; + Base::main_sel_op_xor = "MAIN_SEL_OP_XOR"; + Base::main_sel_q_kernel_lookup = "MAIN_SEL_Q_KERNEL_LOOKUP"; + Base::main_sel_q_kernel_output_lookup = "MAIN_SEL_Q_KERNEL_OUTPUT_LOOKUP"; + Base::main_sel_resolve_ind_addr_a = "MAIN_SEL_RESOLVE_IND_ADDR_A"; + Base::main_sel_resolve_ind_addr_b = "MAIN_SEL_RESOLVE_IND_ADDR_B"; + Base::main_sel_resolve_ind_addr_c = "MAIN_SEL_RESOLVE_IND_ADDR_C"; + Base::main_sel_resolve_ind_addr_d = "MAIN_SEL_RESOLVE_IND_ADDR_D"; + Base::main_sel_returndata = "MAIN_SEL_RETURNDATA"; + Base::main_sel_rng_16 = "MAIN_SEL_RNG_16"; + Base::main_sel_rng_8 = "MAIN_SEL_RNG_8"; + Base::main_sel_slice_gadget = "MAIN_SEL_SLICE_GADGET"; + Base::main_space_id = "MAIN_SPACE_ID"; + Base::main_tag_err = "MAIN_TAG_ERR"; + Base::main_w_in_tag = "MAIN_W_IN_TAG"; + Base::mem_addr = "MEM_ADDR"; + Base::mem_clk = "MEM_CLK"; + Base::mem_diff_hi = "MEM_DIFF_HI"; + Base::mem_diff_lo = "MEM_DIFF_LO"; + Base::mem_diff_mid = "MEM_DIFF_MID"; + Base::mem_glob_addr = "MEM_GLOB_ADDR"; + Base::mem_last = "MEM_LAST"; + Base::mem_lastAccess = "MEM_LAST_ACCESS"; + Base::mem_one_min_inv = "MEM_ONE_MIN_INV"; + Base::mem_r_in_tag = "MEM_R_IN_TAG"; + Base::mem_rw = "MEM_RW"; + Base::mem_sel_mem = "MEM_SEL_MEM"; + Base::mem_sel_mov_ia_to_ic = "MEM_SEL_MOV_IA_TO_IC"; + Base::mem_sel_mov_ib_to_ic = "MEM_SEL_MOV_IB_TO_IC"; + Base::mem_sel_op_a = "MEM_SEL_OP_A"; + Base::mem_sel_op_b = "MEM_SEL_OP_B"; + Base::mem_sel_op_c = "MEM_SEL_OP_C"; + Base::mem_sel_op_cmov = "MEM_SEL_OP_CMOV"; + Base::mem_sel_op_d = "MEM_SEL_OP_D"; + Base::mem_sel_op_slice = "MEM_SEL_OP_SLICE"; + Base::mem_sel_resolve_ind_addr_a = "MEM_SEL_RESOLVE_IND_ADDR_A"; + Base::mem_sel_resolve_ind_addr_b = "MEM_SEL_RESOLVE_IND_ADDR_B"; + Base::mem_sel_resolve_ind_addr_c = "MEM_SEL_RESOLVE_IND_ADDR_C"; + Base::mem_sel_resolve_ind_addr_d = "MEM_SEL_RESOLVE_IND_ADDR_D"; + Base::mem_sel_rng_chk = "MEM_SEL_RNG_CHK"; + Base::mem_skip_check_tag = "MEM_SKIP_CHECK_TAG"; + Base::mem_space_id = "MEM_SPACE_ID"; + Base::mem_tag = "MEM_TAG"; + Base::mem_tag_err = "MEM_TAG_ERR"; + Base::mem_tsp = "MEM_TSP"; + Base::mem_val = "MEM_VAL"; + Base::mem_w_in_tag = "MEM_W_IN_TAG"; + Base::pedersen_clk = "PEDERSEN_CLK"; + Base::pedersen_input = "PEDERSEN_INPUT"; + Base::pedersen_output = "PEDERSEN_OUTPUT"; + Base::pedersen_sel_pedersen = "PEDERSEN_SEL_PEDERSEN"; + Base::poseidon2_clk = "POSEIDON2_CLK"; + Base::poseidon2_input = "POSEIDON2_INPUT"; + Base::poseidon2_output = "POSEIDON2_OUTPUT"; + Base::poseidon2_sel_poseidon_perm = "POSEIDON2_SEL_POSEIDON_PERM"; + Base::powers_power_of_2 = "POWERS_POWER_OF_2"; + Base::sha256_clk = "SHA256_CLK"; + Base::sha256_input = "SHA256_INPUT"; + Base::sha256_output = "SHA256_OUTPUT"; + Base::sha256_sel_sha256_compression = "SHA256_SEL_SHA256_COMPRESSION"; + Base::sha256_state = "SHA256_STATE"; + Base::slice_addr = "SLICE_ADDR"; + Base::slice_clk = "SLICE_CLK"; + Base::slice_cnt = "SLICE_CNT"; + Base::slice_col_offset = "SLICE_COL_OFFSET"; + Base::slice_one_min_inv = "SLICE_ONE_MIN_INV"; + Base::slice_sel_cd_cpy = "SLICE_SEL_CD_CPY"; + Base::slice_sel_mem_active = "SLICE_SEL_MEM_ACTIVE"; + Base::slice_sel_return = "SLICE_SEL_RETURN"; + Base::slice_sel_start = "SLICE_SEL_START"; + Base::slice_space_id = "SLICE_SPACE_ID"; + Base::slice_val = "SLICE_VAL"; + Base::perm_slice_mem = "PERM_SLICE_MEM"; + Base::perm_main_alu = "PERM_MAIN_ALU"; + Base::perm_main_bin = "PERM_MAIN_BIN"; + Base::perm_main_conv = "PERM_MAIN_CONV"; + Base::perm_main_pos2_perm = "PERM_MAIN_POS2_PERM"; + Base::perm_main_pedersen = "PERM_MAIN_PEDERSEN"; + Base::perm_main_slice = "PERM_MAIN_SLICE"; + Base::perm_main_mem_a = "PERM_MAIN_MEM_A"; + Base::perm_main_mem_b = "PERM_MAIN_MEM_B"; + Base::perm_main_mem_c = "PERM_MAIN_MEM_C"; + Base::perm_main_mem_d = "PERM_MAIN_MEM_D"; + Base::perm_main_mem_ind_addr_a = "PERM_MAIN_MEM_IND_ADDR_A"; + Base::perm_main_mem_ind_addr_b = "PERM_MAIN_MEM_IND_ADDR_B"; + Base::perm_main_mem_ind_addr_c = "PERM_MAIN_MEM_IND_ADDR_C"; + Base::perm_main_mem_ind_addr_d = "PERM_MAIN_MEM_IND_ADDR_D"; + Base::lookup_byte_lengths = "LOOKUP_BYTE_LENGTHS"; + Base::lookup_byte_operations = "LOOKUP_BYTE_OPERATIONS"; + Base::lookup_cd_value = "LOOKUP_CD_VALUE"; + Base::lookup_ret_value = "LOOKUP_RET_VALUE"; + Base::lookup_opcode_gas = "LOOKUP_OPCODE_GAS"; + Base::range_check_l2_gas_hi = "RANGE_CHECK_L2_GAS_HI"; + Base::range_check_l2_gas_lo = "RANGE_CHECK_L2_GAS_LO"; + Base::range_check_da_gas_hi = "RANGE_CHECK_DA_GAS_HI"; + Base::range_check_da_gas_lo = "RANGE_CHECK_DA_GAS_LO"; + Base::kernel_output_lookup = "KERNEL_OUTPUT_LOOKUP"; + Base::lookup_into_kernel = "LOOKUP_INTO_KERNEL"; + Base::incl_main_tag_err = "INCL_MAIN_TAG_ERR"; + Base::incl_mem_tag_err = "INCL_MEM_TAG_ERR"; + Base::lookup_mem_rng_chk_lo = "LOOKUP_MEM_RNG_CHK_LO"; + Base::lookup_mem_rng_chk_mid = "LOOKUP_MEM_RNG_CHK_MID"; + Base::lookup_mem_rng_chk_hi = "LOOKUP_MEM_RNG_CHK_HI"; + Base::lookup_pow_2_0 = "LOOKUP_POW_2_0"; + Base::lookup_pow_2_1 = "LOOKUP_POW_2_1"; + Base::lookup_u8_0 = "LOOKUP_U8_0"; + Base::lookup_u8_1 = "LOOKUP_U8_1"; + Base::lookup_u16_0 = "LOOKUP_U16_0"; + Base::lookup_u16_1 = "LOOKUP_U16_1"; + Base::lookup_u16_2 = "LOOKUP_U16_2"; + Base::lookup_u16_3 = "LOOKUP_U16_3"; + Base::lookup_u16_4 = "LOOKUP_U16_4"; + Base::lookup_u16_5 = "LOOKUP_U16_5"; + Base::lookup_u16_6 = "LOOKUP_U16_6"; + Base::lookup_u16_7 = "LOOKUP_U16_7"; + Base::lookup_u16_8 = "LOOKUP_U16_8"; + Base::lookup_u16_9 = "LOOKUP_U16_9"; + Base::lookup_u16_10 = "LOOKUP_U16_10"; + Base::lookup_u16_11 = "LOOKUP_U16_11"; + Base::lookup_u16_12 = "LOOKUP_U16_12"; + Base::lookup_u16_13 = "LOOKUP_U16_13"; + Base::lookup_u16_14 = "LOOKUP_U16_14"; + Base::lookup_div_u16_0 = "LOOKUP_DIV_U16_0"; + Base::lookup_div_u16_1 = "LOOKUP_DIV_U16_1"; + Base::lookup_div_u16_2 = "LOOKUP_DIV_U16_2"; + Base::lookup_div_u16_3 = "LOOKUP_DIV_U16_3"; + Base::lookup_div_u16_4 = "LOOKUP_DIV_U16_4"; + Base::lookup_div_u16_5 = "LOOKUP_DIV_U16_5"; + Base::lookup_div_u16_6 = "LOOKUP_DIV_U16_6"; + Base::lookup_div_u16_7 = "LOOKUP_DIV_U16_7"; + Base::lookup_byte_lengths_counts = "LOOKUP_BYTE_LENGTHS_COUNTS"; + Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; + Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; + Base::lookup_ret_value_counts = "LOOKUP_RET_VALUE_COUNTS"; + Base::lookup_opcode_gas_counts = "LOOKUP_OPCODE_GAS_COUNTS"; + Base::range_check_l2_gas_hi_counts = "RANGE_CHECK_L2_GAS_HI_COUNTS"; + Base::range_check_l2_gas_lo_counts = "RANGE_CHECK_L2_GAS_LO_COUNTS"; + Base::range_check_da_gas_hi_counts = "RANGE_CHECK_DA_GAS_HI_COUNTS"; + Base::range_check_da_gas_lo_counts = "RANGE_CHECK_DA_GAS_LO_COUNTS"; + Base::kernel_output_lookup_counts = "KERNEL_OUTPUT_LOOKUP_COUNTS"; + Base::lookup_into_kernel_counts = "LOOKUP_INTO_KERNEL_COUNTS"; + Base::incl_main_tag_err_counts = "INCL_MAIN_TAG_ERR_COUNTS"; + Base::incl_mem_tag_err_counts = "INCL_MEM_TAG_ERR_COUNTS"; + Base::lookup_mem_rng_chk_lo_counts = "LOOKUP_MEM_RNG_CHK_LO_COUNTS"; + Base::lookup_mem_rng_chk_mid_counts = "LOOKUP_MEM_RNG_CHK_MID_COUNTS"; + Base::lookup_mem_rng_chk_hi_counts = "LOOKUP_MEM_RNG_CHK_HI_COUNTS"; + Base::lookup_pow_2_0_counts = "LOOKUP_POW_2_0_COUNTS"; + Base::lookup_pow_2_1_counts = "LOOKUP_POW_2_1_COUNTS"; + Base::lookup_u8_0_counts = "LOOKUP_U8_0_COUNTS"; + Base::lookup_u8_1_counts = "LOOKUP_U8_1_COUNTS"; + Base::lookup_u16_0_counts = "LOOKUP_U16_0_COUNTS"; + Base::lookup_u16_1_counts = "LOOKUP_U16_1_COUNTS"; + Base::lookup_u16_2_counts = "LOOKUP_U16_2_COUNTS"; + Base::lookup_u16_3_counts = "LOOKUP_U16_3_COUNTS"; + Base::lookup_u16_4_counts = "LOOKUP_U16_4_COUNTS"; + Base::lookup_u16_5_counts = "LOOKUP_U16_5_COUNTS"; + Base::lookup_u16_6_counts = "LOOKUP_U16_6_COUNTS"; + Base::lookup_u16_7_counts = "LOOKUP_U16_7_COUNTS"; + Base::lookup_u16_8_counts = "LOOKUP_U16_8_COUNTS"; + Base::lookup_u16_9_counts = "LOOKUP_U16_9_COUNTS"; + Base::lookup_u16_10_counts = "LOOKUP_U16_10_COUNTS"; + Base::lookup_u16_11_counts = "LOOKUP_U16_11_COUNTS"; + Base::lookup_u16_12_counts = "LOOKUP_U16_12_COUNTS"; + Base::lookup_u16_13_counts = "LOOKUP_U16_13_COUNTS"; + Base::lookup_u16_14_counts = "LOOKUP_U16_14_COUNTS"; + Base::lookup_div_u16_0_counts = "LOOKUP_DIV_U16_0_COUNTS"; + Base::lookup_div_u16_1_counts = "LOOKUP_DIV_U16_1_COUNTS"; + Base::lookup_div_u16_2_counts = "LOOKUP_DIV_U16_2_COUNTS"; + Base::lookup_div_u16_3_counts = "LOOKUP_DIV_U16_3_COUNTS"; + Base::lookup_div_u16_4_counts = "LOOKUP_DIV_U16_4_COUNTS"; + Base::lookup_div_u16_5_counts = "LOOKUP_DIV_U16_5_COUNTS"; + Base::lookup_div_u16_6_counts = "LOOKUP_DIV_U16_6_COUNTS"; + Base::lookup_div_u16_7_counts = "LOOKUP_DIV_U16_7_COUNTS"; +}; + +AvmFlavor::VerifierCommitments::VerifierCommitments(const std::shared_ptr& verification_key) +{ + main_clk = verification_key->main_clk; + main_sel_first = verification_key->main_sel_first; +} + +void AvmFlavor::Transcript::deserialize_full_transcript() +{ + size_t num_frs_read = 0; + circuit_size = deserialize_from_buffer(proof_data, num_frs_read); + size_t log_n = numeric::get_msb(circuit_size); + + for (auto& commitment : commitments) { + commitment = deserialize_from_buffer(proof_data, num_frs_read); + } + for (size_t i = 0; i < log_n; ++i) { + sumcheck_univariates.emplace_back(deserialize_from_buffer>( + Transcript::proof_data, num_frs_read)); + } + sumcheck_evaluations = + deserialize_from_buffer>(Transcript::proof_data, num_frs_read); + for (size_t i = 0; i < log_n; ++i) { + zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_frs_read)); + } + zm_cq_comm = deserialize_from_buffer(proof_data, num_frs_read); + zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); +} + +void AvmFlavor::Transcript::serialize_full_transcript() +{ + size_t old_proof_length = proof_data.size(); + Transcript::proof_data.clear(); + size_t log_n = numeric::get_msb(circuit_size); + + serialize_to_buffer(circuit_size, Transcript::proof_data); + + for (const auto& commitment : commitments) { + serialize_to_buffer(commitment, Transcript::proof_data); + } + for (size_t i = 0; i < log_n; ++i) { + serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); + } + serialize_to_buffer(sumcheck_evaluations, Transcript::proof_data); + for (size_t i = 0; i < log_n; ++i) { + serialize_to_buffer(zm_cq_comms[i], proof_data); + } + serialize_to_buffer(zm_cq_comm, proof_data); + serialize_to_buffer(zm_pi_comm, proof_data); + + // sanity check to make sure we generate the same length of proof as before. + ASSERT(proof_data.size() == old_proof_length); +} + +AvmFlavor::PartiallyEvaluatedMultivariates::PartiallyEvaluatedMultivariates(const size_t circuit_size) +{ + // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2) + for (auto& poly : get_all()) { + poly = Polynomial(circuit_size / 2); + } +} + +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 62ea2eea347..d09cd22b099 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/kzg/kzg.hpp" @@ -305,493 +306,7 @@ class AvmFlavor { DEFINE_FLAVOR_MEMBERS(DataType, ALL_ENTITIES) - AllConstRefValues(const RefArray& il) - : main_clk(il[0]) - , main_sel_first(il[1]) - , kernel_kernel_inputs(il[2]) - , kernel_kernel_value_out(il[3]) - , kernel_kernel_side_effect_out(il[4]) - , kernel_kernel_metadata_out(il[5]) - , main_calldata(il[6]) - , main_returndata(il[7]) - , alu_a_hi(il[8]) - , alu_a_lo(il[9]) - , alu_b_hi(il[10]) - , alu_b_lo(il[11]) - , alu_borrow(il[12]) - , alu_cf(il[13]) - , alu_clk(il[14]) - , alu_cmp_rng_ctr(il[15]) - , alu_div_u16_r0(il[16]) - , alu_div_u16_r1(il[17]) - , alu_div_u16_r2(il[18]) - , alu_div_u16_r3(il[19]) - , alu_div_u16_r4(il[20]) - , alu_div_u16_r5(il[21]) - , alu_div_u16_r6(il[22]) - , alu_div_u16_r7(il[23]) - , alu_divisor_hi(il[24]) - , alu_divisor_lo(il[25]) - , alu_ff_tag(il[26]) - , alu_ia(il[27]) - , alu_ib(il[28]) - , alu_ic(il[29]) - , alu_in_tag(il[30]) - , alu_op_add(il[31]) - , alu_op_cast(il[32]) - , alu_op_cast_prev(il[33]) - , alu_op_div(il[34]) - , alu_op_div_a_lt_b(il[35]) - , alu_op_div_std(il[36]) - , alu_op_eq(il[37]) - , alu_op_eq_diff_inv(il[38]) - , alu_op_lt(il[39]) - , alu_op_lte(il[40]) - , alu_op_mul(il[41]) - , alu_op_not(il[42]) - , alu_op_shl(il[43]) - , alu_op_shr(il[44]) - , alu_op_sub(il[45]) - , alu_p_a_borrow(il[46]) - , alu_p_b_borrow(il[47]) - , alu_p_sub_a_hi(il[48]) - , alu_p_sub_a_lo(il[49]) - , alu_p_sub_b_hi(il[50]) - , alu_p_sub_b_lo(il[51]) - , alu_partial_prod_hi(il[52]) - , alu_partial_prod_lo(il[53]) - , alu_quotient_hi(il[54]) - , alu_quotient_lo(il[55]) - , alu_remainder(il[56]) - , alu_res_hi(il[57]) - , alu_res_lo(il[58]) - , alu_sel_alu(il[59]) - , alu_sel_cmp(il[60]) - , alu_sel_div_rng_chk(il[61]) - , alu_sel_rng_chk(il[62]) - , alu_sel_rng_chk_lookup(il[63]) - , alu_sel_shift_which(il[64]) - , alu_shift_lt_bit_len(il[65]) - , alu_t_sub_s_bits(il[66]) - , alu_two_pow_s(il[67]) - , alu_two_pow_t_sub_s(il[68]) - , alu_u128_tag(il[69]) - , alu_u16_r0(il[70]) - , alu_u16_r1(il[71]) - , alu_u16_r10(il[72]) - , alu_u16_r11(il[73]) - , alu_u16_r12(il[74]) - , alu_u16_r13(il[75]) - , alu_u16_r14(il[76]) - , alu_u16_r2(il[77]) - , alu_u16_r3(il[78]) - , alu_u16_r4(il[79]) - , alu_u16_r5(il[80]) - , alu_u16_r6(il[81]) - , alu_u16_r7(il[82]) - , alu_u16_r8(il[83]) - , alu_u16_r9(il[84]) - , alu_u16_tag(il[85]) - , alu_u32_tag(il[86]) - , alu_u64_tag(il[87]) - , alu_u8_r0(il[88]) - , alu_u8_r1(il[89]) - , alu_u8_tag(il[90]) - , binary_acc_ia(il[91]) - , binary_acc_ib(il[92]) - , binary_acc_ic(il[93]) - , binary_clk(il[94]) - , binary_ia_bytes(il[95]) - , binary_ib_bytes(il[96]) - , binary_ic_bytes(il[97]) - , binary_in_tag(il[98]) - , binary_mem_tag_ctr(il[99]) - , binary_mem_tag_ctr_inv(il[100]) - , binary_op_id(il[101]) - , binary_sel_bin(il[102]) - , binary_start(il[103]) - , byte_lookup_sel_bin(il[104]) - , byte_lookup_table_byte_lengths(il[105]) - , byte_lookup_table_in_tags(il[106]) - , byte_lookup_table_input_a(il[107]) - , byte_lookup_table_input_b(il[108]) - , byte_lookup_table_op_id(il[109]) - , byte_lookup_table_output(il[110]) - , conversion_clk(il[111]) - , conversion_input(il[112]) - , conversion_num_limbs(il[113]) - , conversion_radix(il[114]) - , conversion_sel_to_radix_le(il[115]) - , gas_da_gas_fixed_table(il[116]) - , gas_l2_gas_fixed_table(il[117]) - , gas_sel_gas_cost(il[118]) - , keccakf1600_clk(il[119]) - , keccakf1600_input(il[120]) - , keccakf1600_output(il[121]) - , keccakf1600_sel_keccakf1600(il[122]) - , kernel_emit_l2_to_l1_msg_write_offset(il[123]) - , kernel_emit_note_hash_write_offset(il[124]) - , kernel_emit_nullifier_write_offset(il[125]) - , kernel_emit_unencrypted_log_write_offset(il[126]) - , kernel_kernel_in_offset(il[127]) - , kernel_kernel_out_offset(il[128]) - , kernel_l1_to_l2_msg_exists_write_offset(il[129]) - , kernel_note_hash_exist_write_offset(il[130]) - , kernel_nullifier_exists_write_offset(il[131]) - , kernel_nullifier_non_exists_write_offset(il[132]) - , kernel_q_public_input_kernel_add_to_table(il[133]) - , kernel_q_public_input_kernel_out_add_to_table(il[134]) - , kernel_side_effect_counter(il[135]) - , kernel_sload_write_offset(il[136]) - , kernel_sstore_write_offset(il[137]) - , main_abs_da_rem_gas_hi(il[138]) - , main_abs_da_rem_gas_lo(il[139]) - , main_abs_l2_rem_gas_hi(il[140]) - , main_abs_l2_rem_gas_lo(il[141]) - , main_alu_in_tag(il[142]) - , main_bin_op_id(il[143]) - , main_call_ptr(il[144]) - , main_da_gas_op_cost(il[145]) - , main_da_gas_remaining(il[146]) - , main_da_out_of_gas(il[147]) - , main_ia(il[148]) - , main_ib(il[149]) - , main_ic(il[150]) - , main_id(il[151]) - , main_id_zero(il[152]) - , main_ind_addr_a(il[153]) - , main_ind_addr_b(il[154]) - , main_ind_addr_c(il[155]) - , main_ind_addr_d(il[156]) - , main_internal_return_ptr(il[157]) - , main_inv(il[158]) - , main_l2_gas_op_cost(il[159]) - , main_l2_gas_remaining(il[160]) - , main_l2_out_of_gas(il[161]) - , main_mem_addr_a(il[162]) - , main_mem_addr_b(il[163]) - , main_mem_addr_c(il[164]) - , main_mem_addr_d(il[165]) - , main_op_err(il[166]) - , main_opcode_val(il[167]) - , main_pc(il[168]) - , main_r_in_tag(il[169]) - , main_rwa(il[170]) - , main_rwb(il[171]) - , main_rwc(il[172]) - , main_rwd(il[173]) - , main_sel_alu(il[174]) - , main_sel_bin(il[175]) - , main_sel_calldata(il[176]) - , main_sel_gas_accounting_active(il[177]) - , main_sel_last(il[178]) - , main_sel_mem_op_a(il[179]) - , main_sel_mem_op_activate_gas(il[180]) - , main_sel_mem_op_b(il[181]) - , main_sel_mem_op_c(il[182]) - , main_sel_mem_op_d(il[183]) - , main_sel_mov_ia_to_ic(il[184]) - , main_sel_mov_ib_to_ic(il[185]) - , main_sel_op_add(il[186]) - , main_sel_op_address(il[187]) - , main_sel_op_and(il[188]) - , main_sel_op_block_number(il[189]) - , main_sel_op_calldata_copy(il[190]) - , main_sel_op_cast(il[191]) - , main_sel_op_chain_id(il[192]) - , main_sel_op_cmov(il[193]) - , main_sel_op_coinbase(il[194]) - , main_sel_op_dagasleft(il[195]) - , main_sel_op_div(il[196]) - , main_sel_op_emit_l2_to_l1_msg(il[197]) - , main_sel_op_emit_note_hash(il[198]) - , main_sel_op_emit_nullifier(il[199]) - , main_sel_op_emit_unencrypted_log(il[200]) - , main_sel_op_eq(il[201]) - , main_sel_op_external_call(il[202]) - , main_sel_op_external_return(il[203]) - , main_sel_op_fdiv(il[204]) - , main_sel_op_fee_per_da_gas(il[205]) - , main_sel_op_fee_per_l2_gas(il[206]) - , main_sel_op_function_selector(il[207]) - , main_sel_op_get_contract_instance(il[208]) - , main_sel_op_halt(il[209]) - , main_sel_op_internal_call(il[210]) - , main_sel_op_internal_return(il[211]) - , main_sel_op_jump(il[212]) - , main_sel_op_jumpi(il[213]) - , main_sel_op_keccak(il[214]) - , main_sel_op_l1_to_l2_msg_exists(il[215]) - , main_sel_op_l2gasleft(il[216]) - , main_sel_op_lt(il[217]) - , main_sel_op_lte(il[218]) - , main_sel_op_mov(il[219]) - , main_sel_op_mul(il[220]) - , main_sel_op_not(il[221]) - , main_sel_op_note_hash_exists(il[222]) - , main_sel_op_nullifier_exists(il[223]) - , main_sel_op_or(il[224]) - , main_sel_op_pedersen(il[225]) - , main_sel_op_poseidon2(il[226]) - , main_sel_op_radix_le(il[227]) - , main_sel_op_sender(il[228]) - , main_sel_op_sha256(il[229]) - , main_sel_op_shl(il[230]) - , main_sel_op_shr(il[231]) - , main_sel_op_sload(il[232]) - , main_sel_op_sstore(il[233]) - , main_sel_op_storage_address(il[234]) - , main_sel_op_sub(il[235]) - , main_sel_op_timestamp(il[236]) - , main_sel_op_transaction_fee(il[237]) - , main_sel_op_version(il[238]) - , main_sel_op_xor(il[239]) - , main_sel_q_kernel_lookup(il[240]) - , main_sel_q_kernel_output_lookup(il[241]) - , main_sel_resolve_ind_addr_a(il[242]) - , main_sel_resolve_ind_addr_b(il[243]) - , main_sel_resolve_ind_addr_c(il[244]) - , main_sel_resolve_ind_addr_d(il[245]) - , main_sel_returndata(il[246]) - , main_sel_rng_16(il[247]) - , main_sel_rng_8(il[248]) - , main_sel_slice_gadget(il[249]) - , main_space_id(il[250]) - , main_tag_err(il[251]) - , main_w_in_tag(il[252]) - , mem_addr(il[253]) - , mem_clk(il[254]) - , mem_diff_hi(il[255]) - , mem_diff_lo(il[256]) - , mem_diff_mid(il[257]) - , mem_glob_addr(il[258]) - , mem_last(il[259]) - , mem_lastAccess(il[260]) - , mem_one_min_inv(il[261]) - , mem_r_in_tag(il[262]) - , mem_rw(il[263]) - , mem_sel_mem(il[264]) - , mem_sel_mov_ia_to_ic(il[265]) - , mem_sel_mov_ib_to_ic(il[266]) - , mem_sel_op_a(il[267]) - , mem_sel_op_b(il[268]) - , mem_sel_op_c(il[269]) - , mem_sel_op_cmov(il[270]) - , mem_sel_op_d(il[271]) - , mem_sel_op_slice(il[272]) - , mem_sel_resolve_ind_addr_a(il[273]) - , mem_sel_resolve_ind_addr_b(il[274]) - , mem_sel_resolve_ind_addr_c(il[275]) - , mem_sel_resolve_ind_addr_d(il[276]) - , mem_sel_rng_chk(il[277]) - , mem_skip_check_tag(il[278]) - , mem_space_id(il[279]) - , mem_tag(il[280]) - , mem_tag_err(il[281]) - , mem_tsp(il[282]) - , mem_val(il[283]) - , mem_w_in_tag(il[284]) - , pedersen_clk(il[285]) - , pedersen_input(il[286]) - , pedersen_output(il[287]) - , pedersen_sel_pedersen(il[288]) - , poseidon2_clk(il[289]) - , poseidon2_input(il[290]) - , poseidon2_output(il[291]) - , poseidon2_sel_poseidon_perm(il[292]) - , powers_power_of_2(il[293]) - , sha256_clk(il[294]) - , sha256_input(il[295]) - , sha256_output(il[296]) - , sha256_sel_sha256_compression(il[297]) - , sha256_state(il[298]) - , slice_addr(il[299]) - , slice_clk(il[300]) - , slice_cnt(il[301]) - , slice_col_offset(il[302]) - , slice_one_min_inv(il[303]) - , slice_sel_cd_cpy(il[304]) - , slice_sel_mem_active(il[305]) - , slice_sel_return(il[306]) - , slice_sel_start(il[307]) - , slice_space_id(il[308]) - , slice_val(il[309]) - , lookup_byte_lengths_counts(il[310]) - , lookup_byte_operations_counts(il[311]) - , lookup_cd_value_counts(il[312]) - , lookup_ret_value_counts(il[313]) - , lookup_opcode_gas_counts(il[314]) - , range_check_l2_gas_hi_counts(il[315]) - , range_check_l2_gas_lo_counts(il[316]) - , range_check_da_gas_hi_counts(il[317]) - , range_check_da_gas_lo_counts(il[318]) - , kernel_output_lookup_counts(il[319]) - , lookup_into_kernel_counts(il[320]) - , incl_main_tag_err_counts(il[321]) - , incl_mem_tag_err_counts(il[322]) - , lookup_mem_rng_chk_lo_counts(il[323]) - , lookup_mem_rng_chk_mid_counts(il[324]) - , lookup_mem_rng_chk_hi_counts(il[325]) - , lookup_pow_2_0_counts(il[326]) - , lookup_pow_2_1_counts(il[327]) - , lookup_u8_0_counts(il[328]) - , lookup_u8_1_counts(il[329]) - , lookup_u16_0_counts(il[330]) - , lookup_u16_1_counts(il[331]) - , lookup_u16_2_counts(il[332]) - , lookup_u16_3_counts(il[333]) - , lookup_u16_4_counts(il[334]) - , lookup_u16_5_counts(il[335]) - , lookup_u16_6_counts(il[336]) - , lookup_u16_7_counts(il[337]) - , lookup_u16_8_counts(il[338]) - , lookup_u16_9_counts(il[339]) - , lookup_u16_10_counts(il[340]) - , lookup_u16_11_counts(il[341]) - , lookup_u16_12_counts(il[342]) - , lookup_u16_13_counts(il[343]) - , lookup_u16_14_counts(il[344]) - , lookup_div_u16_0_counts(il[345]) - , lookup_div_u16_1_counts(il[346]) - , lookup_div_u16_2_counts(il[347]) - , lookup_div_u16_3_counts(il[348]) - , lookup_div_u16_4_counts(il[349]) - , lookup_div_u16_5_counts(il[350]) - , lookup_div_u16_6_counts(il[351]) - , lookup_div_u16_7_counts(il[352]) - , perm_slice_mem(il[353]) - , perm_main_alu(il[354]) - , perm_main_bin(il[355]) - , perm_main_conv(il[356]) - , perm_main_pos2_perm(il[357]) - , perm_main_pedersen(il[358]) - , perm_main_slice(il[359]) - , perm_main_mem_a(il[360]) - , perm_main_mem_b(il[361]) - , perm_main_mem_c(il[362]) - , perm_main_mem_d(il[363]) - , perm_main_mem_ind_addr_a(il[364]) - , perm_main_mem_ind_addr_b(il[365]) - , perm_main_mem_ind_addr_c(il[366]) - , perm_main_mem_ind_addr_d(il[367]) - , lookup_byte_lengths(il[368]) - , lookup_byte_operations(il[369]) - , lookup_cd_value(il[370]) - , lookup_ret_value(il[371]) - , lookup_opcode_gas(il[372]) - , range_check_l2_gas_hi(il[373]) - , range_check_l2_gas_lo(il[374]) - , range_check_da_gas_hi(il[375]) - , range_check_da_gas_lo(il[376]) - , kernel_output_lookup(il[377]) - , lookup_into_kernel(il[378]) - , incl_main_tag_err(il[379]) - , incl_mem_tag_err(il[380]) - , lookup_mem_rng_chk_lo(il[381]) - , lookup_mem_rng_chk_mid(il[382]) - , lookup_mem_rng_chk_hi(il[383]) - , lookup_pow_2_0(il[384]) - , lookup_pow_2_1(il[385]) - , lookup_u8_0(il[386]) - , lookup_u8_1(il[387]) - , lookup_u16_0(il[388]) - , lookup_u16_1(il[389]) - , lookup_u16_2(il[390]) - , lookup_u16_3(il[391]) - , lookup_u16_4(il[392]) - , lookup_u16_5(il[393]) - , lookup_u16_6(il[394]) - , lookup_u16_7(il[395]) - , lookup_u16_8(il[396]) - , lookup_u16_9(il[397]) - , lookup_u16_10(il[398]) - , lookup_u16_11(il[399]) - , lookup_u16_12(il[400]) - , lookup_u16_13(il[401]) - , lookup_u16_14(il[402]) - , lookup_div_u16_0(il[403]) - , lookup_div_u16_1(il[404]) - , lookup_div_u16_2(il[405]) - , lookup_div_u16_3(il[406]) - , lookup_div_u16_4(il[407]) - , lookup_div_u16_5(il[408]) - , lookup_div_u16_6(il[409]) - , lookup_div_u16_7(il[410]) - , alu_a_hi_shift(il[411]) - , alu_a_lo_shift(il[412]) - , alu_b_hi_shift(il[413]) - , alu_b_lo_shift(il[414]) - , alu_cmp_rng_ctr_shift(il[415]) - , alu_div_u16_r0_shift(il[416]) - , alu_div_u16_r1_shift(il[417]) - , alu_div_u16_r2_shift(il[418]) - , alu_div_u16_r3_shift(il[419]) - , alu_div_u16_r4_shift(il[420]) - , alu_div_u16_r5_shift(il[421]) - , alu_div_u16_r6_shift(il[422]) - , alu_div_u16_r7_shift(il[423]) - , alu_op_add_shift(il[424]) - , alu_op_cast_prev_shift(il[425]) - , alu_op_cast_shift(il[426]) - , alu_op_div_shift(il[427]) - , alu_op_mul_shift(il[428]) - , alu_op_shl_shift(il[429]) - , alu_op_shr_shift(il[430]) - , alu_op_sub_shift(il[431]) - , alu_p_sub_a_hi_shift(il[432]) - , alu_p_sub_a_lo_shift(il[433]) - , alu_p_sub_b_hi_shift(il[434]) - , alu_p_sub_b_lo_shift(il[435]) - , alu_sel_alu_shift(il[436]) - , alu_sel_cmp_shift(il[437]) - , alu_sel_div_rng_chk_shift(il[438]) - , alu_sel_rng_chk_lookup_shift(il[439]) - , alu_sel_rng_chk_shift(il[440]) - , alu_u16_r0_shift(il[441]) - , alu_u16_r1_shift(il[442]) - , alu_u16_r2_shift(il[443]) - , alu_u16_r3_shift(il[444]) - , alu_u16_r4_shift(il[445]) - , alu_u16_r5_shift(il[446]) - , alu_u16_r6_shift(il[447]) - , alu_u8_r0_shift(il[448]) - , alu_u8_r1_shift(il[449]) - , binary_acc_ia_shift(il[450]) - , binary_acc_ib_shift(il[451]) - , binary_acc_ic_shift(il[452]) - , binary_mem_tag_ctr_shift(il[453]) - , binary_op_id_shift(il[454]) - , kernel_emit_l2_to_l1_msg_write_offset_shift(il[455]) - , kernel_emit_note_hash_write_offset_shift(il[456]) - , kernel_emit_nullifier_write_offset_shift(il[457]) - , kernel_emit_unencrypted_log_write_offset_shift(il[458]) - , kernel_l1_to_l2_msg_exists_write_offset_shift(il[459]) - , kernel_note_hash_exist_write_offset_shift(il[460]) - , kernel_nullifier_exists_write_offset_shift(il[461]) - , kernel_nullifier_non_exists_write_offset_shift(il[462]) - , kernel_side_effect_counter_shift(il[463]) - , kernel_sload_write_offset_shift(il[464]) - , kernel_sstore_write_offset_shift(il[465]) - , main_da_gas_remaining_shift(il[466]) - , main_internal_return_ptr_shift(il[467]) - , main_l2_gas_remaining_shift(il[468]) - , main_pc_shift(il[469]) - , mem_glob_addr_shift(il[470]) - , mem_rw_shift(il[471]) - , mem_sel_mem_shift(il[472]) - , mem_tag_shift(il[473]) - , mem_tsp_shift(il[474]) - , mem_val_shift(il[475]) - , slice_addr_shift(il[476]) - , slice_clk_shift(il[477]) - , slice_cnt_shift(il[478]) - , slice_col_offset_shift(il[479]) - , slice_sel_cd_cpy_shift(il[480]) - , slice_sel_mem_active_shift(il[481]) - , slice_sel_return_shift(il[482]) - , slice_sel_start_shift(il[483]) - , slice_space_id_shift(il[484]) - {} + AllConstRefValues(const RefArray& il); }; /** @@ -807,523 +322,20 @@ class AvmFlavor { ProverPolynomials& operator=(ProverPolynomials&& o) noexcept = default; ~ProverPolynomials() = default; - ProverPolynomials(ProvingKey& proving_key) - { - for (auto [prover_poly, key_poly] : zip_view(this->get_unshifted(), proving_key.get_all())) { - ASSERT(flavor_get_label(*this, prover_poly) == flavor_get_label(proving_key, key_poly)); - prover_poly = key_poly.share(); - } - for (auto [prover_poly, key_poly] : zip_view(this->get_shifted(), proving_key.get_to_be_shifted())) { - ASSERT(flavor_get_label(*this, prover_poly) == (flavor_get_label(proving_key, key_poly) + "_shift")); - prover_poly = key_poly.shifted(); - } - } + ProverPolynomials(ProvingKey& proving_key); [[nodiscard]] size_t get_polynomial_size() const { return kernel_kernel_inputs.size(); } /** * @brief Returns the evaluations of all prover polynomials at one point on the boolean hypercube, which * represents one row in the execution trace. */ - [[nodiscard]] AllConstRefValues get_row(size_t row_idx) const - { - return AllConstRefValues(RefArray{ main_clk[row_idx], - main_sel_first[row_idx], - kernel_kernel_inputs[row_idx], - kernel_kernel_value_out[row_idx], - kernel_kernel_side_effect_out[row_idx], - kernel_kernel_metadata_out[row_idx], - main_calldata[row_idx], - main_returndata[row_idx], - alu_a_hi[row_idx], - alu_a_lo[row_idx], - alu_b_hi[row_idx], - alu_b_lo[row_idx], - alu_borrow[row_idx], - alu_cf[row_idx], - alu_clk[row_idx], - alu_cmp_rng_ctr[row_idx], - alu_div_u16_r0[row_idx], - alu_div_u16_r1[row_idx], - alu_div_u16_r2[row_idx], - alu_div_u16_r3[row_idx], - alu_div_u16_r4[row_idx], - alu_div_u16_r5[row_idx], - alu_div_u16_r6[row_idx], - alu_div_u16_r7[row_idx], - alu_divisor_hi[row_idx], - alu_divisor_lo[row_idx], - alu_ff_tag[row_idx], - alu_ia[row_idx], - alu_ib[row_idx], - alu_ic[row_idx], - alu_in_tag[row_idx], - alu_op_add[row_idx], - alu_op_cast[row_idx], - alu_op_cast_prev[row_idx], - alu_op_div[row_idx], - alu_op_div_a_lt_b[row_idx], - alu_op_div_std[row_idx], - alu_op_eq[row_idx], - alu_op_eq_diff_inv[row_idx], - alu_op_lt[row_idx], - alu_op_lte[row_idx], - alu_op_mul[row_idx], - alu_op_not[row_idx], - alu_op_shl[row_idx], - alu_op_shr[row_idx], - alu_op_sub[row_idx], - alu_p_a_borrow[row_idx], - alu_p_b_borrow[row_idx], - alu_p_sub_a_hi[row_idx], - alu_p_sub_a_lo[row_idx], - alu_p_sub_b_hi[row_idx], - alu_p_sub_b_lo[row_idx], - alu_partial_prod_hi[row_idx], - alu_partial_prod_lo[row_idx], - alu_quotient_hi[row_idx], - alu_quotient_lo[row_idx], - alu_remainder[row_idx], - alu_res_hi[row_idx], - alu_res_lo[row_idx], - alu_sel_alu[row_idx], - alu_sel_cmp[row_idx], - alu_sel_div_rng_chk[row_idx], - alu_sel_rng_chk[row_idx], - alu_sel_rng_chk_lookup[row_idx], - alu_sel_shift_which[row_idx], - alu_shift_lt_bit_len[row_idx], - alu_t_sub_s_bits[row_idx], - alu_two_pow_s[row_idx], - alu_two_pow_t_sub_s[row_idx], - alu_u128_tag[row_idx], - alu_u16_r0[row_idx], - alu_u16_r1[row_idx], - alu_u16_r10[row_idx], - alu_u16_r11[row_idx], - alu_u16_r12[row_idx], - alu_u16_r13[row_idx], - alu_u16_r14[row_idx], - alu_u16_r2[row_idx], - alu_u16_r3[row_idx], - alu_u16_r4[row_idx], - alu_u16_r5[row_idx], - alu_u16_r6[row_idx], - alu_u16_r7[row_idx], - alu_u16_r8[row_idx], - alu_u16_r9[row_idx], - alu_u16_tag[row_idx], - alu_u32_tag[row_idx], - alu_u64_tag[row_idx], - alu_u8_r0[row_idx], - alu_u8_r1[row_idx], - alu_u8_tag[row_idx], - binary_acc_ia[row_idx], - binary_acc_ib[row_idx], - binary_acc_ic[row_idx], - binary_clk[row_idx], - binary_ia_bytes[row_idx], - binary_ib_bytes[row_idx], - binary_ic_bytes[row_idx], - binary_in_tag[row_idx], - binary_mem_tag_ctr[row_idx], - binary_mem_tag_ctr_inv[row_idx], - binary_op_id[row_idx], - binary_sel_bin[row_idx], - binary_start[row_idx], - byte_lookup_sel_bin[row_idx], - byte_lookup_table_byte_lengths[row_idx], - byte_lookup_table_in_tags[row_idx], - byte_lookup_table_input_a[row_idx], - byte_lookup_table_input_b[row_idx], - byte_lookup_table_op_id[row_idx], - byte_lookup_table_output[row_idx], - conversion_clk[row_idx], - conversion_input[row_idx], - conversion_num_limbs[row_idx], - conversion_radix[row_idx], - conversion_sel_to_radix_le[row_idx], - gas_da_gas_fixed_table[row_idx], - gas_l2_gas_fixed_table[row_idx], - gas_sel_gas_cost[row_idx], - keccakf1600_clk[row_idx], - keccakf1600_input[row_idx], - keccakf1600_output[row_idx], - keccakf1600_sel_keccakf1600[row_idx], - kernel_emit_l2_to_l1_msg_write_offset[row_idx], - kernel_emit_note_hash_write_offset[row_idx], - kernel_emit_nullifier_write_offset[row_idx], - kernel_emit_unencrypted_log_write_offset[row_idx], - kernel_kernel_in_offset[row_idx], - kernel_kernel_out_offset[row_idx], - kernel_l1_to_l2_msg_exists_write_offset[row_idx], - kernel_note_hash_exist_write_offset[row_idx], - kernel_nullifier_exists_write_offset[row_idx], - kernel_nullifier_non_exists_write_offset[row_idx], - kernel_q_public_input_kernel_add_to_table[row_idx], - kernel_q_public_input_kernel_out_add_to_table[row_idx], - kernel_side_effect_counter[row_idx], - kernel_sload_write_offset[row_idx], - kernel_sstore_write_offset[row_idx], - main_abs_da_rem_gas_hi[row_idx], - main_abs_da_rem_gas_lo[row_idx], - main_abs_l2_rem_gas_hi[row_idx], - main_abs_l2_rem_gas_lo[row_idx], - main_alu_in_tag[row_idx], - main_bin_op_id[row_idx], - main_call_ptr[row_idx], - main_da_gas_op_cost[row_idx], - main_da_gas_remaining[row_idx], - main_da_out_of_gas[row_idx], - main_ia[row_idx], - main_ib[row_idx], - main_ic[row_idx], - main_id[row_idx], - main_id_zero[row_idx], - main_ind_addr_a[row_idx], - main_ind_addr_b[row_idx], - main_ind_addr_c[row_idx], - main_ind_addr_d[row_idx], - main_internal_return_ptr[row_idx], - main_inv[row_idx], - main_l2_gas_op_cost[row_idx], - main_l2_gas_remaining[row_idx], - main_l2_out_of_gas[row_idx], - main_mem_addr_a[row_idx], - main_mem_addr_b[row_idx], - main_mem_addr_c[row_idx], - main_mem_addr_d[row_idx], - main_op_err[row_idx], - main_opcode_val[row_idx], - main_pc[row_idx], - main_r_in_tag[row_idx], - main_rwa[row_idx], - main_rwb[row_idx], - main_rwc[row_idx], - main_rwd[row_idx], - main_sel_alu[row_idx], - main_sel_bin[row_idx], - main_sel_calldata[row_idx], - main_sel_gas_accounting_active[row_idx], - main_sel_last[row_idx], - main_sel_mem_op_a[row_idx], - main_sel_mem_op_activate_gas[row_idx], - main_sel_mem_op_b[row_idx], - main_sel_mem_op_c[row_idx], - main_sel_mem_op_d[row_idx], - main_sel_mov_ia_to_ic[row_idx], - main_sel_mov_ib_to_ic[row_idx], - main_sel_op_add[row_idx], - main_sel_op_address[row_idx], - main_sel_op_and[row_idx], - main_sel_op_block_number[row_idx], - main_sel_op_calldata_copy[row_idx], - main_sel_op_cast[row_idx], - main_sel_op_chain_id[row_idx], - main_sel_op_cmov[row_idx], - main_sel_op_coinbase[row_idx], - main_sel_op_dagasleft[row_idx], - main_sel_op_div[row_idx], - main_sel_op_emit_l2_to_l1_msg[row_idx], - main_sel_op_emit_note_hash[row_idx], - main_sel_op_emit_nullifier[row_idx], - main_sel_op_emit_unencrypted_log[row_idx], - main_sel_op_eq[row_idx], - main_sel_op_external_call[row_idx], - main_sel_op_external_return[row_idx], - main_sel_op_fdiv[row_idx], - main_sel_op_fee_per_da_gas[row_idx], - main_sel_op_fee_per_l2_gas[row_idx], - main_sel_op_function_selector[row_idx], - main_sel_op_get_contract_instance[row_idx], - main_sel_op_halt[row_idx], - main_sel_op_internal_call[row_idx], - main_sel_op_internal_return[row_idx], - main_sel_op_jump[row_idx], - main_sel_op_jumpi[row_idx], - main_sel_op_keccak[row_idx], - main_sel_op_l1_to_l2_msg_exists[row_idx], - main_sel_op_l2gasleft[row_idx], - main_sel_op_lt[row_idx], - main_sel_op_lte[row_idx], - main_sel_op_mov[row_idx], - main_sel_op_mul[row_idx], - main_sel_op_not[row_idx], - main_sel_op_note_hash_exists[row_idx], - main_sel_op_nullifier_exists[row_idx], - main_sel_op_or[row_idx], - main_sel_op_pedersen[row_idx], - main_sel_op_poseidon2[row_idx], - main_sel_op_radix_le[row_idx], - main_sel_op_sender[row_idx], - main_sel_op_sha256[row_idx], - main_sel_op_shl[row_idx], - main_sel_op_shr[row_idx], - main_sel_op_sload[row_idx], - main_sel_op_sstore[row_idx], - main_sel_op_storage_address[row_idx], - main_sel_op_sub[row_idx], - main_sel_op_timestamp[row_idx], - main_sel_op_transaction_fee[row_idx], - main_sel_op_version[row_idx], - main_sel_op_xor[row_idx], - main_sel_q_kernel_lookup[row_idx], - main_sel_q_kernel_output_lookup[row_idx], - main_sel_resolve_ind_addr_a[row_idx], - main_sel_resolve_ind_addr_b[row_idx], - main_sel_resolve_ind_addr_c[row_idx], - main_sel_resolve_ind_addr_d[row_idx], - main_sel_returndata[row_idx], - main_sel_rng_16[row_idx], - main_sel_rng_8[row_idx], - main_sel_slice_gadget[row_idx], - main_space_id[row_idx], - main_tag_err[row_idx], - main_w_in_tag[row_idx], - mem_addr[row_idx], - mem_clk[row_idx], - mem_diff_hi[row_idx], - mem_diff_lo[row_idx], - mem_diff_mid[row_idx], - mem_glob_addr[row_idx], - mem_last[row_idx], - mem_lastAccess[row_idx], - mem_one_min_inv[row_idx], - mem_r_in_tag[row_idx], - mem_rw[row_idx], - mem_sel_mem[row_idx], - mem_sel_mov_ia_to_ic[row_idx], - mem_sel_mov_ib_to_ic[row_idx], - mem_sel_op_a[row_idx], - mem_sel_op_b[row_idx], - mem_sel_op_c[row_idx], - mem_sel_op_cmov[row_idx], - mem_sel_op_d[row_idx], - mem_sel_op_slice[row_idx], - mem_sel_resolve_ind_addr_a[row_idx], - mem_sel_resolve_ind_addr_b[row_idx], - mem_sel_resolve_ind_addr_c[row_idx], - mem_sel_resolve_ind_addr_d[row_idx], - mem_sel_rng_chk[row_idx], - mem_skip_check_tag[row_idx], - mem_space_id[row_idx], - mem_tag[row_idx], - mem_tag_err[row_idx], - mem_tsp[row_idx], - mem_val[row_idx], - mem_w_in_tag[row_idx], - pedersen_clk[row_idx], - pedersen_input[row_idx], - pedersen_output[row_idx], - pedersen_sel_pedersen[row_idx], - poseidon2_clk[row_idx], - poseidon2_input[row_idx], - poseidon2_output[row_idx], - poseidon2_sel_poseidon_perm[row_idx], - powers_power_of_2[row_idx], - sha256_clk[row_idx], - sha256_input[row_idx], - sha256_output[row_idx], - sha256_sel_sha256_compression[row_idx], - sha256_state[row_idx], - slice_addr[row_idx], - slice_clk[row_idx], - slice_cnt[row_idx], - slice_col_offset[row_idx], - slice_one_min_inv[row_idx], - slice_sel_cd_cpy[row_idx], - slice_sel_mem_active[row_idx], - slice_sel_return[row_idx], - slice_sel_start[row_idx], - slice_space_id[row_idx], - slice_val[row_idx], - lookup_byte_lengths_counts[row_idx], - lookup_byte_operations_counts[row_idx], - lookup_cd_value_counts[row_idx], - lookup_ret_value_counts[row_idx], - lookup_opcode_gas_counts[row_idx], - range_check_l2_gas_hi_counts[row_idx], - range_check_l2_gas_lo_counts[row_idx], - range_check_da_gas_hi_counts[row_idx], - range_check_da_gas_lo_counts[row_idx], - kernel_output_lookup_counts[row_idx], - lookup_into_kernel_counts[row_idx], - incl_main_tag_err_counts[row_idx], - incl_mem_tag_err_counts[row_idx], - lookup_mem_rng_chk_lo_counts[row_idx], - lookup_mem_rng_chk_mid_counts[row_idx], - lookup_mem_rng_chk_hi_counts[row_idx], - lookup_pow_2_0_counts[row_idx], - lookup_pow_2_1_counts[row_idx], - lookup_u8_0_counts[row_idx], - lookup_u8_1_counts[row_idx], - lookup_u16_0_counts[row_idx], - lookup_u16_1_counts[row_idx], - lookup_u16_2_counts[row_idx], - lookup_u16_3_counts[row_idx], - lookup_u16_4_counts[row_idx], - lookup_u16_5_counts[row_idx], - lookup_u16_6_counts[row_idx], - lookup_u16_7_counts[row_idx], - lookup_u16_8_counts[row_idx], - lookup_u16_9_counts[row_idx], - lookup_u16_10_counts[row_idx], - lookup_u16_11_counts[row_idx], - lookup_u16_12_counts[row_idx], - lookup_u16_13_counts[row_idx], - lookup_u16_14_counts[row_idx], - lookup_div_u16_0_counts[row_idx], - lookup_div_u16_1_counts[row_idx], - lookup_div_u16_2_counts[row_idx], - lookup_div_u16_3_counts[row_idx], - lookup_div_u16_4_counts[row_idx], - lookup_div_u16_5_counts[row_idx], - lookup_div_u16_6_counts[row_idx], - lookup_div_u16_7_counts[row_idx], - perm_slice_mem[row_idx], - perm_main_alu[row_idx], - perm_main_bin[row_idx], - perm_main_conv[row_idx], - perm_main_pos2_perm[row_idx], - perm_main_pedersen[row_idx], - perm_main_slice[row_idx], - perm_main_mem_a[row_idx], - perm_main_mem_b[row_idx], - perm_main_mem_c[row_idx], - perm_main_mem_d[row_idx], - perm_main_mem_ind_addr_a[row_idx], - perm_main_mem_ind_addr_b[row_idx], - perm_main_mem_ind_addr_c[row_idx], - perm_main_mem_ind_addr_d[row_idx], - lookup_byte_lengths[row_idx], - lookup_byte_operations[row_idx], - lookup_cd_value[row_idx], - lookup_ret_value[row_idx], - lookup_opcode_gas[row_idx], - range_check_l2_gas_hi[row_idx], - range_check_l2_gas_lo[row_idx], - range_check_da_gas_hi[row_idx], - range_check_da_gas_lo[row_idx], - kernel_output_lookup[row_idx], - lookup_into_kernel[row_idx], - incl_main_tag_err[row_idx], - incl_mem_tag_err[row_idx], - lookup_mem_rng_chk_lo[row_idx], - lookup_mem_rng_chk_mid[row_idx], - lookup_mem_rng_chk_hi[row_idx], - lookup_pow_2_0[row_idx], - lookup_pow_2_1[row_idx], - lookup_u8_0[row_idx], - lookup_u8_1[row_idx], - lookup_u16_0[row_idx], - lookup_u16_1[row_idx], - lookup_u16_2[row_idx], - lookup_u16_3[row_idx], - lookup_u16_4[row_idx], - lookup_u16_5[row_idx], - lookup_u16_6[row_idx], - lookup_u16_7[row_idx], - lookup_u16_8[row_idx], - lookup_u16_9[row_idx], - lookup_u16_10[row_idx], - lookup_u16_11[row_idx], - lookup_u16_12[row_idx], - lookup_u16_13[row_idx], - lookup_u16_14[row_idx], - lookup_div_u16_0[row_idx], - lookup_div_u16_1[row_idx], - lookup_div_u16_2[row_idx], - lookup_div_u16_3[row_idx], - lookup_div_u16_4[row_idx], - lookup_div_u16_5[row_idx], - lookup_div_u16_6[row_idx], - lookup_div_u16_7[row_idx], - alu_a_hi_shift[row_idx], - alu_a_lo_shift[row_idx], - alu_b_hi_shift[row_idx], - alu_b_lo_shift[row_idx], - alu_cmp_rng_ctr_shift[row_idx], - alu_div_u16_r0_shift[row_idx], - alu_div_u16_r1_shift[row_idx], - alu_div_u16_r2_shift[row_idx], - alu_div_u16_r3_shift[row_idx], - alu_div_u16_r4_shift[row_idx], - alu_div_u16_r5_shift[row_idx], - alu_div_u16_r6_shift[row_idx], - alu_div_u16_r7_shift[row_idx], - alu_op_add_shift[row_idx], - alu_op_cast_prev_shift[row_idx], - alu_op_cast_shift[row_idx], - alu_op_div_shift[row_idx], - alu_op_mul_shift[row_idx], - alu_op_shl_shift[row_idx], - alu_op_shr_shift[row_idx], - alu_op_sub_shift[row_idx], - alu_p_sub_a_hi_shift[row_idx], - alu_p_sub_a_lo_shift[row_idx], - alu_p_sub_b_hi_shift[row_idx], - alu_p_sub_b_lo_shift[row_idx], - alu_sel_alu_shift[row_idx], - alu_sel_cmp_shift[row_idx], - alu_sel_div_rng_chk_shift[row_idx], - alu_sel_rng_chk_lookup_shift[row_idx], - alu_sel_rng_chk_shift[row_idx], - alu_u16_r0_shift[row_idx], - alu_u16_r1_shift[row_idx], - alu_u16_r2_shift[row_idx], - alu_u16_r3_shift[row_idx], - alu_u16_r4_shift[row_idx], - alu_u16_r5_shift[row_idx], - alu_u16_r6_shift[row_idx], - alu_u8_r0_shift[row_idx], - alu_u8_r1_shift[row_idx], - binary_acc_ia_shift[row_idx], - binary_acc_ib_shift[row_idx], - binary_acc_ic_shift[row_idx], - binary_mem_tag_ctr_shift[row_idx], - binary_op_id_shift[row_idx], - kernel_emit_l2_to_l1_msg_write_offset_shift[row_idx], - kernel_emit_note_hash_write_offset_shift[row_idx], - kernel_emit_nullifier_write_offset_shift[row_idx], - kernel_emit_unencrypted_log_write_offset_shift[row_idx], - kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], - kernel_note_hash_exist_write_offset_shift[row_idx], - kernel_nullifier_exists_write_offset_shift[row_idx], - kernel_nullifier_non_exists_write_offset_shift[row_idx], - kernel_side_effect_counter_shift[row_idx], - kernel_sload_write_offset_shift[row_idx], - kernel_sstore_write_offset_shift[row_idx], - main_da_gas_remaining_shift[row_idx], - main_internal_return_ptr_shift[row_idx], - main_l2_gas_remaining_shift[row_idx], - main_pc_shift[row_idx], - mem_glob_addr_shift[row_idx], - mem_rw_shift[row_idx], - mem_sel_mem_shift[row_idx], - mem_tag_shift[row_idx], - mem_tsp_shift[row_idx], - mem_val_shift[row_idx], - slice_addr_shift[row_idx], - slice_clk_shift[row_idx], - slice_cnt_shift[row_idx], - slice_col_offset_shift[row_idx], - slice_sel_cd_cpy_shift[row_idx], - slice_sel_mem_active_shift[row_idx], - slice_sel_return_shift[row_idx], - slice_sel_start_shift[row_idx], - slice_space_id_shift[row_idx] }); - } + [[nodiscard]] AllConstRefValues get_row(size_t row_idx) const; }; class PartiallyEvaluatedMultivariates : public AllEntities { public: PartiallyEvaluatedMultivariates() = default; - PartiallyEvaluatedMultivariates(const size_t circuit_size) - { - // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2) - for (auto& poly : get_all()) { - poly = Polynomial(circuit_size / 2); - } - } + PartiallyEvaluatedMultivariates(const size_t circuit_size); }; /** @@ -1356,420 +368,7 @@ class AvmFlavor { using Base = AllEntities; public: - CommitmentLabels() - { - Base::main_clk = "MAIN_CLK"; - Base::main_sel_first = "MAIN_SEL_FIRST"; - Base::kernel_kernel_inputs = "KERNEL_KERNEL_INPUTS"; - Base::kernel_kernel_value_out = "KERNEL_KERNEL_VALUE_OUT"; - Base::kernel_kernel_side_effect_out = "KERNEL_KERNEL_SIDE_EFFECT_OUT"; - Base::kernel_kernel_metadata_out = "KERNEL_KERNEL_METADATA_OUT"; - Base::main_calldata = "MAIN_CALLDATA"; - Base::main_returndata = "MAIN_RETURNDATA"; - Base::alu_a_hi = "ALU_A_HI"; - Base::alu_a_lo = "ALU_A_LO"; - Base::alu_b_hi = "ALU_B_HI"; - Base::alu_b_lo = "ALU_B_LO"; - Base::alu_borrow = "ALU_BORROW"; - Base::alu_cf = "ALU_CF"; - Base::alu_clk = "ALU_CLK"; - Base::alu_cmp_rng_ctr = "ALU_CMP_RNG_CTR"; - Base::alu_div_u16_r0 = "ALU_DIV_U16_R0"; - Base::alu_div_u16_r1 = "ALU_DIV_U16_R1"; - Base::alu_div_u16_r2 = "ALU_DIV_U16_R2"; - Base::alu_div_u16_r3 = "ALU_DIV_U16_R3"; - Base::alu_div_u16_r4 = "ALU_DIV_U16_R4"; - Base::alu_div_u16_r5 = "ALU_DIV_U16_R5"; - Base::alu_div_u16_r6 = "ALU_DIV_U16_R6"; - Base::alu_div_u16_r7 = "ALU_DIV_U16_R7"; - Base::alu_divisor_hi = "ALU_DIVISOR_HI"; - Base::alu_divisor_lo = "ALU_DIVISOR_LO"; - Base::alu_ff_tag = "ALU_FF_TAG"; - Base::alu_ia = "ALU_IA"; - Base::alu_ib = "ALU_IB"; - Base::alu_ic = "ALU_IC"; - Base::alu_in_tag = "ALU_IN_TAG"; - Base::alu_op_add = "ALU_OP_ADD"; - Base::alu_op_cast = "ALU_OP_CAST"; - Base::alu_op_cast_prev = "ALU_OP_CAST_PREV"; - Base::alu_op_div = "ALU_OP_DIV"; - Base::alu_op_div_a_lt_b = "ALU_OP_DIV_A_LT_B"; - Base::alu_op_div_std = "ALU_OP_DIV_STD"; - Base::alu_op_eq = "ALU_OP_EQ"; - Base::alu_op_eq_diff_inv = "ALU_OP_EQ_DIFF_INV"; - Base::alu_op_lt = "ALU_OP_LT"; - Base::alu_op_lte = "ALU_OP_LTE"; - Base::alu_op_mul = "ALU_OP_MUL"; - Base::alu_op_not = "ALU_OP_NOT"; - Base::alu_op_shl = "ALU_OP_SHL"; - Base::alu_op_shr = "ALU_OP_SHR"; - Base::alu_op_sub = "ALU_OP_SUB"; - Base::alu_p_a_borrow = "ALU_P_A_BORROW"; - Base::alu_p_b_borrow = "ALU_P_B_BORROW"; - Base::alu_p_sub_a_hi = "ALU_P_SUB_A_HI"; - Base::alu_p_sub_a_lo = "ALU_P_SUB_A_LO"; - Base::alu_p_sub_b_hi = "ALU_P_SUB_B_HI"; - Base::alu_p_sub_b_lo = "ALU_P_SUB_B_LO"; - Base::alu_partial_prod_hi = "ALU_PARTIAL_PROD_HI"; - Base::alu_partial_prod_lo = "ALU_PARTIAL_PROD_LO"; - Base::alu_quotient_hi = "ALU_QUOTIENT_HI"; - Base::alu_quotient_lo = "ALU_QUOTIENT_LO"; - Base::alu_remainder = "ALU_REMAINDER"; - Base::alu_res_hi = "ALU_RES_HI"; - Base::alu_res_lo = "ALU_RES_LO"; - Base::alu_sel_alu = "ALU_SEL_ALU"; - Base::alu_sel_cmp = "ALU_SEL_CMP"; - Base::alu_sel_div_rng_chk = "ALU_SEL_DIV_RNG_CHK"; - Base::alu_sel_rng_chk = "ALU_SEL_RNG_CHK"; - Base::alu_sel_rng_chk_lookup = "ALU_SEL_RNG_CHK_LOOKUP"; - Base::alu_sel_shift_which = "ALU_SEL_SHIFT_WHICH"; - Base::alu_shift_lt_bit_len = "ALU_SHIFT_LT_BIT_LEN"; - Base::alu_t_sub_s_bits = "ALU_T_SUB_S_BITS"; - Base::alu_two_pow_s = "ALU_TWO_POW_S"; - Base::alu_two_pow_t_sub_s = "ALU_TWO_POW_T_SUB_S"; - Base::alu_u128_tag = "ALU_U128_TAG"; - Base::alu_u16_r0 = "ALU_U16_R0"; - Base::alu_u16_r1 = "ALU_U16_R1"; - Base::alu_u16_r10 = "ALU_U16_R10"; - Base::alu_u16_r11 = "ALU_U16_R11"; - Base::alu_u16_r12 = "ALU_U16_R12"; - Base::alu_u16_r13 = "ALU_U16_R13"; - Base::alu_u16_r14 = "ALU_U16_R14"; - Base::alu_u16_r2 = "ALU_U16_R2"; - Base::alu_u16_r3 = "ALU_U16_R3"; - Base::alu_u16_r4 = "ALU_U16_R4"; - Base::alu_u16_r5 = "ALU_U16_R5"; - Base::alu_u16_r6 = "ALU_U16_R6"; - Base::alu_u16_r7 = "ALU_U16_R7"; - Base::alu_u16_r8 = "ALU_U16_R8"; - Base::alu_u16_r9 = "ALU_U16_R9"; - Base::alu_u16_tag = "ALU_U16_TAG"; - Base::alu_u32_tag = "ALU_U32_TAG"; - Base::alu_u64_tag = "ALU_U64_TAG"; - Base::alu_u8_r0 = "ALU_U8_R0"; - Base::alu_u8_r1 = "ALU_U8_R1"; - Base::alu_u8_tag = "ALU_U8_TAG"; - Base::binary_acc_ia = "BINARY_ACC_IA"; - Base::binary_acc_ib = "BINARY_ACC_IB"; - Base::binary_acc_ic = "BINARY_ACC_IC"; - Base::binary_clk = "BINARY_CLK"; - Base::binary_ia_bytes = "BINARY_IA_BYTES"; - Base::binary_ib_bytes = "BINARY_IB_BYTES"; - Base::binary_ic_bytes = "BINARY_IC_BYTES"; - Base::binary_in_tag = "BINARY_IN_TAG"; - Base::binary_mem_tag_ctr = "BINARY_MEM_TAG_CTR"; - Base::binary_mem_tag_ctr_inv = "BINARY_MEM_TAG_CTR_INV"; - Base::binary_op_id = "BINARY_OP_ID"; - Base::binary_sel_bin = "BINARY_SEL_BIN"; - Base::binary_start = "BINARY_START"; - Base::byte_lookup_sel_bin = "BYTE_LOOKUP_SEL_BIN"; - Base::byte_lookup_table_byte_lengths = "BYTE_LOOKUP_TABLE_BYTE_LENGTHS"; - Base::byte_lookup_table_in_tags = "BYTE_LOOKUP_TABLE_IN_TAGS"; - Base::byte_lookup_table_input_a = "BYTE_LOOKUP_TABLE_INPUT_A"; - Base::byte_lookup_table_input_b = "BYTE_LOOKUP_TABLE_INPUT_B"; - Base::byte_lookup_table_op_id = "BYTE_LOOKUP_TABLE_OP_ID"; - Base::byte_lookup_table_output = "BYTE_LOOKUP_TABLE_OUTPUT"; - Base::conversion_clk = "CONVERSION_CLK"; - Base::conversion_input = "CONVERSION_INPUT"; - Base::conversion_num_limbs = "CONVERSION_NUM_LIMBS"; - Base::conversion_radix = "CONVERSION_RADIX"; - Base::conversion_sel_to_radix_le = "CONVERSION_SEL_TO_RADIX_LE"; - Base::gas_da_gas_fixed_table = "GAS_DA_GAS_FIXED_TABLE"; - Base::gas_l2_gas_fixed_table = "GAS_L2_GAS_FIXED_TABLE"; - Base::gas_sel_gas_cost = "GAS_SEL_GAS_COST"; - Base::keccakf1600_clk = "KECCAKF1600_CLK"; - Base::keccakf1600_input = "KECCAKF1600_INPUT"; - Base::keccakf1600_output = "KECCAKF1600_OUTPUT"; - Base::keccakf1600_sel_keccakf1600 = "KECCAKF1600_SEL_KECCAKF1600"; - Base::kernel_emit_l2_to_l1_msg_write_offset = "KERNEL_EMIT_L2_TO_L1_MSG_WRITE_OFFSET"; - Base::kernel_emit_note_hash_write_offset = "KERNEL_EMIT_NOTE_HASH_WRITE_OFFSET"; - Base::kernel_emit_nullifier_write_offset = "KERNEL_EMIT_NULLIFIER_WRITE_OFFSET"; - Base::kernel_emit_unencrypted_log_write_offset = "KERNEL_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET"; - Base::kernel_kernel_in_offset = "KERNEL_KERNEL_IN_OFFSET"; - Base::kernel_kernel_out_offset = "KERNEL_KERNEL_OUT_OFFSET"; - Base::kernel_l1_to_l2_msg_exists_write_offset = "KERNEL_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET"; - Base::kernel_note_hash_exist_write_offset = "KERNEL_NOTE_HASH_EXIST_WRITE_OFFSET"; - Base::kernel_nullifier_exists_write_offset = "KERNEL_NULLIFIER_EXISTS_WRITE_OFFSET"; - Base::kernel_nullifier_non_exists_write_offset = "KERNEL_NULLIFIER_NON_EXISTS_WRITE_OFFSET"; - Base::kernel_q_public_input_kernel_add_to_table = "KERNEL_Q_PUBLIC_INPUT_KERNEL_ADD_TO_TABLE"; - Base::kernel_q_public_input_kernel_out_add_to_table = "KERNEL_Q_PUBLIC_INPUT_KERNEL_OUT_ADD_TO_TABLE"; - Base::kernel_side_effect_counter = "KERNEL_SIDE_EFFECT_COUNTER"; - Base::kernel_sload_write_offset = "KERNEL_SLOAD_WRITE_OFFSET"; - Base::kernel_sstore_write_offset = "KERNEL_SSTORE_WRITE_OFFSET"; - Base::main_abs_da_rem_gas_hi = "MAIN_ABS_DA_REM_GAS_HI"; - Base::main_abs_da_rem_gas_lo = "MAIN_ABS_DA_REM_GAS_LO"; - Base::main_abs_l2_rem_gas_hi = "MAIN_ABS_L2_REM_GAS_HI"; - Base::main_abs_l2_rem_gas_lo = "MAIN_ABS_L2_REM_GAS_LO"; - Base::main_alu_in_tag = "MAIN_ALU_IN_TAG"; - Base::main_bin_op_id = "MAIN_BIN_OP_ID"; - Base::main_call_ptr = "MAIN_CALL_PTR"; - Base::main_da_gas_op_cost = "MAIN_DA_GAS_OP_COST"; - Base::main_da_gas_remaining = "MAIN_DA_GAS_REMAINING"; - Base::main_da_out_of_gas = "MAIN_DA_OUT_OF_GAS"; - Base::main_ia = "MAIN_IA"; - Base::main_ib = "MAIN_IB"; - Base::main_ic = "MAIN_IC"; - Base::main_id = "MAIN_ID"; - Base::main_id_zero = "MAIN_ID_ZERO"; - Base::main_ind_addr_a = "MAIN_IND_ADDR_A"; - Base::main_ind_addr_b = "MAIN_IND_ADDR_B"; - Base::main_ind_addr_c = "MAIN_IND_ADDR_C"; - Base::main_ind_addr_d = "MAIN_IND_ADDR_D"; - Base::main_internal_return_ptr = "MAIN_INTERNAL_RETURN_PTR"; - Base::main_inv = "MAIN_INV"; - Base::main_l2_gas_op_cost = "MAIN_L2_GAS_OP_COST"; - Base::main_l2_gas_remaining = "MAIN_L2_GAS_REMAINING"; - Base::main_l2_out_of_gas = "MAIN_L2_OUT_OF_GAS"; - Base::main_mem_addr_a = "MAIN_MEM_ADDR_A"; - Base::main_mem_addr_b = "MAIN_MEM_ADDR_B"; - Base::main_mem_addr_c = "MAIN_MEM_ADDR_C"; - Base::main_mem_addr_d = "MAIN_MEM_ADDR_D"; - Base::main_op_err = "MAIN_OP_ERR"; - Base::main_opcode_val = "MAIN_OPCODE_VAL"; - Base::main_pc = "MAIN_PC"; - Base::main_r_in_tag = "MAIN_R_IN_TAG"; - Base::main_rwa = "MAIN_RWA"; - Base::main_rwb = "MAIN_RWB"; - Base::main_rwc = "MAIN_RWC"; - Base::main_rwd = "MAIN_RWD"; - Base::main_sel_alu = "MAIN_SEL_ALU"; - Base::main_sel_bin = "MAIN_SEL_BIN"; - Base::main_sel_calldata = "MAIN_SEL_CALLDATA"; - Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; - Base::main_sel_last = "MAIN_SEL_LAST"; - Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; - Base::main_sel_mem_op_activate_gas = "MAIN_SEL_MEM_OP_ACTIVATE_GAS"; - Base::main_sel_mem_op_b = "MAIN_SEL_MEM_OP_B"; - Base::main_sel_mem_op_c = "MAIN_SEL_MEM_OP_C"; - Base::main_sel_mem_op_d = "MAIN_SEL_MEM_OP_D"; - Base::main_sel_mov_ia_to_ic = "MAIN_SEL_MOV_IA_TO_IC"; - Base::main_sel_mov_ib_to_ic = "MAIN_SEL_MOV_IB_TO_IC"; - Base::main_sel_op_add = "MAIN_SEL_OP_ADD"; - Base::main_sel_op_address = "MAIN_SEL_OP_ADDRESS"; - Base::main_sel_op_and = "MAIN_SEL_OP_AND"; - Base::main_sel_op_block_number = "MAIN_SEL_OP_BLOCK_NUMBER"; - Base::main_sel_op_calldata_copy = "MAIN_SEL_OP_CALLDATA_COPY"; - Base::main_sel_op_cast = "MAIN_SEL_OP_CAST"; - Base::main_sel_op_chain_id = "MAIN_SEL_OP_CHAIN_ID"; - Base::main_sel_op_cmov = "MAIN_SEL_OP_CMOV"; - Base::main_sel_op_coinbase = "MAIN_SEL_OP_COINBASE"; - Base::main_sel_op_dagasleft = "MAIN_SEL_OP_DAGASLEFT"; - Base::main_sel_op_div = "MAIN_SEL_OP_DIV"; - Base::main_sel_op_emit_l2_to_l1_msg = "MAIN_SEL_OP_EMIT_L2_TO_L1_MSG"; - Base::main_sel_op_emit_note_hash = "MAIN_SEL_OP_EMIT_NOTE_HASH"; - Base::main_sel_op_emit_nullifier = "MAIN_SEL_OP_EMIT_NULLIFIER"; - Base::main_sel_op_emit_unencrypted_log = "MAIN_SEL_OP_EMIT_UNENCRYPTED_LOG"; - Base::main_sel_op_eq = "MAIN_SEL_OP_EQ"; - Base::main_sel_op_external_call = "MAIN_SEL_OP_EXTERNAL_CALL"; - Base::main_sel_op_external_return = "MAIN_SEL_OP_EXTERNAL_RETURN"; - Base::main_sel_op_fdiv = "MAIN_SEL_OP_FDIV"; - Base::main_sel_op_fee_per_da_gas = "MAIN_SEL_OP_FEE_PER_DA_GAS"; - Base::main_sel_op_fee_per_l2_gas = "MAIN_SEL_OP_FEE_PER_L2_GAS"; - Base::main_sel_op_function_selector = "MAIN_SEL_OP_FUNCTION_SELECTOR"; - Base::main_sel_op_get_contract_instance = "MAIN_SEL_OP_GET_CONTRACT_INSTANCE"; - Base::main_sel_op_halt = "MAIN_SEL_OP_HALT"; - Base::main_sel_op_internal_call = "MAIN_SEL_OP_INTERNAL_CALL"; - Base::main_sel_op_internal_return = "MAIN_SEL_OP_INTERNAL_RETURN"; - Base::main_sel_op_jump = "MAIN_SEL_OP_JUMP"; - Base::main_sel_op_jumpi = "MAIN_SEL_OP_JUMPI"; - Base::main_sel_op_keccak = "MAIN_SEL_OP_KECCAK"; - Base::main_sel_op_l1_to_l2_msg_exists = "MAIN_SEL_OP_L1_TO_L2_MSG_EXISTS"; - Base::main_sel_op_l2gasleft = "MAIN_SEL_OP_L2GASLEFT"; - Base::main_sel_op_lt = "MAIN_SEL_OP_LT"; - Base::main_sel_op_lte = "MAIN_SEL_OP_LTE"; - Base::main_sel_op_mov = "MAIN_SEL_OP_MOV"; - Base::main_sel_op_mul = "MAIN_SEL_OP_MUL"; - Base::main_sel_op_not = "MAIN_SEL_OP_NOT"; - Base::main_sel_op_note_hash_exists = "MAIN_SEL_OP_NOTE_HASH_EXISTS"; - Base::main_sel_op_nullifier_exists = "MAIN_SEL_OP_NULLIFIER_EXISTS"; - Base::main_sel_op_or = "MAIN_SEL_OP_OR"; - Base::main_sel_op_pedersen = "MAIN_SEL_OP_PEDERSEN"; - Base::main_sel_op_poseidon2 = "MAIN_SEL_OP_POSEIDON2"; - Base::main_sel_op_radix_le = "MAIN_SEL_OP_RADIX_LE"; - Base::main_sel_op_sender = "MAIN_SEL_OP_SENDER"; - Base::main_sel_op_sha256 = "MAIN_SEL_OP_SHA256"; - Base::main_sel_op_shl = "MAIN_SEL_OP_SHL"; - Base::main_sel_op_shr = "MAIN_SEL_OP_SHR"; - Base::main_sel_op_sload = "MAIN_SEL_OP_SLOAD"; - Base::main_sel_op_sstore = "MAIN_SEL_OP_SSTORE"; - Base::main_sel_op_storage_address = "MAIN_SEL_OP_STORAGE_ADDRESS"; - Base::main_sel_op_sub = "MAIN_SEL_OP_SUB"; - Base::main_sel_op_timestamp = "MAIN_SEL_OP_TIMESTAMP"; - Base::main_sel_op_transaction_fee = "MAIN_SEL_OP_TRANSACTION_FEE"; - Base::main_sel_op_version = "MAIN_SEL_OP_VERSION"; - Base::main_sel_op_xor = "MAIN_SEL_OP_XOR"; - Base::main_sel_q_kernel_lookup = "MAIN_SEL_Q_KERNEL_LOOKUP"; - Base::main_sel_q_kernel_output_lookup = "MAIN_SEL_Q_KERNEL_OUTPUT_LOOKUP"; - Base::main_sel_resolve_ind_addr_a = "MAIN_SEL_RESOLVE_IND_ADDR_A"; - Base::main_sel_resolve_ind_addr_b = "MAIN_SEL_RESOLVE_IND_ADDR_B"; - Base::main_sel_resolve_ind_addr_c = "MAIN_SEL_RESOLVE_IND_ADDR_C"; - Base::main_sel_resolve_ind_addr_d = "MAIN_SEL_RESOLVE_IND_ADDR_D"; - Base::main_sel_returndata = "MAIN_SEL_RETURNDATA"; - Base::main_sel_rng_16 = "MAIN_SEL_RNG_16"; - Base::main_sel_rng_8 = "MAIN_SEL_RNG_8"; - Base::main_sel_slice_gadget = "MAIN_SEL_SLICE_GADGET"; - Base::main_space_id = "MAIN_SPACE_ID"; - Base::main_tag_err = "MAIN_TAG_ERR"; - Base::main_w_in_tag = "MAIN_W_IN_TAG"; - Base::mem_addr = "MEM_ADDR"; - Base::mem_clk = "MEM_CLK"; - Base::mem_diff_hi = "MEM_DIFF_HI"; - Base::mem_diff_lo = "MEM_DIFF_LO"; - Base::mem_diff_mid = "MEM_DIFF_MID"; - Base::mem_glob_addr = "MEM_GLOB_ADDR"; - Base::mem_last = "MEM_LAST"; - Base::mem_lastAccess = "MEM_LAST_ACCESS"; - Base::mem_one_min_inv = "MEM_ONE_MIN_INV"; - Base::mem_r_in_tag = "MEM_R_IN_TAG"; - Base::mem_rw = "MEM_RW"; - Base::mem_sel_mem = "MEM_SEL_MEM"; - Base::mem_sel_mov_ia_to_ic = "MEM_SEL_MOV_IA_TO_IC"; - Base::mem_sel_mov_ib_to_ic = "MEM_SEL_MOV_IB_TO_IC"; - Base::mem_sel_op_a = "MEM_SEL_OP_A"; - Base::mem_sel_op_b = "MEM_SEL_OP_B"; - Base::mem_sel_op_c = "MEM_SEL_OP_C"; - Base::mem_sel_op_cmov = "MEM_SEL_OP_CMOV"; - Base::mem_sel_op_d = "MEM_SEL_OP_D"; - Base::mem_sel_op_slice = "MEM_SEL_OP_SLICE"; - Base::mem_sel_resolve_ind_addr_a = "MEM_SEL_RESOLVE_IND_ADDR_A"; - Base::mem_sel_resolve_ind_addr_b = "MEM_SEL_RESOLVE_IND_ADDR_B"; - Base::mem_sel_resolve_ind_addr_c = "MEM_SEL_RESOLVE_IND_ADDR_C"; - Base::mem_sel_resolve_ind_addr_d = "MEM_SEL_RESOLVE_IND_ADDR_D"; - Base::mem_sel_rng_chk = "MEM_SEL_RNG_CHK"; - Base::mem_skip_check_tag = "MEM_SKIP_CHECK_TAG"; - Base::mem_space_id = "MEM_SPACE_ID"; - Base::mem_tag = "MEM_TAG"; - Base::mem_tag_err = "MEM_TAG_ERR"; - Base::mem_tsp = "MEM_TSP"; - Base::mem_val = "MEM_VAL"; - Base::mem_w_in_tag = "MEM_W_IN_TAG"; - Base::pedersen_clk = "PEDERSEN_CLK"; - Base::pedersen_input = "PEDERSEN_INPUT"; - Base::pedersen_output = "PEDERSEN_OUTPUT"; - Base::pedersen_sel_pedersen = "PEDERSEN_SEL_PEDERSEN"; - Base::poseidon2_clk = "POSEIDON2_CLK"; - Base::poseidon2_input = "POSEIDON2_INPUT"; - Base::poseidon2_output = "POSEIDON2_OUTPUT"; - Base::poseidon2_sel_poseidon_perm = "POSEIDON2_SEL_POSEIDON_PERM"; - Base::powers_power_of_2 = "POWERS_POWER_OF_2"; - Base::sha256_clk = "SHA256_CLK"; - Base::sha256_input = "SHA256_INPUT"; - Base::sha256_output = "SHA256_OUTPUT"; - Base::sha256_sel_sha256_compression = "SHA256_SEL_SHA256_COMPRESSION"; - Base::sha256_state = "SHA256_STATE"; - Base::slice_addr = "SLICE_ADDR"; - Base::slice_clk = "SLICE_CLK"; - Base::slice_cnt = "SLICE_CNT"; - Base::slice_col_offset = "SLICE_COL_OFFSET"; - Base::slice_one_min_inv = "SLICE_ONE_MIN_INV"; - Base::slice_sel_cd_cpy = "SLICE_SEL_CD_CPY"; - Base::slice_sel_mem_active = "SLICE_SEL_MEM_ACTIVE"; - Base::slice_sel_return = "SLICE_SEL_RETURN"; - Base::slice_sel_start = "SLICE_SEL_START"; - Base::slice_space_id = "SLICE_SPACE_ID"; - Base::slice_val = "SLICE_VAL"; - Base::perm_slice_mem = "PERM_SLICE_MEM"; - Base::perm_main_alu = "PERM_MAIN_ALU"; - Base::perm_main_bin = "PERM_MAIN_BIN"; - Base::perm_main_conv = "PERM_MAIN_CONV"; - Base::perm_main_pos2_perm = "PERM_MAIN_POS2_PERM"; - Base::perm_main_pedersen = "PERM_MAIN_PEDERSEN"; - Base::perm_main_slice = "PERM_MAIN_SLICE"; - Base::perm_main_mem_a = "PERM_MAIN_MEM_A"; - Base::perm_main_mem_b = "PERM_MAIN_MEM_B"; - Base::perm_main_mem_c = "PERM_MAIN_MEM_C"; - Base::perm_main_mem_d = "PERM_MAIN_MEM_D"; - Base::perm_main_mem_ind_addr_a = "PERM_MAIN_MEM_IND_ADDR_A"; - Base::perm_main_mem_ind_addr_b = "PERM_MAIN_MEM_IND_ADDR_B"; - Base::perm_main_mem_ind_addr_c = "PERM_MAIN_MEM_IND_ADDR_C"; - Base::perm_main_mem_ind_addr_d = "PERM_MAIN_MEM_IND_ADDR_D"; - Base::lookup_byte_lengths = "LOOKUP_BYTE_LENGTHS"; - Base::lookup_byte_operations = "LOOKUP_BYTE_OPERATIONS"; - Base::lookup_cd_value = "LOOKUP_CD_VALUE"; - Base::lookup_ret_value = "LOOKUP_RET_VALUE"; - Base::lookup_opcode_gas = "LOOKUP_OPCODE_GAS"; - Base::range_check_l2_gas_hi = "RANGE_CHECK_L2_GAS_HI"; - Base::range_check_l2_gas_lo = "RANGE_CHECK_L2_GAS_LO"; - Base::range_check_da_gas_hi = "RANGE_CHECK_DA_GAS_HI"; - Base::range_check_da_gas_lo = "RANGE_CHECK_DA_GAS_LO"; - Base::kernel_output_lookup = "KERNEL_OUTPUT_LOOKUP"; - Base::lookup_into_kernel = "LOOKUP_INTO_KERNEL"; - Base::incl_main_tag_err = "INCL_MAIN_TAG_ERR"; - Base::incl_mem_tag_err = "INCL_MEM_TAG_ERR"; - Base::lookup_mem_rng_chk_lo = "LOOKUP_MEM_RNG_CHK_LO"; - Base::lookup_mem_rng_chk_mid = "LOOKUP_MEM_RNG_CHK_MID"; - Base::lookup_mem_rng_chk_hi = "LOOKUP_MEM_RNG_CHK_HI"; - Base::lookup_pow_2_0 = "LOOKUP_POW_2_0"; - Base::lookup_pow_2_1 = "LOOKUP_POW_2_1"; - Base::lookup_u8_0 = "LOOKUP_U8_0"; - Base::lookup_u8_1 = "LOOKUP_U8_1"; - Base::lookup_u16_0 = "LOOKUP_U16_0"; - Base::lookup_u16_1 = "LOOKUP_U16_1"; - Base::lookup_u16_2 = "LOOKUP_U16_2"; - Base::lookup_u16_3 = "LOOKUP_U16_3"; - Base::lookup_u16_4 = "LOOKUP_U16_4"; - Base::lookup_u16_5 = "LOOKUP_U16_5"; - Base::lookup_u16_6 = "LOOKUP_U16_6"; - Base::lookup_u16_7 = "LOOKUP_U16_7"; - Base::lookup_u16_8 = "LOOKUP_U16_8"; - Base::lookup_u16_9 = "LOOKUP_U16_9"; - Base::lookup_u16_10 = "LOOKUP_U16_10"; - Base::lookup_u16_11 = "LOOKUP_U16_11"; - Base::lookup_u16_12 = "LOOKUP_U16_12"; - Base::lookup_u16_13 = "LOOKUP_U16_13"; - Base::lookup_u16_14 = "LOOKUP_U16_14"; - Base::lookup_div_u16_0 = "LOOKUP_DIV_U16_0"; - Base::lookup_div_u16_1 = "LOOKUP_DIV_U16_1"; - Base::lookup_div_u16_2 = "LOOKUP_DIV_U16_2"; - Base::lookup_div_u16_3 = "LOOKUP_DIV_U16_3"; - Base::lookup_div_u16_4 = "LOOKUP_DIV_U16_4"; - Base::lookup_div_u16_5 = "LOOKUP_DIV_U16_5"; - Base::lookup_div_u16_6 = "LOOKUP_DIV_U16_6"; - Base::lookup_div_u16_7 = "LOOKUP_DIV_U16_7"; - Base::lookup_byte_lengths_counts = "LOOKUP_BYTE_LENGTHS_COUNTS"; - Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; - Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; - Base::lookup_ret_value_counts = "LOOKUP_RET_VALUE_COUNTS"; - Base::lookup_opcode_gas_counts = "LOOKUP_OPCODE_GAS_COUNTS"; - Base::range_check_l2_gas_hi_counts = "RANGE_CHECK_L2_GAS_HI_COUNTS"; - Base::range_check_l2_gas_lo_counts = "RANGE_CHECK_L2_GAS_LO_COUNTS"; - Base::range_check_da_gas_hi_counts = "RANGE_CHECK_DA_GAS_HI_COUNTS"; - Base::range_check_da_gas_lo_counts = "RANGE_CHECK_DA_GAS_LO_COUNTS"; - Base::kernel_output_lookup_counts = "KERNEL_OUTPUT_LOOKUP_COUNTS"; - Base::lookup_into_kernel_counts = "LOOKUP_INTO_KERNEL_COUNTS"; - Base::incl_main_tag_err_counts = "INCL_MAIN_TAG_ERR_COUNTS"; - Base::incl_mem_tag_err_counts = "INCL_MEM_TAG_ERR_COUNTS"; - Base::lookup_mem_rng_chk_lo_counts = "LOOKUP_MEM_RNG_CHK_LO_COUNTS"; - Base::lookup_mem_rng_chk_mid_counts = "LOOKUP_MEM_RNG_CHK_MID_COUNTS"; - Base::lookup_mem_rng_chk_hi_counts = "LOOKUP_MEM_RNG_CHK_HI_COUNTS"; - Base::lookup_pow_2_0_counts = "LOOKUP_POW_2_0_COUNTS"; - Base::lookup_pow_2_1_counts = "LOOKUP_POW_2_1_COUNTS"; - Base::lookup_u8_0_counts = "LOOKUP_U8_0_COUNTS"; - Base::lookup_u8_1_counts = "LOOKUP_U8_1_COUNTS"; - Base::lookup_u16_0_counts = "LOOKUP_U16_0_COUNTS"; - Base::lookup_u16_1_counts = "LOOKUP_U16_1_COUNTS"; - Base::lookup_u16_2_counts = "LOOKUP_U16_2_COUNTS"; - Base::lookup_u16_3_counts = "LOOKUP_U16_3_COUNTS"; - Base::lookup_u16_4_counts = "LOOKUP_U16_4_COUNTS"; - Base::lookup_u16_5_counts = "LOOKUP_U16_5_COUNTS"; - Base::lookup_u16_6_counts = "LOOKUP_U16_6_COUNTS"; - Base::lookup_u16_7_counts = "LOOKUP_U16_7_COUNTS"; - Base::lookup_u16_8_counts = "LOOKUP_U16_8_COUNTS"; - Base::lookup_u16_9_counts = "LOOKUP_U16_9_COUNTS"; - Base::lookup_u16_10_counts = "LOOKUP_U16_10_COUNTS"; - Base::lookup_u16_11_counts = "LOOKUP_U16_11_COUNTS"; - Base::lookup_u16_12_counts = "LOOKUP_U16_12_COUNTS"; - Base::lookup_u16_13_counts = "LOOKUP_U16_13_COUNTS"; - Base::lookup_u16_14_counts = "LOOKUP_U16_14_COUNTS"; - Base::lookup_div_u16_0_counts = "LOOKUP_DIV_U16_0_COUNTS"; - Base::lookup_div_u16_1_counts = "LOOKUP_DIV_U16_1_COUNTS"; - Base::lookup_div_u16_2_counts = "LOOKUP_DIV_U16_2_COUNTS"; - Base::lookup_div_u16_3_counts = "LOOKUP_DIV_U16_3_COUNTS"; - Base::lookup_div_u16_4_counts = "LOOKUP_DIV_U16_4_COUNTS"; - Base::lookup_div_u16_5_counts = "LOOKUP_DIV_U16_5_COUNTS"; - Base::lookup_div_u16_6_counts = "LOOKUP_DIV_U16_6_COUNTS"; - Base::lookup_div_u16_7_counts = "LOOKUP_DIV_U16_7_COUNTS"; - }; + CommitmentLabels(); }; class VerifierCommitments : public AllEntities { @@ -1777,11 +376,7 @@ class AvmFlavor { using Base = AllEntities; public: - VerifierCommitments(const std::shared_ptr& verification_key) - { - main_clk = verification_key->main_clk; - main_sel_first = verification_key->main_sel_first; - } + VerifierCommitments(const std::shared_ptr& verification_key); }; class Transcript : public NativeTranscript { @@ -1802,53 +397,8 @@ class AvmFlavor { : NativeTranscript(proof) {} - void deserialize_full_transcript() - { - size_t num_frs_read = 0; - circuit_size = deserialize_from_buffer(proof_data, num_frs_read); - size_t log_n = numeric::get_msb(circuit_size); - - for (auto& commitment : commitments) { - commitment = deserialize_from_buffer(proof_data, num_frs_read); - } - for (size_t i = 0; i < log_n; ++i) { - sumcheck_univariates.emplace_back( - deserialize_from_buffer>(Transcript::proof_data, - num_frs_read)); - } - sumcheck_evaluations = - deserialize_from_buffer>(Transcript::proof_data, num_frs_read); - for (size_t i = 0; i < log_n; ++i) { - zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_frs_read)); - } - zm_cq_comm = deserialize_from_buffer(proof_data, num_frs_read); - zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); - } - - void serialize_full_transcript() - { - size_t old_proof_length = proof_data.size(); - Transcript::proof_data.clear(); - size_t log_n = numeric::get_msb(circuit_size); - - serialize_to_buffer(circuit_size, Transcript::proof_data); - - for (const auto& commitment : commitments) { - serialize_to_buffer(commitment, Transcript::proof_data); - } - for (size_t i = 0; i < log_n; ++i) { - serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); - } - serialize_to_buffer(sumcheck_evaluations, Transcript::proof_data); - for (size_t i = 0; i < log_n; ++i) { - serialize_to_buffer(zm_cq_comms[i], proof_data); - } - serialize_to_buffer(zm_cq_comm, proof_data); - serialize_to_buffer(zm_pi_comm, proof_data); - - // sanity check to make sure we generate the same length of proof as before. - ASSERT(proof_data.size() == old_proof_length); - } + void deserialize_full_transcript(); + void serialize_full_transcript(); }; }; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp index d901afcc8b4..98b3085f4ff 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/kzg/kzg.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp index 5e62d6d07d6..77080e1da20 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/avm_full_row.hpp" #include "barretenberg/vm/generated/avm_flavor_settings.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp index ba078c93ba1..dbc72265711 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp index 9cc9cc81876..4a66e1c337a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/avm_prover.hpp" #include "barretenberg/commitment_schemes/claim.hpp" @@ -11,7 +12,7 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -#include "barretenberg/vm/avm_trace/stats.hpp" +#include "barretenberg/vm/stats.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp index 35d9f927cbb..0afc62a0987 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp index e31a545d167..023e00f61ad 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/avm_verifier.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" @@ -79,99 +80,9 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vectortemplate receive_from_prover(commitment_labels.perm_slice_mem); - commitments.perm_main_alu = transcript->template receive_from_prover(commitment_labels.perm_main_alu); - commitments.perm_main_bin = transcript->template receive_from_prover(commitment_labels.perm_main_bin); - commitments.perm_main_conv = transcript->template receive_from_prover(commitment_labels.perm_main_conv); - commitments.perm_main_pos2_perm = - transcript->template receive_from_prover(commitment_labels.perm_main_pos2_perm); - commitments.perm_main_pedersen = - transcript->template receive_from_prover(commitment_labels.perm_main_pedersen); - commitments.perm_main_slice = - transcript->template receive_from_prover(commitment_labels.perm_main_slice); - commitments.perm_main_mem_a = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_a); - commitments.perm_main_mem_b = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_b); - commitments.perm_main_mem_c = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_c); - commitments.perm_main_mem_d = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_d); - commitments.perm_main_mem_ind_addr_a = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_ind_addr_a); - commitments.perm_main_mem_ind_addr_b = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_ind_addr_b); - commitments.perm_main_mem_ind_addr_c = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_ind_addr_c); - commitments.perm_main_mem_ind_addr_d = - transcript->template receive_from_prover(commitment_labels.perm_main_mem_ind_addr_d); - commitments.lookup_byte_lengths = - transcript->template receive_from_prover(commitment_labels.lookup_byte_lengths); - commitments.lookup_byte_operations = - transcript->template receive_from_prover(commitment_labels.lookup_byte_operations); - commitments.lookup_cd_value = - transcript->template receive_from_prover(commitment_labels.lookup_cd_value); - commitments.lookup_ret_value = - transcript->template receive_from_prover(commitment_labels.lookup_ret_value); - commitments.lookup_opcode_gas = - transcript->template receive_from_prover(commitment_labels.lookup_opcode_gas); - commitments.range_check_l2_gas_hi = - transcript->template receive_from_prover(commitment_labels.range_check_l2_gas_hi); - commitments.range_check_l2_gas_lo = - transcript->template receive_from_prover(commitment_labels.range_check_l2_gas_lo); - commitments.range_check_da_gas_hi = - transcript->template receive_from_prover(commitment_labels.range_check_da_gas_hi); - commitments.range_check_da_gas_lo = - transcript->template receive_from_prover(commitment_labels.range_check_da_gas_lo); - commitments.kernel_output_lookup = - transcript->template receive_from_prover(commitment_labels.kernel_output_lookup); - commitments.lookup_into_kernel = - transcript->template receive_from_prover(commitment_labels.lookup_into_kernel); - commitments.incl_main_tag_err = - transcript->template receive_from_prover(commitment_labels.incl_main_tag_err); - commitments.incl_mem_tag_err = - transcript->template receive_from_prover(commitment_labels.incl_mem_tag_err); - commitments.lookup_mem_rng_chk_lo = - transcript->template receive_from_prover(commitment_labels.lookup_mem_rng_chk_lo); - commitments.lookup_mem_rng_chk_mid = - transcript->template receive_from_prover(commitment_labels.lookup_mem_rng_chk_mid); - commitments.lookup_mem_rng_chk_hi = - transcript->template receive_from_prover(commitment_labels.lookup_mem_rng_chk_hi); - commitments.lookup_pow_2_0 = transcript->template receive_from_prover(commitment_labels.lookup_pow_2_0); - commitments.lookup_pow_2_1 = transcript->template receive_from_prover(commitment_labels.lookup_pow_2_1); - commitments.lookup_u8_0 = transcript->template receive_from_prover(commitment_labels.lookup_u8_0); - commitments.lookup_u8_1 = transcript->template receive_from_prover(commitment_labels.lookup_u8_1); - commitments.lookup_u16_0 = transcript->template receive_from_prover(commitment_labels.lookup_u16_0); - commitments.lookup_u16_1 = transcript->template receive_from_prover(commitment_labels.lookup_u16_1); - commitments.lookup_u16_2 = transcript->template receive_from_prover(commitment_labels.lookup_u16_2); - commitments.lookup_u16_3 = transcript->template receive_from_prover(commitment_labels.lookup_u16_3); - commitments.lookup_u16_4 = transcript->template receive_from_prover(commitment_labels.lookup_u16_4); - commitments.lookup_u16_5 = transcript->template receive_from_prover(commitment_labels.lookup_u16_5); - commitments.lookup_u16_6 = transcript->template receive_from_prover(commitment_labels.lookup_u16_6); - commitments.lookup_u16_7 = transcript->template receive_from_prover(commitment_labels.lookup_u16_7); - commitments.lookup_u16_8 = transcript->template receive_from_prover(commitment_labels.lookup_u16_8); - commitments.lookup_u16_9 = transcript->template receive_from_prover(commitment_labels.lookup_u16_9); - commitments.lookup_u16_10 = transcript->template receive_from_prover(commitment_labels.lookup_u16_10); - commitments.lookup_u16_11 = transcript->template receive_from_prover(commitment_labels.lookup_u16_11); - commitments.lookup_u16_12 = transcript->template receive_from_prover(commitment_labels.lookup_u16_12); - commitments.lookup_u16_13 = transcript->template receive_from_prover(commitment_labels.lookup_u16_13); - commitments.lookup_u16_14 = transcript->template receive_from_prover(commitment_labels.lookup_u16_14); - commitments.lookup_div_u16_0 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_0); - commitments.lookup_div_u16_1 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_1); - commitments.lookup_div_u16_2 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_2); - commitments.lookup_div_u16_3 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_3); - commitments.lookup_div_u16_4 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_4); - commitments.lookup_div_u16_5 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_5); - commitments.lookup_div_u16_6 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_6); - commitments.lookup_div_u16_7 = - transcript->template receive_from_prover(commitment_labels.lookup_div_u16_7); + for (auto [label, commitment] : zip_view(commitment_labels.get_derived(), commitments.get_derived())) { + commitment = transcript->template receive_from_prover(label); + } // Execute Sumcheck Verifier const size_t log_circuit_size = numeric::get_msb(circuit_size); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp index fc7495d9abd..32b506075d3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/plonk/proof_system/types/proof.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/stats.cpp b/barretenberg/cpp/src/barretenberg/vm/stats.cpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/vm/avm_trace/stats.cpp rename to barretenberg/cpp/src/barretenberg/vm/stats.cpp index 1c337c76a8f..9d2c65ddbfe 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/stats.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/stats.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/vm/avm_trace/stats.hpp" +#include "barretenberg/vm/stats.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/stats.hpp b/barretenberg/cpp/src/barretenberg/vm/stats.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/vm/avm_trace/stats.hpp rename to barretenberg/cpp/src/barretenberg/vm/stats.hpp diff --git a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs index 2d42e542135..75d18e0e90c 100644 --- a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs @@ -13,6 +13,8 @@ pub trait CircuitBuilder { to_be_shifted: &[String], ); + fn create_circuit_builder_cpp(&mut self, name: &str, all_cols_without_inverses: &[String]); + fn create_full_row_hpp(&mut self, name: &str, all_cols: &[String]); fn create_full_row_cpp(&mut self, name: &str, all_cols: &[String]); } @@ -55,6 +57,31 @@ impl CircuitBuilder for BBFiles { ); } + fn create_circuit_builder_cpp(&mut self, name: &str, all_cols_without_inverses: &[String]) { + let mut handlebars = Handlebars::new(); + + let data = &json!({ + "name": name, + "all_cols_without_inverses": all_cols_without_inverses, + }); + + handlebars + .register_template_string( + "circuit_builder.cpp", + std::str::from_utf8(include_bytes!("../templates/circuit_builder.cpp.hbs")) + .unwrap(), + ) + .unwrap(); + + let circuit_cpp = handlebars.render("circuit_builder.cpp", data).unwrap(); + + self.write_file( + &self.circuit, + &format!("{}_circuit_builder.cpp", snake_case(name)), + &circuit_cpp, + ); + } + fn create_full_row_hpp(&mut self, name: &str, all_cols: &[String]) { let mut handlebars = Handlebars::new(); diff --git a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs index ff818ab19cb..8c97f9f5ce7 100644 --- a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs @@ -19,6 +19,20 @@ pub trait FlavorBuilder { all_cols_and_shifts: &[String], ); + fn create_flavor_cpp( + &mut self, + name: &str, + relation_file_names: &[String], + lookups: &[String], + fixed: &[String], + witness: &[String], + witness_without_inverses: &[String], + all_cols: &[String], + to_be_shifted: &[String], + shifted: &[String], + all_cols_and_shifts: &[String], + ); + fn create_flavor_settings_hpp(&mut self, name: &str); } @@ -73,6 +87,55 @@ impl FlavorBuilder for BBFiles { ); } + fn create_flavor_cpp( + &mut self, + name: &str, + relation_file_names: &[String], + lookups: &[String], + fixed: &[String], + witness: &[String], + witness_without_inverses: &[String], + all_cols: &[String], + to_be_shifted: &[String], + shifted: &[String], + all_cols_and_shifts: &[String], + ) { + let mut handlebars = Handlebars::new(); + + let data = &json!({ + "name": name, + "relation_file_names": relation_file_names, + "lookups": lookups, + "fixed": fixed, + "witness": witness, + "all_cols": all_cols, + "to_be_shifted": to_be_shifted, + "shifted": shifted, + "all_cols_and_shifts": all_cols_and_shifts, + "witness_without_inverses": witness_without_inverses, + }); + + handlebars_helper!(join: |*args| + args.iter().map(|v| v.as_array().unwrap().to_owned()).collect_vec().concat() + ); + handlebars.register_helper("join", Box::new(join)); + + handlebars + .register_template_string( + "flavor.cpp", + std::str::from_utf8(include_bytes!("../templates/flavor.cpp.hbs")).unwrap(), + ) + .unwrap(); + + let flavor_cpp = handlebars.render("flavor.cpp", data).unwrap(); + + self.write_file( + &self.flavor, + &format!("{}_flavor.cpp", snake_case(name)), + &flavor_cpp, + ); + } + fn create_flavor_settings_hpp(&mut self, name: &str) { let mut handlebars = Handlebars::new(); diff --git a/bb-pilcom/bb-pil-backend/src/vm_builder.rs b/bb-pilcom/bb-pil-backend/src/vm_builder.rs index 63696cba570..ebc4e9687f4 100644 --- a/bb-pilcom/bb-pil-backend/src/vm_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/vm_builder.rs @@ -118,7 +118,7 @@ pub fn analyzed_to_cpp( bb_files.create_full_row_hpp(file_name, &all_cols); bb_files.create_full_row_cpp(file_name, &all_cols); - // ----------------------- Create the circuit builder file ----------------------- + // ----------------------- Create the circuit builder files ----------------------- bb_files.create_circuit_builder_hpp( file_name, &relations, @@ -127,8 +127,9 @@ pub fn analyzed_to_cpp( &all_cols, &to_be_shifted, ); + bb_files.create_circuit_builder_cpp(file_name, &all_cols_without_inverses); - // ----------------------- Create the flavor file ----------------------- + // ----------------------- Create the flavor files ----------------------- bb_files.create_flavor_hpp( file_name, &relations, @@ -142,6 +143,19 @@ pub fn analyzed_to_cpp( &all_cols_with_shifts, ); + bb_files.create_flavor_cpp( + file_name, + &relations, + &inverses, + &fixed, + &witness, + &witnesses_without_inverses, + &all_cols, + &to_be_shifted, + &shifted, + &all_cols_with_shifts, + ); + bb_files.create_flavor_settings_hpp(file_name); // ----------------------- Create the composer files ----------------------- diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs new file mode 100644 index 00000000000..7c17d820fb5 --- /dev/null +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs @@ -0,0 +1,122 @@ +// AUTOGENERATED FILE +#include "barretenberg/vm/generated/{{snakeCase name}}_circuit_builder.hpp" + +#include + +#include "barretenberg/common/constexpr_utils.hpp" +#include "barretenberg/common/thread.hpp" +#include "barretenberg/common/throw_or_abort.hpp" +#include "barretenberg/ecc/curves/bn254/fr.hpp" +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" +#include "barretenberg/honk/proof_system/logderivative_library.hpp" + +namespace bb { + +{{name}}CircuitBuilder::ProverPolynomials {{name}}CircuitBuilder::compute_polynomials() const { + const auto num_rows = get_circuit_subgroup_size(); + ProverPolynomials polys; + + // Allocate mem for each column + for (auto& poly : polys.get_all()) { + poly = Polynomial(num_rows); + } + + for (size_t i = 0; i < rows.size(); i++) { + {{#each all_cols_without_inverses as |poly|}} + polys.{{poly}}[i] = rows[i].{{poly}}; + {{/each}} + } + + for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) { + shifted = to_be_shifted.shifted(); + } + + return polys; +} + +bool {{name}}CircuitBuilder::check_circuit() const { + const FF gamma = FF::random_element(); + const FF beta = FF::random_element(); + bb::RelationParameters params{ + .eta = 0, + .beta = beta, + .gamma = gamma, + .public_input_delta = 0, + .lookup_grand_product_delta = 0, + .beta_sqr = 0, + .beta_cube = 0, + .eccvm_set_permutation_delta = 0, + }; + + auto polys = compute_polynomials(); + const size_t num_rows = polys.get_polynomial_size(); + + // Checks that we will run. + using SignalErrorFn = const std::function&; + std::vector> checks; + + // Add relation checks. + bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::MainRelations>, 1>([&]() { + using Relation = std::tuple_element_t; + checks.push_back([&](SignalErrorFn signal_error) { + typename Relation::SumcheckArrayOfValuesOverSubrelations result; + for (auto& r : result) { + r = 0; + } + constexpr size_t NUM_SUBRELATIONS = result.size(); + + for (size_t r = 0; r < num_rows; ++r) { + Relation::accumulate(result, polys.get_row(r), {}, 1); + for (size_t j = 0; j < NUM_SUBRELATIONS; ++j) { + if (result[j] != 0) { + signal_error(format("Relation ", + Relation::NAME, + ", subrelation ", + Relation::get_subrelation_label(j), + " failed at row ", + r)); + } + } + } + }); + }); + + // Add calculation of logderivatives and lookup/permutation checks. + bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::LookupRelations>, 1>([&]() { + using Relation = std::tuple_element_t; + checks.push_back([&, num_rows](SignalErrorFn signal_error) { + // Check the logderivative relation + bb::compute_logderivative_inverse(polys, params, num_rows); + + typename Relation::SumcheckArrayOfValuesOverSubrelations lookup_result; + + for (auto& r : lookup_result) { + r = 0; + } + for (size_t r = 0; r < num_rows; ++r) { + Relation::accumulate(lookup_result, polys.get_row(r), params, 1); + } + for (auto r : lookup_result) { + if (r != 0) { + signal_error(format("Lookup ", Relation::NAME, " failed.")); + } + } + }); + }); + + std::string errors; + std::mutex m; + auto signal_error = [&](const std::string& error) { + std::lock_guard lock(m); + errors += error + "\n"; + }; + bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); }); + if (!errors.empty()) { + throw_or_abort(errors); + } + + return errors.empty(); +} + +} // namespace bb \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs index e4d2f08534f..ee9593d9879 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs @@ -1,17 +1,9 @@ // AUTOGENERATED FILE #pragma once -#include #include -#include "barretenberg/common/constexpr_utils.hpp" -#include "barretenberg/common/thread.hpp" -#include "barretenberg/common/throw_or_abort.hpp" -#include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" -#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" -#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" -#include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "barretenberg/vm/generated/{{snakeCase name}}_full_row.hpp" #include "barretenberg/vm/generated/{{snakeCase name}}_flavor.hpp" @@ -34,117 +26,13 @@ class {{name}}CircuitBuilder { void set_trace(std::vector&& trace) { rows = std::move(trace); } - ProverPolynomials compute_polynomials() { - const auto num_rows = get_circuit_subgroup_size(); - ProverPolynomials polys; + ProverPolynomials compute_polynomials() const; - // Allocate mem for each column - for (auto& poly : polys.get_all()) { - poly = Polynomial(num_rows); - } - - for (size_t i = 0; i < rows.size(); i++) { - {{#each all_cols_without_inverses as |poly|}} - polys.{{poly}}[i] = rows[i].{{poly}}; - {{/each}} - } - - for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) { - shifted = to_be_shifted.shifted(); - } - - return polys; - } - - [[maybe_unused]] bool check_circuit() - { - const FF gamma = FF::random_element(); - const FF beta = FF::random_element(); - bb::RelationParameters params{ - .eta = 0, - .beta = beta, - .gamma = gamma, - .public_input_delta = 0, - .lookup_grand_product_delta = 0, - .beta_sqr = 0, - .beta_cube = 0, - .eccvm_set_permutation_delta = 0, - }; - - auto polys = compute_polynomials(); - const size_t num_rows = polys.get_polynomial_size(); - - // Checks that we will run. - using SignalErrorFn = const std::function&; - std::vector> checks; - - // Add relation checks. - bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::MainRelations>, 1>([&]() { - using Relation = std::tuple_element_t; - checks.push_back([&](SignalErrorFn signal_error) { - typename Relation::SumcheckArrayOfValuesOverSubrelations result; - for (auto& r : result) { - r = 0; - } - constexpr size_t NUM_SUBRELATIONS = result.size(); - - for (size_t r = 0; r < num_rows; ++r) { - Relation::accumulate(result, polys.get_row(r), {}, 1); - for (size_t j = 0; j < NUM_SUBRELATIONS; ++j) { - if (result[j] != 0) { - signal_error(format("Relation ", - Relation::NAME, - ", subrelation ", - Relation::get_subrelation_label(j), - " failed at row ", - r)); - } - } - } - }); - }); - - // Add calculation of logderivatives and lookup/permutation checks. - bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::LookupRelations>, 1>([&]() { - using Relation = std::tuple_element_t; - checks.push_back([&, num_rows](SignalErrorFn signal_error) { - // Check the logderivative relation - bb::compute_logderivative_inverse(polys, params, num_rows); - - typename Relation::SumcheckArrayOfValuesOverSubrelations lookup_result; - - for (auto& r : lookup_result) { - r = 0; - } - for (size_t r = 0; r < num_rows; ++r) { - Relation::accumulate(lookup_result, polys.get_row(r), params, 1); - } - for (auto r : lookup_result) { - if (r != 0) { - signal_error(format("Lookup ", Relation::NAME, " failed.")); - } - } - }); - }); - - std::string errors; - auto signal_error = [&](const std::string& error) { - // Thread safety first! - static std::mutex m; - std::lock_guard lock(m); - errors += error + "\n"; - }; - bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); }); - if (!errors.empty()) { - throw_or_abort(errors); - } - - return errors.empty(); - } + bool check_circuit() const; - [[nodiscard]] size_t get_num_gates() const { return rows.size(); } + size_t get_num_gates() const { return rows.size(); } - [[nodiscard]] size_t get_circuit_subgroup_size() const + size_t get_circuit_subgroup_size() const { const size_t num_rows = get_num_gates(); const auto num_rows_log2 = static_cast(numeric::get_msb64(num_rows)); diff --git a/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs index ddb2743c125..c46c6f14f0d 100644 --- a/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/{{snakeCase name}}_composer.hpp" #include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs index fdbca47244e..4ef93ca2e21 100644 --- a/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs new file mode 100644 index 00000000000..90db25415d4 --- /dev/null +++ b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs @@ -0,0 +1,112 @@ +// AUTOGENERATED FILE +#include "barretenberg/vm/generated/{{snakeCase name}}_flavor.hpp" + +namespace bb { + +{{name}}Flavor::AllConstRefValues::AllConstRefValues(const RefArray& il) : + {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} + {{item}}(il[{{@index}}]){{#unless @last}},{{/unless}} + {{/each}} + {} + +{{name}}Flavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) +{ + for (auto [prover_poly, key_poly] : zip_view(this->get_unshifted(), proving_key.get_all())) { + ASSERT(flavor_get_label(*this, prover_poly) == flavor_get_label(proving_key, key_poly)); + prover_poly = key_poly.share(); + } + for (auto [prover_poly, key_poly] : zip_view(this->get_shifted(), proving_key.get_to_be_shifted())) { + ASSERT(flavor_get_label(*this, prover_poly) == (flavor_get_label(proving_key, key_poly) + "_shift")); + prover_poly = key_poly.shifted(); + } +} + +{{name}}Flavor::AllConstRefValues {{name}}Flavor::ProverPolynomials::get_row(size_t row_idx) const +{ + {{!-- + // TODO: try to make something like this work. + // Right now it's too risky because it relies on the order of the columns in `get_all()`. + RefArray all_cols = get_all(); + std::array refs; + for (size_t i = 0; i < refs.size(); ++i) { + refs[i] = &all_cols[i][row_idx]; + } + // Note: the order of the constructor must match the order of the columns in `get_all()`! + return AllConstRefValues(refs); + --}} + return AllConstRefValues(RefArray{ + {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} + {{item}}[row_idx]{{#unless @last}},{{/unless}} + {{/each}} + }); +} + +{{name}}Flavor::CommitmentLabels::CommitmentLabels() +{ + {{#each all_cols as |item|}} + Base::{{item}} = "{{shoutySnakeCase item}}"; + {{/each}} +}; + +{{name}}Flavor::VerifierCommitments::VerifierCommitments(const std::shared_ptr& verification_key) +{ + {{#each fixed as |item|}} + {{item}} = verification_key->{{item}}; + {{/each}} +} + +void {{name}}Flavor::Transcript::deserialize_full_transcript() { + size_t num_frs_read = 0; + circuit_size = deserialize_from_buffer(proof_data, num_frs_read); + size_t log_n = numeric::get_msb(circuit_size); + + for (auto& commitment : commitments) { + commitment = deserialize_from_buffer(proof_data, num_frs_read); + } + for (size_t i = 0; i < log_n; ++i) { + sumcheck_univariates.emplace_back( + deserialize_from_buffer>( + Transcript::proof_data, num_frs_read)); + } + sumcheck_evaluations = deserialize_from_buffer>( + Transcript::proof_data, num_frs_read); + for (size_t i = 0; i < log_n; ++i) { + zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_frs_read)); + } + zm_cq_comm = deserialize_from_buffer(proof_data, num_frs_read); + zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); +} + +void {{name}}Flavor::Transcript::serialize_full_transcript() { + size_t old_proof_length = proof_data.size(); + Transcript::proof_data.clear(); + size_t log_n = numeric::get_msb(circuit_size); + + serialize_to_buffer(circuit_size, Transcript::proof_data); + + for (const auto& commitment : commitments) { + serialize_to_buffer(commitment, Transcript::proof_data); + } + for (size_t i = 0; i < log_n; ++i) { + serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); + } + serialize_to_buffer(sumcheck_evaluations, Transcript::proof_data); + for (size_t i = 0; i < log_n; ++i) { + serialize_to_buffer(zm_cq_comms[i], proof_data); + } + serialize_to_buffer(zm_cq_comm, proof_data); + serialize_to_buffer(zm_pi_comm, proof_data); + + // sanity check to make sure we generate the same length of proof as before. + ASSERT(proof_data.size() == old_proof_length); +} + +{{name}}Flavor::PartiallyEvaluatedMultivariates::PartiallyEvaluatedMultivariates(const size_t circuit_size) +{ + // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2) + for (auto& poly : get_all()) { + poly = Polynomial(circuit_size / 2); + } +} + +} // namespace bb \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index c6d3c9c7c12..cccbda0a1ac 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/kzg/kzg.hpp" @@ -150,7 +151,7 @@ class {{name}}Flavor { }; public: - class ProvingKey : public ProvingKey{{name}}_, WitnessEntities, CommitmentKey> { + class ProvingKey : public ProvingKeyAvm_, WitnessEntities, CommitmentKey> { public: // Expose constructors on the base class using Base = ProvingKey{{name}}_, WitnessEntities, CommitmentKey>; @@ -182,11 +183,7 @@ class {{name}}Flavor { --}} DEFINE_FLAVOR_MEMBERS(DataType, ALL_ENTITIES) - AllConstRefValues(const RefArray& il) : - {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} - {{item}}(il[{{@index}}]){{#unless @last}},{{/unless}} - {{/each}} - {} + AllConstRefValues(const RefArray& il); }; /** @@ -202,54 +199,20 @@ class {{name}}Flavor { ProverPolynomials& operator=(ProverPolynomials&& o) noexcept = default; ~ProverPolynomials() = default; - ProverPolynomials(ProvingKey& proving_key) - { - for (auto [prover_poly, key_poly] : zip_view(this->get_unshifted(), proving_key.get_all())) { - ASSERT(flavor_get_label(*this, prover_poly) == flavor_get_label(proving_key, key_poly)); - prover_poly = key_poly.share(); - } - for (auto [prover_poly, key_poly] : zip_view(this->get_shifted(), proving_key.get_to_be_shifted())) { - ASSERT(flavor_get_label(*this, prover_poly) == (flavor_get_label(proving_key, key_poly) + "_shift")); - prover_poly = key_poly.shifted(); - } - } + ProverPolynomials(ProvingKey& proving_key); [[nodiscard]] size_t get_polynomial_size() const { return {{witness.0}}.size(); } /** * @brief Returns the evaluations of all prover polynomials at one point on the boolean hypercube, which * represents one row in the execution trace. */ - [[nodiscard]] AllConstRefValues get_row(size_t row_idx) const - { - {{!-- - // TODO: try to make something like this work. - // Right now it's too risky because it relies on the order of the columns in `get_all()`. - RefArray all_cols = get_all(); - std::array refs; - for (size_t i = 0; i < refs.size(); ++i) { - refs[i] = &all_cols[i][row_idx]; - } - // Note: the order of the constructor must match the order of the columns in `get_all()`! - return AllConstRefValues(refs); - --}} - return AllConstRefValues(RefArray{ - {{#each (join fixed witness_without_inverses lookups shifted) as |item|}} - {{item}}[row_idx]{{#unless @last}},{{/unless}} - {{/each}} - }); - } + [[nodiscard]] AllConstRefValues get_row(size_t row_idx) const; }; class PartiallyEvaluatedMultivariates : public AllEntities { public: PartiallyEvaluatedMultivariates() = default; - PartiallyEvaluatedMultivariates(const size_t circuit_size) - { - // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2) - for (auto& poly : get_all()) { - poly = Polynomial(circuit_size / 2); - } - } + PartiallyEvaluatedMultivariates(const size_t circuit_size); }; /** @@ -283,12 +246,7 @@ class {{name}}Flavor { using Base = AllEntities; public: - CommitmentLabels() - { - {{#each all_cols as |item|}} - Base::{{item}} = "{{shoutySnakeCase item}}"; - {{/each}} - }; + CommitmentLabels(); }; class VerifierCommitments : public AllEntities { @@ -296,12 +254,7 @@ class {{name}}Flavor { using Base = AllEntities; public: - VerifierCommitments(const std::shared_ptr& verification_key) - { - {{#each fixed as |item|}} - {{item}} = verification_key->{{item}}; - {{/each}} - } + VerifierCommitments(const std::shared_ptr& verification_key); }; class Transcript : public NativeTranscript { @@ -322,53 +275,8 @@ class {{name}}Flavor { : NativeTranscript(proof) {} - void deserialize_full_transcript() - { - size_t num_frs_read = 0; - circuit_size = deserialize_from_buffer(proof_data, num_frs_read); - size_t log_n = numeric::get_msb(circuit_size); - - for (auto& commitment : commitments) { - commitment = deserialize_from_buffer(proof_data, num_frs_read); - } - for (size_t i = 0; i < log_n; ++i) { - sumcheck_univariates.emplace_back( - deserialize_from_buffer>( - Transcript::proof_data, num_frs_read)); - } - sumcheck_evaluations = deserialize_from_buffer>( - Transcript::proof_data, num_frs_read); - for (size_t i = 0; i < log_n; ++i) { - zm_cq_comms.push_back(deserialize_from_buffer(proof_data, num_frs_read)); - } - zm_cq_comm = deserialize_from_buffer(proof_data, num_frs_read); - zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); - } - - void serialize_full_transcript() - { - size_t old_proof_length = proof_data.size(); - Transcript::proof_data.clear(); - size_t log_n = numeric::get_msb(circuit_size); - - serialize_to_buffer(circuit_size, Transcript::proof_data); - - for (const auto& commitment : commitments) { - serialize_to_buffer(commitment, Transcript::proof_data); - } - for (size_t i = 0; i < log_n; ++i) { - serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); - } - serialize_to_buffer(sumcheck_evaluations, Transcript::proof_data); - for (size_t i = 0; i < log_n; ++i) { - serialize_to_buffer(zm_cq_comms[i], proof_data); - } - serialize_to_buffer(zm_cq_comm, proof_data); - serialize_to_buffer(zm_pi_comm, proof_data); - - // sanity check to make sure we generate the same length of proof as before. - ASSERT(proof_data.size() == old_proof_length); - } + void deserialize_full_transcript(); + void serialize_full_transcript(); }; }; diff --git a/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs index b8d48acc71e..93039d496a5 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/kzg/kzg.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs index 978e8f1b613..a748e9f8c3c 100644 --- a/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/{{snakeCase name}}_full_row.hpp" #include "barretenberg/vm/generated/{{snakeCase name}}_flavor_settings.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs index a9e7f6d3174..fe79a16f252 100644 --- a/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include diff --git a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs index a63eb410e60..d5edfc93bcf 100644 --- a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs index a854f55a524..ef5522ad6c3 100644 --- a/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs index 42eb158c95a..eccfec4a515 100644 --- a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/{{snakeCase name}}_prover.hpp" #include "barretenberg/commitment_schemes/claim.hpp" @@ -11,7 +12,7 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -#include "barretenberg/vm/{{snakeCase name}}_trace/stats.hpp" +#include "barretenberg/vm/stats.hpp" namespace bb { diff --git a/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs index 1ea0f418681..5b3853cce9c 100644 --- a/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs index 4b80b824cf6..b6a7ed2c58c 100644 --- a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/relations/relation_parameters.hpp" diff --git a/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs index b87d27aa177..f52178d063a 100644 --- a/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #include "barretenberg/vm/generated/{{snakeCase name}}_verifier.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" @@ -79,9 +80,9 @@ bool {{name}}Verifier::verify_proof(const HonkProof& proof, const std::vectortemplate receive_from_prover(commitment_labels.{{inv}}); - {{/each}} + for (auto [label, commitment] : zip_view(commitment_labels.get_derived(), commitments.get_derived())) { + commitment = transcript->template receive_from_prover(label); + } // Execute Sumcheck Verifier const size_t log_circuit_size = numeric::get_msb(circuit_size); diff --git a/bb-pilcom/bb-pil-backend/templates/verifier.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/verifier.hpp.hbs index 11e150b6f02..fc9acfc1ce1 100644 --- a/bb-pilcom/bb-pil-backend/templates/verifier.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/verifier.hpp.hbs @@ -1,3 +1,4 @@ +// AUTOGENERATED FILE #pragma once #include "barretenberg/plonk/proof_system/types/proof.hpp"