From 59ca28391a41ba74d7cf8241c9715410b953e8ae Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 30 Aug 2024 09:41:12 +0000 Subject: [PATCH 1/7] 8285: typo in README --- barretenberg/cpp/src/barretenberg/dsl/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/README.md b/barretenberg/cpp/src/barretenberg/dsl/README.md index 9a76586bde5..45d09a1df60 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/README.md +++ b/barretenberg/cpp/src/barretenberg/dsl/README.md @@ -4,7 +4,7 @@ This package adds support to use [ACIR](https://github.com/noir-lang/noir/tree/m ## Serialization Changes -There are two types of breaking serialization changes. One that alters that alters the internal ACIR structure passed to barretenberg, and one that changes how we serialize the buffer passed to barretenberg. +There are two types of breaking serialization changes. One that alters the internal ACIR structure passed to barretenberg, and one that changes how we serialize the buffer passed to barretenberg. 1. Internal Structure Change From 3d6352d3c8d9a9973f7333b44e15d84e63cdf14f Mon Sep 17 00:00:00 2001 From: jeanmon Date: Mon, 2 Sep 2024 09:09:33 +0000 Subject: [PATCH 2/7] 8285: takes an aggregation object as parameter of AVM recursive verification --- .../ultra_recursive_verifier.cpp | 6 ++--- .../ultra_recursive_verifier.hpp | 5 ++-- .../avm/recursion/avm_recursive_verifier.cpp | 24 ++++++++++++++----- .../avm/recursion/avm_recursive_verifier.hpp | 7 +++--- .../recursion/avm_recursive_verifier.test.cpp | 11 +++++---- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.cpp index 08113c94c83..a728f3e3f7e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.cpp @@ -25,7 +25,7 @@ UltraRecursiveVerifier_::UltraRecursiveVerifier_(Builder* builder, const */ template UltraRecursiveVerifier_::AggregationObject UltraRecursiveVerifier_::verify_proof( - const HonkProof& proof, aggregation_state agg_obj) + const HonkProof& proof, AggregationObject agg_obj) { StdlibProof stdlib_proof = bb::convert_proof_to_witness(builder, proof); return verify_proof(stdlib_proof, agg_obj); @@ -37,7 +37,7 @@ UltraRecursiveVerifier_::AggregationObject UltraRecursiveVerifier_ UltraRecursiveVerifier_::AggregationObject UltraRecursiveVerifier_::verify_proof( - const StdlibProof& proof, aggregation_state agg_obj) + const StdlibProof& proof, AggregationObject agg_obj) { using Sumcheck = ::bb::SumcheckVerifier; using PCS = typename Flavor::PCS; @@ -59,7 +59,7 @@ UltraRecursiveVerifier_::AggregationObject UltraRecursiveVerifier_recursive_proof_public_inputs_indices - aggregation_state nested_agg_obj; + AggregationObject nested_agg_obj; size_t idx = 0; std::array nested_pairing_points; for (size_t i = 0; i < 2; i++) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp index f231b6c765c..40a2dbe7e91 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp @@ -27,9 +27,8 @@ template class UltraRecursiveVerifier_ { const std::shared_ptr& native_verifier_key); explicit UltraRecursiveVerifier_(Builder* builder, const std::shared_ptr& vkey); - AggregationObject verify_proof(const HonkProof& proof, aggregation_state agg_obj); - AggregationObject verify_proof(const StdlibProof& proof, - aggregation_state agg_obj); + AggregationObject verify_proof(const HonkProof& proof, AggregationObject agg_obj); + AggregationObject verify_proof(const StdlibProof& proof, AggregationObject agg_obj); std::shared_ptr key; std::shared_ptr pcs_verification_key; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.cpp index bd5129a50d5..9148e568668 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.cpp @@ -1,5 +1,6 @@ #include "barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" +#include "barretenberg/plonk_honk_shared/types/aggregation_object_type.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { @@ -17,9 +18,18 @@ AvmRecursiveVerifier_::AvmRecursiveVerifier_(Builder* builder, const std , builder(builder) {} +template +AvmRecursiveVerifier_::AggregationObject AvmRecursiveVerifier_::verify_proof(const HonkProof& proof, + AggregationObject agg_obj) +{ + StdlibProof stdlib_proof = bb::convert_proof_to_witness(builder, proof); + return verify_proof(stdlib_proof, agg_obj); +} + // TODO(#991): (see https://github.com/AztecProtocol/barretenberg/issues/991) template -std::array AvmRecursiveVerifier_::verify_proof(const HonkProof& proof) +AvmRecursiveVerifier_::AggregationObject AvmRecursiveVerifier_::verify_proof( + const StdlibProof& stdlib_proof, AggregationObject agg_obj) { using Curve = typename Flavor::Curve; using Zeromorph = ZeroMorphVerifier_; @@ -29,7 +39,6 @@ std::array AvmRecursiveVerifier_::veri using RelationParams = ::bb::RelationParameters; using Transcript = typename Flavor::Transcript; - StdlibProof stdlib_proof = bb::convert_proof_to_witness(builder, proof); transcript = std::make_shared(stdlib_proof); RelationParams relation_parameters; @@ -84,10 +93,13 @@ std::array AvmRecursiveVerifier_::veri auto pairing_points = PCS::reduce_verify(opening_claim, transcript); - return pairing_points; - - // Probably we will have to return an aggregation object (see ultra_recursive_verifier.cpp) once we interface - // with noir for public_kernel integration. Follow, the same recipe as in ultra_recursive_verifier.cpp in this case. + pairing_points[0] = pairing_points[0].normalize(); + pairing_points[1] = pairing_points[1].normalize(); + // TODO(https://github.com/AztecProtocol/barretenberg/issues/995): generate this challenge properly. + typename Curve::ScalarField recursion_separator = + Curve::ScalarField::from_witness_index(builder, builder->add_variable(42)); + agg_obj.aggregate(pairing_points, recursion_separator); + return agg_obj; } template class AvmRecursiveVerifier_>; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp index 7c130c7152d..15ddd48f56d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp @@ -1,4 +1,5 @@ #pragma once +#include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp" @@ -10,21 +11,21 @@ template class AvmRecursiveVerifier_ { using Commitment = typename Flavor::Commitment; using CommitmentLabels = typename Flavor::CommitmentLabels; using RelationSeparator = typename Flavor::RelationSeparator; - using VerificationKey = typename Flavor::VerificationKey; - using NativeVerificationKey = typename Flavor::NativeVerificationKey; using Builder = typename Flavor::CircuitBuilder; using PCS = typename Flavor::PCS; using Transcript = bb::BaseTranscript>; using VerifierCommitments = typename Flavor::VerifierCommitments; + using AggregationObject = bb::stdlib::recursion::aggregation_state; public: explicit AvmRecursiveVerifier_(Builder* builder, const std::shared_ptr& native_verification_key); explicit AvmRecursiveVerifier_(Builder* builder, const std::shared_ptr& vkey); - std::array verify_proof(const HonkProof& proof); + AggregationObject verify_proof(const HonkProof& proof, AggregationObject agg_obj); + AggregationObject verify_proof(const StdlibProof& stdlib_proof, AggregationObject agg_obj); std::shared_ptr key; Builder* builder; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp index 368830f881d..1f8443aa106 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp @@ -83,12 +83,15 @@ TEST_F(AvmRecursiveTests, recursion) OuterBuilder outer_circuit; RecursiveVerifier recursive_verifier{ &outer_circuit, verification_key }; - auto pairing_points = recursive_verifier.verify_proof(proof); + auto agg_object = + stdlib::recursion::init_default_aggregation_state(outer_circuit); - bool pairing_points_valid = verification_key->pcs_verification_key->pairing_check(pairing_points[0].get_value(), - pairing_points[1].get_value()); + auto agg_output = recursive_verifier.verify_proof(proof, agg_object); - ASSERT_TRUE(pairing_points_valid) << "Pairing points are not valid."; + bool agg_output_valid = + verification_key->pcs_verification_key->pairing_check(agg_output.P0.get_value(), agg_output.P1.get_value()); + + ASSERT_TRUE(agg_output_valid) << "Pairing points (aggregation state) are not valid."; vinfo("Recursive verifier: num gates = ", outer_circuit.num_gates); ASSERT_FALSE(outer_circuit.failed()) << "Outer circuit has failed."; From 0d4f15b790b04a10d2aabb7840f72467f11b8e86 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Wed, 4 Sep 2024 12:33:41 +0000 Subject: [PATCH 3/7] 8285: dsl for avm recursive verifier --- barretenberg/cpp/src/barretenberg/bb/main.cpp | 7 +- .../cpp/src/barretenberg/dsl/CMakeLists.txt | 4 +- .../dsl/acir_format/acir_format.cpp | 50 ++++- .../dsl/acir_format/acir_format.hpp | 15 +- .../dsl/acir_format/acir_format_mocks.cpp | 1 + .../acir_format/acir_to_constraint_buf.cpp | 17 +- .../acir_format/avm_recursion_constraint.cpp | 197 ++++++++++++++++++ .../acir_format/avm_recursion_constraint.hpp | 17 ++ .../acir_format/honk_recursion_constraint.cpp | 4 +- .../dsl/acir_format/proof_surgeon.hpp | 2 +- .../dsl/acir_format/recursion_constraint.hpp | 2 +- .../barretenberg/vm/avm/generated/flavor.cpp | 5 + .../barretenberg/vm/avm/generated/flavor.hpp | 20 +- .../vm/avm/recursion/avm_recursive_flavor.hpp | 29 +++ .../recursion/avm_recursive_verifier.test.cpp | 1 - .../barretenberg/vm/avm/trace/execution.cpp | 1 - .../bb-pil-backend/templates/flavor.cpp.hbs | 5 + .../bb-pil-backend/templates/flavor.hpp.hbs | 20 +- 18 files changed, 375 insertions(+), 22 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp create mode 100644 barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.hpp diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index f95b741d0a5..915602ee0a4 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -951,12 +951,7 @@ void avm_prove(const std::filesystem::path& bytecode_path, auto const [verification_key, proof] = AVM_TRACK_TIME_V("prove/all", avm_trace::Execution::prove(bytecode, calldata, public_inputs_vec, avm_hints)); - std::vector vk_as_fields = { fr(verification_key.circuit_size), fr(verification_key.num_public_inputs) }; - - for (auto const& comm : verification_key.get_all()) { - std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); - vk_as_fields.insert(vk_as_fields.end(), comm_as_fields.begin(), comm_as_fields.end()); - } + std::vector vk_as_fields = verification_key.to_field_elements(); vinfo("vk fields size: ", vk_as_fields.size()); vinfo("circuit size: ", vk_as_fields[0]); diff --git a/barretenberg/cpp/src/barretenberg/dsl/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/dsl/CMakeLists.txt index 52ea5f9db30..dc8acd00b49 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/dsl/CMakeLists.txt @@ -15,10 +15,10 @@ set(DSL_DEPENDENCIES stdlib_honk_verifier) if (NOT WASM) - list(APPEND DSL_DEPENDENCIES libdeflate::libdeflate_static) + list(APPEND DSL_DEPENDENCIES libdeflate::libdeflate_static vm) endif() barretenberg_module( dsl ${DSL_DEPENDENCIES} -) +) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index 5455857dfc7..f38e4a5b338 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -231,10 +231,17 @@ void build_constraints(Builder& builder, if (!constraint_system.honk_recursion_constraints.empty()) { info("WARNING: this circuit contains unhandled honk_recursion_constraints!"); } + if (!constraint_system.avm_recursion_constraints.empty()) { + info("WARNING: this circuit contains unhandled avm_recursion_constraints!"); + } } else { process_plonk_recursion_constraints(builder, constraint_system, has_valid_witness_assignments, gate_counter); process_honk_recursion_constraints(builder, constraint_system, has_valid_witness_assignments, gate_counter); +#ifndef DISABLE_AZTEC_VM + process_avm_recursion_constraints(builder, constraint_system, has_valid_witness_assignments, gate_counter); +#endif + // If the circuit does not itself contain honk recursion constraints but is going to be // proven with honk then recursively verified, add a default aggregation object if (constraint_system.honk_recursion_constraints.empty() && honk_recursion && @@ -335,7 +342,7 @@ void process_plonk_recursion_constraints(Builder& builder, // final recursion output. builder.set_recursive_proof(current_output_aggregation_object); } -}; +} void process_honk_recursion_constraints(Builder& builder, AcirFormat& constraint_system, @@ -370,7 +377,46 @@ void process_honk_recursion_constraints(Builder& builder, // final recursion output. builder.set_recursive_proof(current_aggregation_object); } -}; +} + +// TODO(https://github.com/AztecProtocol/barretenberg/issues/1095): Probably makes sense to aggregate Honk and AVM +// proofs together. +#ifndef DISABLE_AZTEC_VM +void process_avm_recursion_constraints(Builder& builder, + AcirFormat& constraint_system, + bool has_valid_witness_assignments, + GateCounter& gate_counter) +{ + AggregationObjectIndices current_aggregation_object = + stdlib::recursion::init_default_agg_obj_indices(builder); + + // Add recursion constraints + size_t idx = 0; + for (auto& constraint : constraint_system.avm_recursion_constraints) { + current_aggregation_object = create_avm_recursion_constraints( + builder, constraint, current_aggregation_object, has_valid_witness_assignments); + + gate_counter.track_diff(constraint_system.gates_per_opcode, + constraint_system.original_opcode_indices.avm_recursion_constraints.at(idx++)); + } + + // Now that the circuit has been completely built, we add the output aggregation as public + // inputs. + if (!constraint_system.avm_recursion_constraints.empty()) { + + // First add the output aggregation object as public inputs + // Set the indices as public inputs because they are no longer being + // created in ACIR + for (const auto& idx : current_aggregation_object) { + builder.set_public_input(idx); + } + + // Make sure the verification key records the public input indices of the + // final recursion output. + builder.set_recursive_proof(current_aggregation_object); + } +} +#endif // DISABLE_AZTEC_VM /** * @brief Specialization for creating Ultra circuit from acir constraints and optionally a witness diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index e5b637ab3b8..ef80b59020e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -1,5 +1,10 @@ #pragma once #include "aes128_constraint.hpp" + +#ifndef DISABLE_AZTEC_VM +#include "avm_recursion_constraint.hpp" +#endif + #include "barretenberg/aztec_ivc/aztec_ivc.hpp" #include "barretenberg/common/slab_allocator.hpp" #include "barretenberg/serialize/msgpack.hpp" @@ -51,6 +56,7 @@ struct AcirFormatOriginalOpcodeIndices { std::vector ec_add_constraints; std::vector recursion_constraints; std::vector honk_recursion_constraints; + std::vector avm_recursion_constraints; std::vector ivc_recursion_constraints; std::vector bigint_from_le_bytes_constraints; std::vector bigint_to_le_bytes_constraints; @@ -99,6 +105,7 @@ struct AcirFormat { std::vector ec_add_constraints; std::vector recursion_constraints; std::vector honk_recursion_constraints; + std::vector avm_recursion_constraints; std::vector ivc_recursion_constraints; std::vector bigint_from_le_bytes_constraints; std::vector bigint_to_le_bytes_constraints; @@ -144,6 +151,7 @@ struct AcirFormat { ec_add_constraints, recursion_constraints, honk_recursion_constraints, + avm_recursion_constraints, ivc_recursion_constraints, poly_triple_constraints, block_constraints, @@ -258,7 +266,12 @@ void process_plonk_recursion_constraints(Builder& builder, void process_honk_recursion_constraints(Builder& builder, AcirFormat& constraint_system, bool has_valid_witness_assignments, - bool honk_recursion, GateCounter& gate_counter); +#ifndef DISABLE_AZTEC_VM +void process_avm_recursion_constraints(Builder& builder, + AcirFormat& constraint_system, + GateCounter& gate_counter); +#endif + } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp index 1b58cef549e..2d392f0a88c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp @@ -22,6 +22,7 @@ acir_format::AcirFormatOriginalOpcodeIndices create_empty_original_opcode_indice .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index f73bdf7a1f1..c42ba62db64 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -1,5 +1,6 @@ #include "acir_to_constraint_buf.hpp" #include "barretenberg/common/container.hpp" +#include "barretenberg/dsl/acir_format/recursion_constraint.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" #include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" #include @@ -466,7 +467,7 @@ void handle_blackbox_func_call(Program::Opcode::BlackBoxFuncCall const& arg, // TODO(https://github.com/AztecProtocol/barretenberg/issues/1074): Eventually arg.proof_type will be // the only means for setting the proof type. use of honk_recursion flag in this context can go away // once all noir programs (e.g. protocol circuits) are updated to use the new pattern. - if (honk_recursion && proof_type_in != HONK) { + if (honk_recursion && proof_type_in != HONK && proof_type_in != AVM) { proof_type_in = HONK; } @@ -477,14 +478,22 @@ void handle_blackbox_func_call(Program::Opcode::BlackBoxFuncCall const& arg, .key_hash = input_key, .proof_type = proof_type_in, }; + // Add the recursion constraint to the appropriate container based on proof type - if (c.proof_type == PLONK) { + switch (c.proof_type) { + case PLONK: af.recursion_constraints.push_back(c); af.original_opcode_indices.recursion_constraints.push_back(opcode_index); - } else if (c.proof_type == HONK) { + break; + case HONK: af.honk_recursion_constraints.push_back(c); af.original_opcode_indices.honk_recursion_constraints.push_back(opcode_index); - } else { + break; + case AVM: + af.avm_recursion_constraints.push_back(c); + af.original_opcode_indices.avm_recursion_constraints.push_back(opcode_index); + break; + default: info("Invalid PROOF_TYPE in RecursionConstraint!"); ASSERT(false); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp new file mode 100644 index 00000000000..069acda9c57 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp @@ -0,0 +1,197 @@ +#ifndef DISABLE_AZTEC_VM + +#include "avm_recursion_constraint.hpp" +#include "barretenberg/flavor/flavor.hpp" +#include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" +#include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" +#include "barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp" +#include "barretenberg/vm/avm/recursion/avm_recursive_verifier.hpp" +#include "proof_surgeon.hpp" +#include + +namespace acir_format { + +using namespace bb; +using field_ct = stdlib::field_t; +using bn254 = stdlib::bn254; +using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; + +namespace { +/** + * @brief Creates a dummy vkey and proof object. + * @details Populates the key and proof vectors with dummy values in the write_vk case when we do not have a valid + * witness. The bulk of the logic is setting up certain values correctly like the circuit size, aggregation object, and + * commitments. + * + * @param builder + * @param proof_size Size of proof with NO public inputs + * @param public_inputs_size Total size of public inputs including aggregation object + * @param key_fields + * @param proof_fields + */ +void create_dummy_vkey_and_proof(Builder& builder, + size_t proof_size, + size_t public_inputs_size, + const std::vector& key_fields, + const std::vector& proof_fields) +{ + using Flavor = AvmFlavor; + + size_t num_frs_comm = bb::field_conversion::calc_num_bn254_frs(); + size_t num_frs_fr = bb::field_conversion::calc_num_bn254_frs(); + + // Relevant source for proof layout: AvmFlavor::Transcript::serialize_full_transcript() + assert((proof_size - Flavor::NUM_WITNESS_ENTITIES * num_frs_comm - Flavor::NUM_ALL_ENTITIES * num_frs_fr - + 2 * num_frs_comm) % + (num_frs_comm + num_frs_fr * Flavor::BATCHED_RELATION_PARTIAL_LENGTH) == + 0); + + // Derivation of circuit size based on the proof + // Here, we should always get CONST_PROOF_SIZE_LOG_N which is not what is + // usually set for the AVM proof. As it is a dummy key/proof, it should not matter. + auto log_circuit_size = (proof_size - Flavor::NUM_WITNESS_ENTITIES * num_frs_comm - + Flavor::NUM_ALL_ENTITIES * num_frs_fr - 2 * num_frs_comm) / + (num_frs_comm + num_frs_fr * Flavor::BATCHED_RELATION_PARTIAL_LENGTH); + + /*************************************************************************** + * Construct Dummy Verification Key + ***************************************************************************/ + + // Relevant source for key layout: AvmFlavor::VerificationKey::to_field_elements() + + // First key field is circuit size + builder.assert_equal(builder.add_variable(1 << log_circuit_size), key_fields[0].witness_index); + // Second key field is number of public inputs + builder.assert_equal(builder.add_variable(public_inputs_size), key_fields[1].witness_index); + + size_t offset = 2; + for (size_t i = 0; i < Flavor::NUM_PRECOMPUTED_ENTITIES; ++i) { + auto comm = curve::BN254::AffineElement::one() * fr::random_element(); + auto frs = field_conversion::convert_to_bn254_frs(comm); + builder.assert_equal(builder.add_variable(frs[0]), key_fields[offset].witness_index); + builder.assert_equal(builder.add_variable(frs[1]), key_fields[offset + 1].witness_index); + builder.assert_equal(builder.add_variable(frs[2]), key_fields[offset + 2].witness_index); + builder.assert_equal(builder.add_variable(frs[3]), key_fields[offset + 3].witness_index); + offset += 4; + } + + /*************************************************************************** + * Construct Dummy Proof + ***************************************************************************/ + + builder.assert_equal(builder.add_variable(1 << log_circuit_size), proof_fields[0].witness_index); + offset = 1; + + // Witness Commitments + for (size_t i = 0; i < Flavor::NUM_WITNESS_ENTITIES; i++) { + auto comm = curve::BN254::AffineElement::one() * fr::random_element(); + auto frs = field_conversion::convert_to_bn254_frs(comm); + builder.assert_equal(builder.add_variable(frs[0]), proof_fields[offset].witness_index); + builder.assert_equal(builder.add_variable(frs[1]), proof_fields[offset + 1].witness_index); + builder.assert_equal(builder.add_variable(frs[2]), proof_fields[offset + 2].witness_index); + builder.assert_equal(builder.add_variable(frs[3]), proof_fields[offset + 3].witness_index); + offset += 4; + } + + // now the univariates + for (size_t i = 0; i < CONST_PROOF_SIZE_LOG_N * Flavor::BATCHED_RELATION_PARTIAL_LENGTH; i++) { + builder.assert_equal(builder.add_variable(fr::random_element()), proof_fields[offset].witness_index); + offset++; + } + + // now the sumcheck evaluations + for (size_t i = 0; i < Flavor::NUM_ALL_ENTITIES; i++) { + builder.assert_equal(builder.add_variable(fr::random_element()), proof_fields[offset].witness_index); + offset++; + } + + // now the zeromorph commitments + for (size_t i = 0; i < CONST_PROOF_SIZE_LOG_N; i++) { + auto comm = curve::BN254::AffineElement::one() * fr::random_element(); + auto frs = field_conversion::convert_to_bn254_frs(comm); + builder.assert_equal(builder.add_variable(frs[0]), proof_fields[offset].witness_index); + builder.assert_equal(builder.add_variable(frs[1]), proof_fields[offset + 1].witness_index); + builder.assert_equal(builder.add_variable(frs[2]), proof_fields[offset + 2].witness_index); + builder.assert_equal(builder.add_variable(frs[3]), proof_fields[offset + 3].witness_index); + offset += 4; + } + + // lastly the 2 commitments + for (size_t i = 0; i < 2; i++) { + auto comm = curve::BN254::AffineElement::one() * fr::random_element(); + auto frs = field_conversion::convert_to_bn254_frs(comm); + builder.assert_equal(builder.add_variable(frs[0]), proof_fields[offset].witness_index); + builder.assert_equal(builder.add_variable(frs[1]), proof_fields[offset + 1].witness_index); + builder.assert_equal(builder.add_variable(frs[2]), proof_fields[offset + 2].witness_index); + builder.assert_equal(builder.add_variable(frs[3]), proof_fields[offset + 3].witness_index); + offset += 4; + } + + ASSERT(offset == proof_size); +} + +} // namespace + +/** + * @brief Add constraints required to recursively verify an AVM proof + * + * @param builder + * @param input + * @param input_aggregation_object_indices. The aggregation object coming from previous Honk/Avm recursion constraints. + * @param has_valid_witness_assignment. Do we have witnesses or are we just generating keys? + */ +AggregationObjectIndices create_avm_recursion_constraints(Builder& builder, + const RecursionConstraint& input, + AggregationObjectIndices input_aggregation_object_indices, + bool has_valid_witness_assignments) +{ + using Flavor = AvmRecursiveFlavor_; + using RecursiveVerificationKey = Flavor::VerificationKey; + using RecursiveVerifier = AvmRecursiveVerifier_; + + ASSERT(input.proof_type == AVM); + + // Construct an in-circuit representation of the verification key. + std::vector key_fields; + key_fields.reserve(input.key.size()); + for (const auto& idx : input.key) { + auto field = field_ct::from_witness_index(&builder, idx); + key_fields.emplace_back(field); + } + + // TODO(JEANMON): Once we integrate with public inputs, we will have to decide whether we inject (see + // ProofSurgeon::create_indices_for_reconstructed_proof) them as part of proof_fields or through some separate + // argument like in the native verifier. The latter will be favored because the public inputs are not part of the + // transcript and the verifier code passes the proof to initialize the transcript. + // Create witness indices for the + // proof with public inputs reinserted std::vector proof_indices = + // ProofSurgeon::create_indices_for_reconstructed_proof(input.proof, input.public_inputs); + + std::vector proof_fields; + proof_fields.reserve(input.proof.size()); + + for (const auto& idx : input.proof) { + auto field = field_ct::from_witness_index(&builder, idx); + proof_fields.emplace_back(field); + } + + // Populate the key fields and proof fields with dummy values to prevent issues (e.g. points must be on curve). + if (!has_valid_witness_assignments) { + create_dummy_vkey_and_proof(builder, input.proof.size(), input.public_inputs.size(), key_fields, proof_fields); + } + + // Recursively verify the proof + auto vkey = std::make_shared(builder, key_fields); + RecursiveVerifier verifier(&builder, vkey); + aggregation_state_ct input_agg_obj = bb::stdlib::recursion::convert_witness_indices_to_agg_obj( + builder, input_aggregation_object_indices); + aggregation_state_ct output_agg_object = verifier.verify_proof(proof_fields, input_agg_obj); + // TODO(https://github.com/AztecProtocol/barretenberg/issues/996): investigate whether assert_equal on public + // inputs is important, like what the plonk recursion constraint does. + + return output_agg_object.get_witness_indices(); +} + +} // namespace acir_format +#endif // DISABLE_AZTEC_VM diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.hpp new file mode 100644 index 00000000000..a68af42dcc8 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.hpp @@ -0,0 +1,17 @@ +#ifndef DISABLE_AZTEC_VM +#pragma once +#include "barretenberg/dsl/acir_format/recursion_constraint.hpp" +#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" + +namespace acir_format { +using Builder = bb::UltraCircuitBuilder; + +using namespace bb; + +AggregationObjectIndices create_avm_recursion_constraints(Builder& builder, + const RecursionConstraint& input, + AggregationObjectIndices input_aggregation_object, + bool has_valid_witness_assignments); + +} // namespace acir_format +#endif // DISABLE_AZTEC_VM \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp index d83fa5fcc5a..28611d07622 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp @@ -16,6 +16,7 @@ using field_ct = stdlib::field_t; using bn254 = stdlib::bn254; using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; +namespace { /** * @brief Creates a dummy vkey and proof object. * @details Populates the key and proof vectors with dummy values in the write_vk case when we don't have a valid @@ -110,7 +111,7 @@ void create_dummy_vkey_and_proof(Builder& builder, offset++; } - // now the sumcheck evalutions, which is just 43 0s + // now the sumcheck evaluations, which is just 43 0s for (size_t i = 0; i < Flavor::NUM_ALL_ENTITIES; i++) { builder.assert_equal(builder.add_variable(fr::random_element()), proof_fields[offset].witness_index); offset++; @@ -139,6 +140,7 @@ void create_dummy_vkey_and_proof(Builder& builder, } ASSERT(offset == proof_size + public_inputs_size); } +} // namespace /** * @brief Add constraints required to recursively verify an UltraHonk proof diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp index c4eaaefad1b..ef342ff45c2 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp @@ -28,7 +28,7 @@ class ProofSurgeon { std::vector proof; proof.reserve(proof_in.size() + public_inputs.size()); - // Construct a the complete proof as the concatenation {"initial data" | public_inputs | proof_in} + // Construct the complete proof as the concatenation {"initial data" | public_inputs | proof_in} proof.insert(proof.end(), proof_in.begin(), proof_in.begin() + HONK_RECURSION_PUBLIC_INPUT_OFFSET); proof.insert(proof.end(), public_inputs.begin(), public_inputs.end()); proof.insert(proof.end(), proof_in.begin() + HONK_RECURSION_PUBLIC_INPUT_OFFSET, proof_in.end()); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp index f73454c5479..e53937bc8be 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp @@ -8,7 +8,7 @@ namespace acir_format { // Used to specify the type of recursive verifier via the proof_type specified by the RecursiveAggregation opcode from // ACIR -enum PROOF_TYPE { PLONK, HONK, OINK, PG }; +enum PROOF_TYPE { PLONK, HONK, OINK, PG, AVM }; using namespace bb::plonk; using Builder = bb::UltraCircuitBuilder; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index f54c2b41054..65758c9f9a6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -2207,6 +2207,10 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::incl_mem_tag_err_counts = "INCL_MEM_TAG_ERR_COUNTS"; }; +// Note: current de-/serialization routines are not including the padded zero univariates which are added as part of +// current sumcheck implementation. Namely, this algorithm is padding to reach CONST_PROOF_SIZE_LOG_N sumcheck rounds. +// Similarly, zeromorph implementation performs same padding over some commitments (zm_cq_comms). +// In code below, the loops are of size log(circuit_size) instead of CONST_PROOF_SIZE_LOG_N. void AvmFlavor::Transcript::deserialize_full_transcript() { size_t num_frs_read = 0; @@ -2229,6 +2233,7 @@ void AvmFlavor::Transcript::deserialize_full_transcript() zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); } +// See note above AvmFlavor::Transcript::deserialize_full_transcript() void AvmFlavor::Transcript::serialize_full_transcript() { size_t old_proof_length = proof_data.size(); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 47228fbf667..d2bce4ef8a3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -318,7 +318,7 @@ class AvmFlavor { VerificationKey() = default; VerificationKey(const std::shared_ptr& proving_key) - : VerificationKey_(proving_key->circuit_size, proving_key->num_public_inputs) + : VerificationKey_(proving_key->circuit_size, static_cast(proving_key->num_public_inputs)) { for (auto [polynomial, commitment] : zip_view(proving_key->get_precomputed_polynomials(), this->get_all())) { @@ -337,6 +337,24 @@ class AvmFlavor { } pcs_verification_key = std::make_shared(); } + + // Override FF alias in VerificationKey_ + using FF = AvmFlavor::FF; + /** + * @brief Serialize verification key to field elements + * + * @return std::vector + */ + std::vector to_field_elements() const + { + std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; + + for (auto const& comm : get_all()) { + std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); + elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); + } + return elements; + } }; class AllValues : public AllEntities { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp index 85eda197acb..d20a2496c0d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_flavor.hpp @@ -3,6 +3,7 @@ #include "barretenberg/stdlib/transcript/transcript.hpp" #include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "barretenberg/vm/avm/generated/flavor.hpp" +#include namespace bb { @@ -63,6 +64,34 @@ template class AvmRecursiveFlavor_ { comm = Commitment::from_witness(builder, native_comm); } } + + /** + * @brief Deserialize a verification key from a vector of field elements + * + * @param builder + * @param elements + */ + VerificationKey(CircuitBuilder& builder, std::span elements) + { + size_t num_frs_read = 0; + size_t num_frs_FF = bb::stdlib::field_conversion::calc_num_bn254_frs(); + size_t num_frs_Comm = bb::stdlib::field_conversion::calc_num_bn254_frs(); + + this->circuit_size = uint64_t(stdlib::field_conversion::convert_from_bn254_frs( + builder, elements.subspan(num_frs_read, num_frs_FF)) + .get_value()); + num_frs_read += num_frs_FF; + this->num_public_inputs = uint64_t(stdlib::field_conversion::convert_from_bn254_frs( + builder, elements.subspan(num_frs_read, num_frs_FF)) + .get_value()); + num_frs_read += num_frs_FF; + + for (Commitment& comm : this->get_all()) { + comm = bb::stdlib::field_conversion::convert_from_bn254_frs( + builder, elements.subspan(num_frs_read, num_frs_Comm)); + num_frs_read += num_frs_Comm; + } + } }; using WitnessCommitments = AvmFlavor::WitnessEntities; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp index 1f8443aa106..a0a3a421b0d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp @@ -32,7 +32,6 @@ class AvmRecursiveTests : public ::testing::Test { using Transcript = InnerFlavor::Transcript; - // Note: removed templating from eccvm one using RecursiveVerifier = AvmRecursiveVerifier_; using OuterBuilder = typename RecursiveFlavor::CircuitBuilder; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp index e7759e5d7fb..851c14dacb6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp @@ -153,7 +153,6 @@ std::tuple Execution::prove(std::vector(proof_data, num_frs_read); @@ -68,6 +72,7 @@ void {{name}}Flavor::Transcript::deserialize_full_transcript() { zm_pi_comm = deserialize_from_buffer(proof_data, num_frs_read); } +// See note above AvmFlavor::Transcript::deserialize_full_transcript() void {{name}}Flavor::Transcript::serialize_full_transcript() { size_t old_proof_length = proof_data.size(); Transcript::proof_data.clear(); diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index 3aafbf028d5..723130e0e43 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -198,7 +198,7 @@ class {{name}}Flavor { VerificationKey() = default; VerificationKey(const std::shared_ptr& proving_key) - : VerificationKey_(proving_key->circuit_size, proving_key->num_public_inputs) + : VerificationKey_(proving_key->circuit_size, static_cast(proving_key->num_public_inputs)) { for (auto [polynomial, commitment] : zip_view(proving_key->get_precomputed_polynomials(), this->get_all())) { @@ -217,6 +217,24 @@ class {{name}}Flavor { } pcs_verification_key = std::make_shared(); } + + // Override FF alias in VerificationKey_ + using FF = AvmFlavor::FF; + /** + * @brief Serialize verification key to field elements + * + * @return std::vector + */ + std::vector to_field_elements() const + { + std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; + + for (auto const& comm : get_all()) { + std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); + elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); + } + return elements; + } }; {{!-- Used by sumcheck --}} From 5fb333535e3f7ea1902e7d93120d936eecdbe1b0 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 6 Sep 2024 08:52:52 +0000 Subject: [PATCH 4/7] 8285: fix gcc errors --- .../src/barretenberg/dsl/acir_format/acir_format.test.cpp | 7 +++++++ .../dsl/acir_format/bigint_constraint.test.cpp | 5 +++++ .../barretenberg/dsl/acir_format/block_constraint.test.cpp | 3 +++ .../barretenberg/dsl/acir_format/ec_operations.test.cpp | 2 ++ .../barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp | 3 +++ .../barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp | 4 ++++ .../dsl/acir_format/honk_recursion_constraint.test.cpp | 1 + .../barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp | 1 + .../dsl/acir_format/poseidon2_constraint.test.cpp | 1 + .../dsl/acir_format/recursion_constraint.test.cpp | 2 ++ .../dsl/acir_format/sha256_constraint.test.cpp | 1 + 11 files changed, 30 insertions(+) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp index 79814a519b1..64a7fea8a5e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp @@ -61,6 +61,7 @@ TEST_F(AcirFormatTests, TestASingleConstraintNoPubInputs) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -184,6 +185,7 @@ TEST_F(AcirFormatTests, TestLogicGateFromNoirCircuit) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -265,6 +267,7 @@ TEST_F(AcirFormatTests, TestSchnorrVerifyPass) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -373,6 +376,7 @@ TEST_F(AcirFormatTests, TestSchnorrVerifySmallRange) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -494,6 +498,7 @@ TEST_F(AcirFormatTests, TestVarKeccak) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -575,6 +580,7 @@ TEST_F(AcirFormatTests, TestKeccakPermutation) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -653,6 +659,7 @@ TEST_F(AcirFormatTests, TestCollectsGateCounts) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp index 9c3d842fbfc..a2dec9cce39 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp @@ -194,6 +194,7 @@ TEST_F(BigIntTests, TestBigIntConstraintMultiple) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -269,6 +270,7 @@ TEST_F(BigIntTests, TestBigIntConstraintSimple) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = { from_le_bytes_constraint_bigint1 }, .bigint_to_le_bytes_constraints = { result2_to_le_bytes }, @@ -328,6 +330,7 @@ TEST_F(BigIntTests, TestBigIntConstraintReuse) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -392,6 +395,7 @@ TEST_F(BigIntTests, TestBigIntConstraintReuse2) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -477,6 +481,7 @@ TEST_F(BigIntTests, TestBigIntDIV) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = { from_le_bytes_constraint_bigint1, from_le_bytes_constraint_bigint2 }, .bigint_to_le_bytes_constraints = { result3_to_le_bytes }, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index 4ea78bae375..03ddf8035dc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -162,6 +162,7 @@ TEST_F(UltraPlonkRAM, TestBlockConstraint) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -215,6 +216,7 @@ TEST_F(MegaHonk, Databus) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -323,6 +325,7 @@ TEST_F(MegaHonk, DatabusReturn) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp index 075e11ce596..ac86757bb0d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp @@ -84,6 +84,7 @@ TEST_F(EcOperations, TestECOperations) .ec_add_constraints = { ec_add_constraint }, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -222,6 +223,7 @@ TEST_F(EcOperations, TestECMultiScalarMul) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp index b72acd21892..d8bc40c5308 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp @@ -116,6 +116,7 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintSucceed) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -172,6 +173,7 @@ TEST_F(ECDSASecp256k1, TestECDSACompilesForVerifier) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -223,6 +225,7 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintFail) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp index e4d8c5696f7..869c896ea6f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp @@ -150,6 +150,7 @@ TEST(ECDSASecp256r1, test_hardcoded) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -208,6 +209,7 @@ TEST(ECDSASecp256r1, TestECDSAConstraintSucceed) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -264,6 +266,7 @@ TEST(ECDSASecp256r1, TestECDSACompilesForVerifier) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -316,6 +319,7 @@ TEST(ECDSASecp256r1, TestECDSAConstraintFail) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp index 20eebf67b60..abf9be04f69 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp @@ -112,6 +112,7 @@ class AcirHonkRecursionConstraint : public ::testing::Test { .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp index 97546e7789d..47bd777cfce 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp @@ -84,6 +84,7 @@ TEST_F(MSMTests, TestMSM) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp index 4484009f707..c3dc81fd9bc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp @@ -64,6 +64,7 @@ TEST_F(Poseidon2Tests, TestPoseidon2Permutation) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp index b0ed01dd270..1811b8d7fee 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp @@ -109,6 +109,7 @@ Builder create_inner_circuit() .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, @@ -272,6 +273,7 @@ Builder create_outer_circuit(std::vector& inner_circuits) .ec_add_constraints = {}, .recursion_constraints = recursion_constraints, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp index ab6319b1d14..3f27b41c584 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp @@ -59,6 +59,7 @@ TEST_F(Sha256Tests, TestSha256Compression) .ec_add_constraints = {}, .recursion_constraints = {}, .honk_recursion_constraints = {}, + .avm_recursion_constraints = {}, .ivc_recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_to_le_bytes_constraints = {}, From db139794585f961572a986b4a2793f8d3429c1e7 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Mon, 9 Sep 2024 06:57:48 +0000 Subject: [PATCH 5/7] 8285: unit test for dsl avm recursive verifier --- .../dsl/acir_format/acir_format_mocks.cpp | 3 + .../avm_recursion_constraint.test.cpp | 140 ++++++++++++++++++ .../recursion/avm_recursive_verifier.test.cpp | 8 +- 3 files changed, 147 insertions(+), 4 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp index 2d392f0a88c..e1240d85e82 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format_mocks.cpp @@ -94,6 +94,9 @@ void mock_opcode_indices(acir_format::AcirFormat& constraint_system) for (size_t i = 0; i < constraint_system.honk_recursion_constraints.size(); i++) { constraint_system.original_opcode_indices.honk_recursion_constraints.push_back(current_opcode++); } + for (size_t i = 0; i < constraint_system.avm_recursion_constraints.size(); i++) { + constraint_system.original_opcode_indices.avm_recursion_constraints.push_back(current_opcode++); + } for (size_t i = 0; i < constraint_system.ivc_recursion_constraints.size(); i++) { constraint_system.original_opcode_indices.ivc_recursion_constraints.push_back(current_opcode++); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp new file mode 100644 index 00000000000..30e65fbb4b2 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp @@ -0,0 +1,140 @@ +#ifndef DISABLE_AZTEC_VM + +#include "avm_recursion_constraint.hpp" +#include "acir_format.hpp" +#include "acir_format_mocks.hpp" +#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" +#include "barretenberg/sumcheck/instance/prover_instance.hpp" +#include "barretenberg/ultra_honk/ultra_prover.hpp" +#include "barretenberg/ultra_honk/ultra_verifier.hpp" +#include "barretenberg/vm/avm/generated/circuit_builder.hpp" +#include "barretenberg/vm/avm/generated/composer.hpp" +#include "barretenberg/vm/avm/generated/flavor.hpp" +#include "barretenberg/vm/avm/generated/prover.hpp" +#include "barretenberg/vm/avm/generated/verifier.hpp" +#include "barretenberg/vm/avm/tests/helpers.test.hpp" +#include "barretenberg/vm/avm/trace/trace.hpp" +#include "proof_surgeon.hpp" +#include +#include +#include + +using namespace acir_format; +using namespace bb; +using namespace bb::avm_trace; + +class AcirAvmRecursionConstraint : public ::testing::Test { + public: + using InnerBuilder = AvmCircuitBuilder; + using InnerProver = AvmProver; + using InnerVerifier = AvmVerifier; + + using OuterProver = UltraProver; + using OuterVerifier = UltraVerifier; + using OuterDeciderProvingKey = DeciderProvingKey_; + + using DeciderProvingKey = DeciderProvingKey_; + using OuterVerificationKey = UltraFlavor::VerificationKey; + using OuterBuilder = UltraCircuitBuilder; + + static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } + + static InnerBuilder create_inner_circuit() + { + VmPublicInputs public_inputs; + std::array kernel_inputs{}; + kernel_inputs.at(DA_GAS_LEFT_CONTEXT_INPUTS_OFFSET) = 1000000; + kernel_inputs.at(L2_GAS_LEFT_CONTEXT_INPUTS_OFFSET) = 1000000; + std::get<0>(public_inputs) = kernel_inputs; + + AvmTraceBuilder trace_builder(public_inputs); + InnerBuilder builder; + + trace_builder.op_set(0, 15, 1, AvmMemoryTag::U8); + trace_builder.op_set(0, 12, 2, AvmMemoryTag::U8); + trace_builder.op_add(0, 1, 2, 3, AvmMemoryTag::U8); + trace_builder.op_sub(0, 3, 2, 3, AvmMemoryTag::U8); + trace_builder.op_mul(0, 1, 1, 3, AvmMemoryTag::U8); + trace_builder.op_return(0, 0, 0); + auto trace = trace_builder.finalize(); // Passing true enables a longer trace with lookups + + builder.set_trace(std::move(trace)); + builder.check_circuit(); + return builder; + } + + /** + * @brief Create a circuit that recursively verifies one or more inner avm circuits + */ + static OuterBuilder create_outer_circuit(std::vector& inner_avm_circuits) + { + std::vector avm_recursion_constraints; + + SlabVector witness; + + for (auto& avm_circuit : inner_avm_circuits) { + AvmComposer composer = AvmComposer(); + InnerProver prover = composer.create_prover(avm_circuit); + InnerVerifier verifier = composer.create_verifier(avm_circuit); + + std::vector key_witnesses = verifier.key->to_field_elements(); + std::vector proof_witnesses = prover.construct_proof(); + // const size_t num_public_inputs = verifier.key->num_public_inputs; + + // Helper to append some values to the witness vector and return their corresponding indices + auto add_to_witness_and_track_indices = + [&witness](const std::vector& input) -> std::vector { + std::vector indices; + indices.reserve(input.size()); + auto witness_idx = static_cast(witness.size()); + for (const auto& value : input) { + witness.push_back(value); + indices.push_back(witness_idx++); + } + return indices; + }; + + RecursionConstraint avm_recursion_constraint{ + .key = add_to_witness_and_track_indices(key_witnesses), + .proof = add_to_witness_and_track_indices(proof_witnesses), + .public_inputs = {}, + .key_hash = 0, // not used + .proof_type = AVM, + }; + avm_recursion_constraints.push_back(avm_recursion_constraint); + } + + std::vector avm_recursion_opcode_indices(avm_recursion_constraints.size()); + std::iota(avm_recursion_opcode_indices.begin(), avm_recursion_opcode_indices.end(), 0); + + AcirFormat constraint_system; + constraint_system.varnum = static_cast(witness.size()); + constraint_system.recursive = false; + constraint_system.num_acir_opcodes = static_cast(avm_recursion_constraints.size()); + constraint_system.avm_recursion_constraints = avm_recursion_constraints; + constraint_system.original_opcode_indices = create_empty_original_opcode_indices(); + + mock_opcode_indices(constraint_system); + auto outer_circuit = create_circuit(constraint_system, /*size_hint*/ 0, witness); + return outer_circuit; + } +}; + +TEST_F(AcirAvmRecursionConstraint, TestBasicSingleAvmRecursionConstraint) +{ + std::vector layer_1_circuits; + layer_1_circuits.push_back(create_inner_circuit()); + auto layer_2_circuit = create_outer_circuit(layer_1_circuits); + + info("circuit gates = ", layer_2_circuit.get_num_gates()); + + auto proving_key = std::make_shared(layer_2_circuit); + OuterProver prover(proving_key); + info("prover gates = ", proving_key->proving_key.circuit_size); + auto proof = prover.construct_proof(); + auto verification_key = std::make_shared(proving_key->proving_key); + OuterVerifier verifier(verification_key); + EXPECT_EQ(verifier.verify_proof(proof), true); +} + +#endif // DISABLE_AZTEC_VM \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp index a0a3a421b0d..946cd2e15fb 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/avm_recursive_verifier.test.cpp @@ -35,8 +35,8 @@ class AvmRecursiveTests : public ::testing::Test { using RecursiveVerifier = AvmRecursiveVerifier_; using OuterBuilder = typename RecursiveFlavor::CircuitBuilder; - using OuterProver = UltraProver_; - using OuterVerifier = UltraVerifier_; + using OuterProver = UltraProver; + using OuterVerifier = UltraVerifier; using OuterDeciderProvingKey = DeciderProvingKey_; static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } @@ -65,8 +65,8 @@ TEST_F(AvmRecursiveTests, recursion) { AvmCircuitBuilder circuit_builder = generate_avm_circuit(); AvmComposer composer = AvmComposer(); - AvmProver prover = composer.create_prover(circuit_builder); - AvmVerifier verifier = composer.create_verifier(circuit_builder); + InnerProver prover = composer.create_prover(circuit_builder); + InnerVerifier verifier = composer.create_verifier(circuit_builder); HonkProof proof = prover.construct_proof(); From 1110861b113c9953efe7cb9d8cce13e85818c311 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Mon, 9 Sep 2024 15:43:20 +0000 Subject: [PATCH 6/7] 8285: addressing of review comments --- .../dsl/acir_format/acir_format.cpp | 7 +- .../avm_recursion_constraint.test.cpp | 1 - .../vm/avm/generated/circuit_builder.cpp | 1 - .../barretenberg/vm/avm/generated/flavor.cpp | 1133 +++++++++-------- .../barretenberg/vm/avm/generated/flavor.hpp | 26 +- .../vm/avm/generated/full_row.cpp | 2 - .../vm/avm/generated/full_row.hpp | 3 +- .../vm/avm/generated/relations/kernel.hpp | 144 +-- .../vm/avm/generated/relations/main.hpp | 323 +++-- .../bb-pil-backend/templates/flavor.cpp.hbs | 16 + .../bb-pil-backend/templates/flavor.hpp.hbs | 20 +- 11 files changed, 829 insertions(+), 847 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index f38e4a5b338..2b6ec4ce183 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -400,8 +400,11 @@ void process_avm_recursion_constraints(Builder& builder, constraint_system.original_opcode_indices.avm_recursion_constraints.at(idx++)); } - // Now that the circuit has been completely built, we add the output aggregation as public - // inputs. + // TODO(https://github.com/AztecProtocol/barretenberg/issues/1095): The following code will have to be adapted to + // support a circuit with both honk and avm recursion constraints. + + // Now that the circuit has been completely built, we add + // the output aggregation as public inputs. if (!constraint_system.avm_recursion_constraints.empty()) { // First add the output aggregation object as public inputs diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp index 30e65fbb4b2..63c8179c644 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp @@ -79,7 +79,6 @@ class AcirAvmRecursionConstraint : public ::testing::Test { std::vector key_witnesses = verifier.key->to_field_elements(); std::vector proof_witnesses = prover.construct_proof(); - // const size_t num_public_inputs = verifier.key->num_public_inputs; // Helper to append some values to the witness vector and return their corresponding indices auto add_to_witness_and_track_indices = diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 72e8e628942..058f5845a42 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -208,7 +208,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co 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_ecadd[i] = rows[i].main_sel_op_ecadd; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 65758c9f9a6..e9520fbff1c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -189,564 +189,563 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , main_sel_op_cast(il[181]) , main_sel_op_chain_id(il[182]) , main_sel_op_cmov(il[183]) - , main_sel_op_coinbase(il[184]) - , main_sel_op_dagasleft(il[185]) - , main_sel_op_div(il[186]) - , main_sel_op_ecadd(il[187]) - , main_sel_op_emit_l2_to_l1_msg(il[188]) - , main_sel_op_emit_note_hash(il[189]) - , main_sel_op_emit_nullifier(il[190]) - , main_sel_op_emit_unencrypted_log(il[191]) - , main_sel_op_eq(il[192]) - , main_sel_op_external_call(il[193]) - , main_sel_op_external_return(il[194]) - , main_sel_op_external_revert(il[195]) - , main_sel_op_fdiv(il[196]) - , main_sel_op_fee_per_da_gas(il[197]) - , main_sel_op_fee_per_l2_gas(il[198]) - , main_sel_op_function_selector(il[199]) - , main_sel_op_get_contract_instance(il[200]) - , main_sel_op_internal_call(il[201]) - , main_sel_op_internal_return(il[202]) - , main_sel_op_jump(il[203]) - , main_sel_op_jumpi(il[204]) - , main_sel_op_keccak(il[205]) - , main_sel_op_l1_to_l2_msg_exists(il[206]) - , main_sel_op_l2gasleft(il[207]) - , main_sel_op_lt(il[208]) - , main_sel_op_lte(il[209]) - , main_sel_op_mov(il[210]) - , main_sel_op_msm(il[211]) - , main_sel_op_mul(il[212]) - , main_sel_op_not(il[213]) - , main_sel_op_note_hash_exists(il[214]) - , main_sel_op_nullifier_exists(il[215]) - , main_sel_op_or(il[216]) - , main_sel_op_pedersen(il[217]) - , main_sel_op_pedersen_commit(il[218]) - , main_sel_op_poseidon2(il[219]) - , main_sel_op_radix_le(il[220]) - , main_sel_op_sender(il[221]) - , main_sel_op_set(il[222]) - , main_sel_op_sha256(il[223]) - , main_sel_op_shl(il[224]) - , main_sel_op_shr(il[225]) - , main_sel_op_sload(il[226]) - , main_sel_op_sstore(il[227]) - , main_sel_op_storage_address(il[228]) - , main_sel_op_sub(il[229]) - , main_sel_op_timestamp(il[230]) - , main_sel_op_transaction_fee(il[231]) - , main_sel_op_version(il[232]) - , main_sel_op_xor(il[233]) - , main_sel_q_kernel_lookup(il[234]) - , main_sel_q_kernel_output_lookup(il[235]) - , main_sel_resolve_ind_addr_a(il[236]) - , main_sel_resolve_ind_addr_b(il[237]) - , main_sel_resolve_ind_addr_c(il[238]) - , main_sel_resolve_ind_addr_d(il[239]) - , main_sel_returndata(il[240]) - , main_sel_rng_16(il[241]) - , main_sel_rng_8(il[242]) - , main_sel_slice_gadget(il[243]) - , main_side_effect_counter(il[244]) - , main_sload_write_offset(il[245]) - , main_space_id(il[246]) - , main_sstore_write_offset(il[247]) - , main_tag_err(il[248]) - , main_w_in_tag(il[249]) - , mem_addr(il[250]) - , mem_clk(il[251]) - , mem_diff(il[252]) - , mem_glob_addr(il[253]) - , mem_last(il[254]) - , mem_lastAccess(il[255]) - , mem_one_min_inv(il[256]) - , mem_r_in_tag(il[257]) - , mem_rw(il[258]) - , mem_sel_mem(il[259]) - , mem_sel_mov_ia_to_ic(il[260]) - , mem_sel_mov_ib_to_ic(il[261]) - , mem_sel_op_a(il[262]) - , mem_sel_op_b(il[263]) - , mem_sel_op_c(il[264]) - , mem_sel_op_cmov(il[265]) - , mem_sel_op_d(il[266]) - , mem_sel_op_poseidon_read_a(il[267]) - , mem_sel_op_poseidon_read_b(il[268]) - , mem_sel_op_poseidon_read_c(il[269]) - , mem_sel_op_poseidon_read_d(il[270]) - , mem_sel_op_poseidon_write_a(il[271]) - , mem_sel_op_poseidon_write_b(il[272]) - , mem_sel_op_poseidon_write_c(il[273]) - , mem_sel_op_poseidon_write_d(il[274]) - , mem_sel_op_slice(il[275]) - , mem_sel_resolve_ind_addr_a(il[276]) - , mem_sel_resolve_ind_addr_b(il[277]) - , mem_sel_resolve_ind_addr_c(il[278]) - , mem_sel_resolve_ind_addr_d(il[279]) - , mem_sel_rng_chk(il[280]) - , mem_skip_check_tag(il[281]) - , mem_space_id(il[282]) - , mem_tag(il[283]) - , mem_tag_err(il[284]) - , mem_tsp(il[285]) - , mem_val(il[286]) - , mem_w_in_tag(il[287]) - , pedersen_clk(il[288]) - , pedersen_input(il[289]) - , pedersen_output(il[290]) - , pedersen_sel_pedersen(il[291]) - , poseidon2_B_10_0(il[292]) - , poseidon2_B_10_1(il[293]) - , poseidon2_B_10_2(il[294]) - , poseidon2_B_10_3(il[295]) - , poseidon2_B_11_0(il[296]) - , poseidon2_B_11_1(il[297]) - , poseidon2_B_11_2(il[298]) - , poseidon2_B_11_3(il[299]) - , poseidon2_B_12_0(il[300]) - , poseidon2_B_12_1(il[301]) - , poseidon2_B_12_2(il[302]) - , poseidon2_B_12_3(il[303]) - , poseidon2_B_13_0(il[304]) - , poseidon2_B_13_1(il[305]) - , poseidon2_B_13_2(il[306]) - , poseidon2_B_13_3(il[307]) - , poseidon2_B_14_0(il[308]) - , poseidon2_B_14_1(il[309]) - , poseidon2_B_14_2(il[310]) - , poseidon2_B_14_3(il[311]) - , poseidon2_B_15_0(il[312]) - , poseidon2_B_15_1(il[313]) - , poseidon2_B_15_2(il[314]) - , poseidon2_B_15_3(il[315]) - , poseidon2_B_16_0(il[316]) - , poseidon2_B_16_1(il[317]) - , poseidon2_B_16_2(il[318]) - , poseidon2_B_16_3(il[319]) - , poseidon2_B_17_0(il[320]) - , poseidon2_B_17_1(il[321]) - , poseidon2_B_17_2(il[322]) - , poseidon2_B_17_3(il[323]) - , poseidon2_B_18_0(il[324]) - , poseidon2_B_18_1(il[325]) - , poseidon2_B_18_2(il[326]) - , poseidon2_B_18_3(il[327]) - , poseidon2_B_19_0(il[328]) - , poseidon2_B_19_1(il[329]) - , poseidon2_B_19_2(il[330]) - , poseidon2_B_19_3(il[331]) - , poseidon2_B_20_0(il[332]) - , poseidon2_B_20_1(il[333]) - , poseidon2_B_20_2(il[334]) - , poseidon2_B_20_3(il[335]) - , poseidon2_B_21_0(il[336]) - , poseidon2_B_21_1(il[337]) - , poseidon2_B_21_2(il[338]) - , poseidon2_B_21_3(il[339]) - , poseidon2_B_22_0(il[340]) - , poseidon2_B_22_1(il[341]) - , poseidon2_B_22_2(il[342]) - , poseidon2_B_22_3(il[343]) - , poseidon2_B_23_0(il[344]) - , poseidon2_B_23_1(il[345]) - , poseidon2_B_23_2(il[346]) - , poseidon2_B_23_3(il[347]) - , poseidon2_B_24_0(il[348]) - , poseidon2_B_24_1(il[349]) - , poseidon2_B_24_2(il[350]) - , poseidon2_B_24_3(il[351]) - , poseidon2_B_25_0(il[352]) - , poseidon2_B_25_1(il[353]) - , poseidon2_B_25_2(il[354]) - , poseidon2_B_25_3(il[355]) - , poseidon2_B_26_0(il[356]) - , poseidon2_B_26_1(il[357]) - , poseidon2_B_26_2(il[358]) - , poseidon2_B_26_3(il[359]) - , poseidon2_B_27_0(il[360]) - , poseidon2_B_27_1(il[361]) - , poseidon2_B_27_2(il[362]) - , poseidon2_B_27_3(il[363]) - , poseidon2_B_28_0(il[364]) - , poseidon2_B_28_1(il[365]) - , poseidon2_B_28_2(il[366]) - , poseidon2_B_28_3(il[367]) - , poseidon2_B_29_0(il[368]) - , poseidon2_B_29_1(il[369]) - , poseidon2_B_29_2(il[370]) - , poseidon2_B_29_3(il[371]) - , poseidon2_B_30_0(il[372]) - , poseidon2_B_30_1(il[373]) - , poseidon2_B_30_2(il[374]) - , poseidon2_B_30_3(il[375]) - , poseidon2_B_31_0(il[376]) - , poseidon2_B_31_1(il[377]) - , poseidon2_B_31_2(il[378]) - , poseidon2_B_31_3(il[379]) - , poseidon2_B_32_0(il[380]) - , poseidon2_B_32_1(il[381]) - , poseidon2_B_32_2(il[382]) - , poseidon2_B_32_3(il[383]) - , poseidon2_B_33_0(il[384]) - , poseidon2_B_33_1(il[385]) - , poseidon2_B_33_2(il[386]) - , poseidon2_B_33_3(il[387]) - , poseidon2_B_34_0(il[388]) - , poseidon2_B_34_1(il[389]) - , poseidon2_B_34_2(il[390]) - , poseidon2_B_34_3(il[391]) - , poseidon2_B_35_0(il[392]) - , poseidon2_B_35_1(il[393]) - , poseidon2_B_35_2(il[394]) - , poseidon2_B_35_3(il[395]) - , poseidon2_B_36_0(il[396]) - , poseidon2_B_36_1(il[397]) - , poseidon2_B_36_2(il[398]) - , poseidon2_B_36_3(il[399]) - , poseidon2_B_37_0(il[400]) - , poseidon2_B_37_1(il[401]) - , poseidon2_B_37_2(il[402]) - , poseidon2_B_37_3(il[403]) - , poseidon2_B_38_0(il[404]) - , poseidon2_B_38_1(il[405]) - , poseidon2_B_38_2(il[406]) - , poseidon2_B_38_3(il[407]) - , poseidon2_B_39_0(il[408]) - , poseidon2_B_39_1(il[409]) - , poseidon2_B_39_2(il[410]) - , poseidon2_B_39_3(il[411]) - , poseidon2_B_40_0(il[412]) - , poseidon2_B_40_1(il[413]) - , poseidon2_B_40_2(il[414]) - , poseidon2_B_40_3(il[415]) - , poseidon2_B_41_0(il[416]) - , poseidon2_B_41_1(il[417]) - , poseidon2_B_41_2(il[418]) - , poseidon2_B_41_3(il[419]) - , poseidon2_B_42_0(il[420]) - , poseidon2_B_42_1(il[421]) - , poseidon2_B_42_2(il[422]) - , poseidon2_B_42_3(il[423]) - , poseidon2_B_43_0(il[424]) - , poseidon2_B_43_1(il[425]) - , poseidon2_B_43_2(il[426]) - , poseidon2_B_43_3(il[427]) - , poseidon2_B_44_0(il[428]) - , poseidon2_B_44_1(il[429]) - , poseidon2_B_44_2(il[430]) - , poseidon2_B_44_3(il[431]) - , poseidon2_B_45_0(il[432]) - , poseidon2_B_45_1(il[433]) - , poseidon2_B_45_2(il[434]) - , poseidon2_B_45_3(il[435]) - , poseidon2_B_46_0(il[436]) - , poseidon2_B_46_1(il[437]) - , poseidon2_B_46_2(il[438]) - , poseidon2_B_46_3(il[439]) - , poseidon2_B_47_0(il[440]) - , poseidon2_B_47_1(il[441]) - , poseidon2_B_47_2(il[442]) - , poseidon2_B_47_3(il[443]) - , poseidon2_B_48_0(il[444]) - , poseidon2_B_48_1(il[445]) - , poseidon2_B_48_2(il[446]) - , poseidon2_B_48_3(il[447]) - , poseidon2_B_49_0(il[448]) - , poseidon2_B_49_1(il[449]) - , poseidon2_B_49_2(il[450]) - , poseidon2_B_49_3(il[451]) - , poseidon2_B_4_0(il[452]) - , poseidon2_B_4_1(il[453]) - , poseidon2_B_4_2(il[454]) - , poseidon2_B_4_3(il[455]) - , poseidon2_B_50_0(il[456]) - , poseidon2_B_50_1(il[457]) - , poseidon2_B_50_2(il[458]) - , poseidon2_B_50_3(il[459]) - , poseidon2_B_51_0(il[460]) - , poseidon2_B_51_1(il[461]) - , poseidon2_B_51_2(il[462]) - , poseidon2_B_51_3(il[463]) - , poseidon2_B_52_0(il[464]) - , poseidon2_B_52_1(il[465]) - , poseidon2_B_52_2(il[466]) - , poseidon2_B_52_3(il[467]) - , poseidon2_B_53_0(il[468]) - , poseidon2_B_53_1(il[469]) - , poseidon2_B_53_2(il[470]) - , poseidon2_B_53_3(il[471]) - , poseidon2_B_54_0(il[472]) - , poseidon2_B_54_1(il[473]) - , poseidon2_B_54_2(il[474]) - , poseidon2_B_54_3(il[475]) - , poseidon2_B_55_0(il[476]) - , poseidon2_B_55_1(il[477]) - , poseidon2_B_55_2(il[478]) - , poseidon2_B_55_3(il[479]) - , poseidon2_B_56_0(il[480]) - , poseidon2_B_56_1(il[481]) - , poseidon2_B_56_2(il[482]) - , poseidon2_B_56_3(il[483]) - , poseidon2_B_57_0(il[484]) - , poseidon2_B_57_1(il[485]) - , poseidon2_B_57_2(il[486]) - , poseidon2_B_57_3(il[487]) - , poseidon2_B_58_0(il[488]) - , poseidon2_B_58_1(il[489]) - , poseidon2_B_58_2(il[490]) - , poseidon2_B_58_3(il[491]) - , poseidon2_B_59_0(il[492]) - , poseidon2_B_59_1(il[493]) - , poseidon2_B_59_2(il[494]) - , poseidon2_B_59_3(il[495]) - , poseidon2_B_5_0(il[496]) - , poseidon2_B_5_1(il[497]) - , poseidon2_B_5_2(il[498]) - , poseidon2_B_5_3(il[499]) - , poseidon2_B_6_0(il[500]) - , poseidon2_B_6_1(il[501]) - , poseidon2_B_6_2(il[502]) - , poseidon2_B_6_3(il[503]) - , poseidon2_B_7_0(il[504]) - , poseidon2_B_7_1(il[505]) - , poseidon2_B_7_2(il[506]) - , poseidon2_B_7_3(il[507]) - , poseidon2_B_8_0(il[508]) - , poseidon2_B_8_1(il[509]) - , poseidon2_B_8_2(il[510]) - , poseidon2_B_8_3(il[511]) - , poseidon2_B_9_0(il[512]) - , poseidon2_B_9_1(il[513]) - , poseidon2_B_9_2(il[514]) - , poseidon2_B_9_3(il[515]) - , poseidon2_EXT_LAYER_4(il[516]) - , poseidon2_EXT_LAYER_5(il[517]) - , poseidon2_EXT_LAYER_6(il[518]) - , poseidon2_EXT_LAYER_7(il[519]) - , poseidon2_T_0_4(il[520]) - , poseidon2_T_0_5(il[521]) - , poseidon2_T_0_6(il[522]) - , poseidon2_T_0_7(il[523]) - , poseidon2_T_1_4(il[524]) - , poseidon2_T_1_5(il[525]) - , poseidon2_T_1_6(il[526]) - , poseidon2_T_1_7(il[527]) - , poseidon2_T_2_4(il[528]) - , poseidon2_T_2_5(il[529]) - , poseidon2_T_2_6(il[530]) - , poseidon2_T_2_7(il[531]) - , poseidon2_T_3_4(il[532]) - , poseidon2_T_3_5(il[533]) - , poseidon2_T_3_6(il[534]) - , poseidon2_T_3_7(il[535]) - , poseidon2_T_60_4(il[536]) - , poseidon2_T_60_5(il[537]) - , poseidon2_T_60_6(il[538]) - , poseidon2_T_60_7(il[539]) - , poseidon2_T_61_4(il[540]) - , poseidon2_T_61_5(il[541]) - , poseidon2_T_61_6(il[542]) - , poseidon2_T_61_7(il[543]) - , poseidon2_T_62_4(il[544]) - , poseidon2_T_62_5(il[545]) - , poseidon2_T_62_6(il[546]) - , poseidon2_T_62_7(il[547]) - , poseidon2_T_63_4(il[548]) - , poseidon2_T_63_5(il[549]) - , poseidon2_T_63_6(il[550]) - , poseidon2_T_63_7(il[551]) - , poseidon2_a_0(il[552]) - , poseidon2_a_1(il[553]) - , poseidon2_a_2(il[554]) - , poseidon2_a_3(il[555]) - , poseidon2_b_0(il[556]) - , poseidon2_b_1(il[557]) - , poseidon2_b_2(il[558]) - , poseidon2_b_3(il[559]) - , poseidon2_clk(il[560]) - , poseidon2_input_addr(il[561]) - , poseidon2_mem_addr_read_a(il[562]) - , poseidon2_mem_addr_read_b(il[563]) - , poseidon2_mem_addr_read_c(il[564]) - , poseidon2_mem_addr_read_d(il[565]) - , poseidon2_mem_addr_write_a(il[566]) - , poseidon2_mem_addr_write_b(il[567]) - , poseidon2_mem_addr_write_c(il[568]) - , poseidon2_mem_addr_write_d(il[569]) - , poseidon2_output_addr(il[570]) - , poseidon2_sel_poseidon_perm(il[571]) - , range_check_alu_rng_chk(il[572]) - , range_check_clk(il[573]) - , range_check_cmp_hi_bits_rng_chk(il[574]) - , range_check_cmp_lo_bits_rng_chk(il[575]) - , range_check_dyn_diff(il[576]) - , range_check_dyn_rng_chk_bits(il[577]) - , range_check_dyn_rng_chk_pow_2(il[578]) - , range_check_gas_da_rng_chk(il[579]) - , range_check_gas_l2_rng_chk(il[580]) - , range_check_is_lte_u112(il[581]) - , range_check_is_lte_u128(il[582]) - , range_check_is_lte_u16(il[583]) - , range_check_is_lte_u32(il[584]) - , range_check_is_lte_u48(il[585]) - , range_check_is_lte_u64(il[586]) - , range_check_is_lte_u80(il[587]) - , range_check_is_lte_u96(il[588]) - , range_check_mem_rng_chk(il[589]) - , range_check_rng_chk_bits(il[590]) - , range_check_sel_lookup_0(il[591]) - , range_check_sel_lookup_1(il[592]) - , range_check_sel_lookup_2(il[593]) - , range_check_sel_lookup_3(il[594]) - , range_check_sel_lookup_4(il[595]) - , range_check_sel_lookup_5(il[596]) - , range_check_sel_lookup_6(il[597]) - , range_check_sel_rng_chk(il[598]) - , range_check_u16_r0(il[599]) - , range_check_u16_r1(il[600]) - , range_check_u16_r2(il[601]) - , range_check_u16_r3(il[602]) - , range_check_u16_r4(il[603]) - , range_check_u16_r5(il[604]) - , range_check_u16_r6(il[605]) - , range_check_u16_r7(il[606]) - , range_check_value(il[607]) - , sha256_clk(il[608]) - , sha256_input(il[609]) - , sha256_output(il[610]) - , sha256_sel_sha256_compression(il[611]) - , sha256_state(il[612]) - , slice_addr(il[613]) - , slice_clk(il[614]) - , slice_cnt(il[615]) - , slice_col_offset(il[616]) - , slice_one_min_inv(il[617]) - , slice_sel_cd_cpy(il[618]) - , slice_sel_mem_active(il[619]) - , slice_sel_return(il[620]) - , slice_sel_start(il[621]) - , slice_space_id(il[622]) - , slice_val(il[623]) - , lookup_rng_chk_pow_2_counts(il[624]) - , lookup_rng_chk_diff_counts(il[625]) - , lookup_rng_chk_0_counts(il[626]) - , lookup_rng_chk_1_counts(il[627]) - , lookup_rng_chk_2_counts(il[628]) - , lookup_rng_chk_3_counts(il[629]) - , lookup_rng_chk_4_counts(il[630]) - , lookup_rng_chk_5_counts(il[631]) - , lookup_rng_chk_6_counts(il[632]) - , lookup_rng_chk_7_counts(il[633]) - , lookup_pow_2_0_counts(il[634]) - , lookup_pow_2_1_counts(il[635]) - , lookup_byte_lengths_counts(il[636]) - , lookup_byte_operations_counts(il[637]) - , lookup_opcode_gas_counts(il[638]) - , kernel_output_lookup_counts(il[639]) - , lookup_into_kernel_counts(il[640]) - , lookup_cd_value_counts(il[641]) - , lookup_ret_value_counts(il[642]) - , incl_main_tag_err_counts(il[643]) - , incl_mem_tag_err_counts(il[644]) - , perm_rng_mem_inv(il[645]) - , perm_rng_cmp_lo_inv(il[646]) - , perm_rng_cmp_hi_inv(il[647]) - , perm_rng_alu_inv(il[648]) - , perm_cmp_alu_inv(il[649]) - , perm_rng_gas_l2_inv(il[650]) - , perm_rng_gas_da_inv(il[651]) - , perm_pos_mem_read_a_inv(il[652]) - , perm_pos_mem_read_b_inv(il[653]) - , perm_pos_mem_read_c_inv(il[654]) - , perm_pos_mem_read_d_inv(il[655]) - , perm_pos_mem_write_a_inv(il[656]) - , perm_pos_mem_write_b_inv(il[657]) - , perm_pos_mem_write_c_inv(il[658]) - , perm_pos_mem_write_d_inv(il[659]) - , perm_slice_mem_inv(il[660]) - , perm_main_alu_inv(il[661]) - , perm_main_bin_inv(il[662]) - , perm_main_conv_inv(il[663]) - , perm_main_pos2_perm_inv(il[664]) - , perm_main_pedersen_inv(il[665]) - , perm_main_slice_inv(il[666]) - , perm_main_mem_a_inv(il[667]) - , perm_main_mem_b_inv(il[668]) - , perm_main_mem_c_inv(il[669]) - , perm_main_mem_d_inv(il[670]) - , perm_main_mem_ind_addr_a_inv(il[671]) - , perm_main_mem_ind_addr_b_inv(il[672]) - , perm_main_mem_ind_addr_c_inv(il[673]) - , perm_main_mem_ind_addr_d_inv(il[674]) - , lookup_rng_chk_pow_2_inv(il[675]) - , lookup_rng_chk_diff_inv(il[676]) - , lookup_rng_chk_0_inv(il[677]) - , lookup_rng_chk_1_inv(il[678]) - , lookup_rng_chk_2_inv(il[679]) - , lookup_rng_chk_3_inv(il[680]) - , lookup_rng_chk_4_inv(il[681]) - , lookup_rng_chk_5_inv(il[682]) - , lookup_rng_chk_6_inv(il[683]) - , lookup_rng_chk_7_inv(il[684]) - , lookup_pow_2_0_inv(il[685]) - , lookup_pow_2_1_inv(il[686]) - , lookup_byte_lengths_inv(il[687]) - , lookup_byte_operations_inv(il[688]) - , lookup_opcode_gas_inv(il[689]) - , kernel_output_lookup_inv(il[690]) - , lookup_into_kernel_inv(il[691]) - , lookup_cd_value_inv(il[692]) - , lookup_ret_value_inv(il[693]) - , incl_main_tag_err_inv(il[694]) - , incl_mem_tag_err_inv(il[695]) - , binary_acc_ia_shift(il[696]) - , binary_acc_ib_shift(il[697]) - , binary_acc_ic_shift(il[698]) - , binary_mem_tag_ctr_shift(il[699]) - , binary_op_id_shift(il[700]) - , cmp_a_hi_shift(il[701]) - , cmp_a_lo_shift(il[702]) - , cmp_b_hi_shift(il[703]) - , cmp_b_lo_shift(il[704]) - , cmp_cmp_rng_ctr_shift(il[705]) - , cmp_op_gt_shift(il[706]) - , cmp_p_sub_a_hi_shift(il[707]) - , cmp_p_sub_a_lo_shift(il[708]) - , cmp_p_sub_b_hi_shift(il[709]) - , cmp_p_sub_b_lo_shift(il[710]) - , cmp_sel_rng_chk_shift(il[711]) - , main_da_gas_remaining_shift(il[712]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[713]) - , main_emit_note_hash_write_offset_shift(il[714]) - , main_emit_nullifier_write_offset_shift(il[715]) - , main_emit_unencrypted_log_write_offset_shift(il[716]) - , main_internal_return_ptr_shift(il[717]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[718]) - , main_l2_gas_remaining_shift(il[719]) - , main_note_hash_exist_write_offset_shift(il[720]) - , main_nullifier_exists_write_offset_shift(il[721]) - , main_nullifier_non_exists_write_offset_shift(il[722]) - , main_pc_shift(il[723]) - , main_sel_execution_row_shift(il[724]) - , main_sload_write_offset_shift(il[725]) - , main_sstore_write_offset_shift(il[726]) - , mem_glob_addr_shift(il[727]) - , mem_rw_shift(il[728]) - , mem_sel_mem_shift(il[729]) - , mem_tag_shift(il[730]) - , mem_tsp_shift(il[731]) - , mem_val_shift(il[732]) - , slice_addr_shift(il[733]) - , slice_clk_shift(il[734]) - , slice_cnt_shift(il[735]) - , slice_col_offset_shift(il[736]) - , slice_sel_cd_cpy_shift(il[737]) - , slice_sel_mem_active_shift(il[738]) - , slice_sel_return_shift(il[739]) - , slice_sel_start_shift(il[740]) - , slice_space_id_shift(il[741]) + , main_sel_op_dagasleft(il[184]) + , main_sel_op_div(il[185]) + , main_sel_op_ecadd(il[186]) + , main_sel_op_emit_l2_to_l1_msg(il[187]) + , main_sel_op_emit_note_hash(il[188]) + , main_sel_op_emit_nullifier(il[189]) + , main_sel_op_emit_unencrypted_log(il[190]) + , main_sel_op_eq(il[191]) + , main_sel_op_external_call(il[192]) + , main_sel_op_external_return(il[193]) + , main_sel_op_external_revert(il[194]) + , main_sel_op_fdiv(il[195]) + , main_sel_op_fee_per_da_gas(il[196]) + , main_sel_op_fee_per_l2_gas(il[197]) + , main_sel_op_function_selector(il[198]) + , main_sel_op_get_contract_instance(il[199]) + , main_sel_op_internal_call(il[200]) + , main_sel_op_internal_return(il[201]) + , main_sel_op_jump(il[202]) + , main_sel_op_jumpi(il[203]) + , main_sel_op_keccak(il[204]) + , main_sel_op_l1_to_l2_msg_exists(il[205]) + , main_sel_op_l2gasleft(il[206]) + , main_sel_op_lt(il[207]) + , main_sel_op_lte(il[208]) + , main_sel_op_mov(il[209]) + , main_sel_op_msm(il[210]) + , main_sel_op_mul(il[211]) + , main_sel_op_not(il[212]) + , main_sel_op_note_hash_exists(il[213]) + , main_sel_op_nullifier_exists(il[214]) + , main_sel_op_or(il[215]) + , main_sel_op_pedersen(il[216]) + , main_sel_op_pedersen_commit(il[217]) + , main_sel_op_poseidon2(il[218]) + , main_sel_op_radix_le(il[219]) + , main_sel_op_sender(il[220]) + , main_sel_op_set(il[221]) + , main_sel_op_sha256(il[222]) + , main_sel_op_shl(il[223]) + , main_sel_op_shr(il[224]) + , main_sel_op_sload(il[225]) + , main_sel_op_sstore(il[226]) + , main_sel_op_storage_address(il[227]) + , main_sel_op_sub(il[228]) + , main_sel_op_timestamp(il[229]) + , main_sel_op_transaction_fee(il[230]) + , main_sel_op_version(il[231]) + , main_sel_op_xor(il[232]) + , main_sel_q_kernel_lookup(il[233]) + , main_sel_q_kernel_output_lookup(il[234]) + , main_sel_resolve_ind_addr_a(il[235]) + , main_sel_resolve_ind_addr_b(il[236]) + , main_sel_resolve_ind_addr_c(il[237]) + , main_sel_resolve_ind_addr_d(il[238]) + , main_sel_returndata(il[239]) + , main_sel_rng_16(il[240]) + , main_sel_rng_8(il[241]) + , main_sel_slice_gadget(il[242]) + , main_side_effect_counter(il[243]) + , main_sload_write_offset(il[244]) + , main_space_id(il[245]) + , main_sstore_write_offset(il[246]) + , main_tag_err(il[247]) + , main_w_in_tag(il[248]) + , mem_addr(il[249]) + , mem_clk(il[250]) + , mem_diff(il[251]) + , mem_glob_addr(il[252]) + , mem_last(il[253]) + , mem_lastAccess(il[254]) + , mem_one_min_inv(il[255]) + , mem_r_in_tag(il[256]) + , mem_rw(il[257]) + , mem_sel_mem(il[258]) + , mem_sel_mov_ia_to_ic(il[259]) + , mem_sel_mov_ib_to_ic(il[260]) + , mem_sel_op_a(il[261]) + , mem_sel_op_b(il[262]) + , mem_sel_op_c(il[263]) + , mem_sel_op_cmov(il[264]) + , mem_sel_op_d(il[265]) + , mem_sel_op_poseidon_read_a(il[266]) + , mem_sel_op_poseidon_read_b(il[267]) + , mem_sel_op_poseidon_read_c(il[268]) + , mem_sel_op_poseidon_read_d(il[269]) + , mem_sel_op_poseidon_write_a(il[270]) + , mem_sel_op_poseidon_write_b(il[271]) + , mem_sel_op_poseidon_write_c(il[272]) + , mem_sel_op_poseidon_write_d(il[273]) + , mem_sel_op_slice(il[274]) + , mem_sel_resolve_ind_addr_a(il[275]) + , mem_sel_resolve_ind_addr_b(il[276]) + , mem_sel_resolve_ind_addr_c(il[277]) + , mem_sel_resolve_ind_addr_d(il[278]) + , mem_sel_rng_chk(il[279]) + , mem_skip_check_tag(il[280]) + , mem_space_id(il[281]) + , mem_tag(il[282]) + , mem_tag_err(il[283]) + , mem_tsp(il[284]) + , mem_val(il[285]) + , mem_w_in_tag(il[286]) + , pedersen_clk(il[287]) + , pedersen_input(il[288]) + , pedersen_output(il[289]) + , pedersen_sel_pedersen(il[290]) + , poseidon2_B_10_0(il[291]) + , poseidon2_B_10_1(il[292]) + , poseidon2_B_10_2(il[293]) + , poseidon2_B_10_3(il[294]) + , poseidon2_B_11_0(il[295]) + , poseidon2_B_11_1(il[296]) + , poseidon2_B_11_2(il[297]) + , poseidon2_B_11_3(il[298]) + , poseidon2_B_12_0(il[299]) + , poseidon2_B_12_1(il[300]) + , poseidon2_B_12_2(il[301]) + , poseidon2_B_12_3(il[302]) + , poseidon2_B_13_0(il[303]) + , poseidon2_B_13_1(il[304]) + , poseidon2_B_13_2(il[305]) + , poseidon2_B_13_3(il[306]) + , poseidon2_B_14_0(il[307]) + , poseidon2_B_14_1(il[308]) + , poseidon2_B_14_2(il[309]) + , poseidon2_B_14_3(il[310]) + , poseidon2_B_15_0(il[311]) + , poseidon2_B_15_1(il[312]) + , poseidon2_B_15_2(il[313]) + , poseidon2_B_15_3(il[314]) + , poseidon2_B_16_0(il[315]) + , poseidon2_B_16_1(il[316]) + , poseidon2_B_16_2(il[317]) + , poseidon2_B_16_3(il[318]) + , poseidon2_B_17_0(il[319]) + , poseidon2_B_17_1(il[320]) + , poseidon2_B_17_2(il[321]) + , poseidon2_B_17_3(il[322]) + , poseidon2_B_18_0(il[323]) + , poseidon2_B_18_1(il[324]) + , poseidon2_B_18_2(il[325]) + , poseidon2_B_18_3(il[326]) + , poseidon2_B_19_0(il[327]) + , poseidon2_B_19_1(il[328]) + , poseidon2_B_19_2(il[329]) + , poseidon2_B_19_3(il[330]) + , poseidon2_B_20_0(il[331]) + , poseidon2_B_20_1(il[332]) + , poseidon2_B_20_2(il[333]) + , poseidon2_B_20_3(il[334]) + , poseidon2_B_21_0(il[335]) + , poseidon2_B_21_1(il[336]) + , poseidon2_B_21_2(il[337]) + , poseidon2_B_21_3(il[338]) + , poseidon2_B_22_0(il[339]) + , poseidon2_B_22_1(il[340]) + , poseidon2_B_22_2(il[341]) + , poseidon2_B_22_3(il[342]) + , poseidon2_B_23_0(il[343]) + , poseidon2_B_23_1(il[344]) + , poseidon2_B_23_2(il[345]) + , poseidon2_B_23_3(il[346]) + , poseidon2_B_24_0(il[347]) + , poseidon2_B_24_1(il[348]) + , poseidon2_B_24_2(il[349]) + , poseidon2_B_24_3(il[350]) + , poseidon2_B_25_0(il[351]) + , poseidon2_B_25_1(il[352]) + , poseidon2_B_25_2(il[353]) + , poseidon2_B_25_3(il[354]) + , poseidon2_B_26_0(il[355]) + , poseidon2_B_26_1(il[356]) + , poseidon2_B_26_2(il[357]) + , poseidon2_B_26_3(il[358]) + , poseidon2_B_27_0(il[359]) + , poseidon2_B_27_1(il[360]) + , poseidon2_B_27_2(il[361]) + , poseidon2_B_27_3(il[362]) + , poseidon2_B_28_0(il[363]) + , poseidon2_B_28_1(il[364]) + , poseidon2_B_28_2(il[365]) + , poseidon2_B_28_3(il[366]) + , poseidon2_B_29_0(il[367]) + , poseidon2_B_29_1(il[368]) + , poseidon2_B_29_2(il[369]) + , poseidon2_B_29_3(il[370]) + , poseidon2_B_30_0(il[371]) + , poseidon2_B_30_1(il[372]) + , poseidon2_B_30_2(il[373]) + , poseidon2_B_30_3(il[374]) + , poseidon2_B_31_0(il[375]) + , poseidon2_B_31_1(il[376]) + , poseidon2_B_31_2(il[377]) + , poseidon2_B_31_3(il[378]) + , poseidon2_B_32_0(il[379]) + , poseidon2_B_32_1(il[380]) + , poseidon2_B_32_2(il[381]) + , poseidon2_B_32_3(il[382]) + , poseidon2_B_33_0(il[383]) + , poseidon2_B_33_1(il[384]) + , poseidon2_B_33_2(il[385]) + , poseidon2_B_33_3(il[386]) + , poseidon2_B_34_0(il[387]) + , poseidon2_B_34_1(il[388]) + , poseidon2_B_34_2(il[389]) + , poseidon2_B_34_3(il[390]) + , poseidon2_B_35_0(il[391]) + , poseidon2_B_35_1(il[392]) + , poseidon2_B_35_2(il[393]) + , poseidon2_B_35_3(il[394]) + , poseidon2_B_36_0(il[395]) + , poseidon2_B_36_1(il[396]) + , poseidon2_B_36_2(il[397]) + , poseidon2_B_36_3(il[398]) + , poseidon2_B_37_0(il[399]) + , poseidon2_B_37_1(il[400]) + , poseidon2_B_37_2(il[401]) + , poseidon2_B_37_3(il[402]) + , poseidon2_B_38_0(il[403]) + , poseidon2_B_38_1(il[404]) + , poseidon2_B_38_2(il[405]) + , poseidon2_B_38_3(il[406]) + , poseidon2_B_39_0(il[407]) + , poseidon2_B_39_1(il[408]) + , poseidon2_B_39_2(il[409]) + , poseidon2_B_39_3(il[410]) + , poseidon2_B_40_0(il[411]) + , poseidon2_B_40_1(il[412]) + , poseidon2_B_40_2(il[413]) + , poseidon2_B_40_3(il[414]) + , poseidon2_B_41_0(il[415]) + , poseidon2_B_41_1(il[416]) + , poseidon2_B_41_2(il[417]) + , poseidon2_B_41_3(il[418]) + , poseidon2_B_42_0(il[419]) + , poseidon2_B_42_1(il[420]) + , poseidon2_B_42_2(il[421]) + , poseidon2_B_42_3(il[422]) + , poseidon2_B_43_0(il[423]) + , poseidon2_B_43_1(il[424]) + , poseidon2_B_43_2(il[425]) + , poseidon2_B_43_3(il[426]) + , poseidon2_B_44_0(il[427]) + , poseidon2_B_44_1(il[428]) + , poseidon2_B_44_2(il[429]) + , poseidon2_B_44_3(il[430]) + , poseidon2_B_45_0(il[431]) + , poseidon2_B_45_1(il[432]) + , poseidon2_B_45_2(il[433]) + , poseidon2_B_45_3(il[434]) + , poseidon2_B_46_0(il[435]) + , poseidon2_B_46_1(il[436]) + , poseidon2_B_46_2(il[437]) + , poseidon2_B_46_3(il[438]) + , poseidon2_B_47_0(il[439]) + , poseidon2_B_47_1(il[440]) + , poseidon2_B_47_2(il[441]) + , poseidon2_B_47_3(il[442]) + , poseidon2_B_48_0(il[443]) + , poseidon2_B_48_1(il[444]) + , poseidon2_B_48_2(il[445]) + , poseidon2_B_48_3(il[446]) + , poseidon2_B_49_0(il[447]) + , poseidon2_B_49_1(il[448]) + , poseidon2_B_49_2(il[449]) + , poseidon2_B_49_3(il[450]) + , poseidon2_B_4_0(il[451]) + , poseidon2_B_4_1(il[452]) + , poseidon2_B_4_2(il[453]) + , poseidon2_B_4_3(il[454]) + , poseidon2_B_50_0(il[455]) + , poseidon2_B_50_1(il[456]) + , poseidon2_B_50_2(il[457]) + , poseidon2_B_50_3(il[458]) + , poseidon2_B_51_0(il[459]) + , poseidon2_B_51_1(il[460]) + , poseidon2_B_51_2(il[461]) + , poseidon2_B_51_3(il[462]) + , poseidon2_B_52_0(il[463]) + , poseidon2_B_52_1(il[464]) + , poseidon2_B_52_2(il[465]) + , poseidon2_B_52_3(il[466]) + , poseidon2_B_53_0(il[467]) + , poseidon2_B_53_1(il[468]) + , poseidon2_B_53_2(il[469]) + , poseidon2_B_53_3(il[470]) + , poseidon2_B_54_0(il[471]) + , poseidon2_B_54_1(il[472]) + , poseidon2_B_54_2(il[473]) + , poseidon2_B_54_3(il[474]) + , poseidon2_B_55_0(il[475]) + , poseidon2_B_55_1(il[476]) + , poseidon2_B_55_2(il[477]) + , poseidon2_B_55_3(il[478]) + , poseidon2_B_56_0(il[479]) + , poseidon2_B_56_1(il[480]) + , poseidon2_B_56_2(il[481]) + , poseidon2_B_56_3(il[482]) + , poseidon2_B_57_0(il[483]) + , poseidon2_B_57_1(il[484]) + , poseidon2_B_57_2(il[485]) + , poseidon2_B_57_3(il[486]) + , poseidon2_B_58_0(il[487]) + , poseidon2_B_58_1(il[488]) + , poseidon2_B_58_2(il[489]) + , poseidon2_B_58_3(il[490]) + , poseidon2_B_59_0(il[491]) + , poseidon2_B_59_1(il[492]) + , poseidon2_B_59_2(il[493]) + , poseidon2_B_59_3(il[494]) + , poseidon2_B_5_0(il[495]) + , poseidon2_B_5_1(il[496]) + , poseidon2_B_5_2(il[497]) + , poseidon2_B_5_3(il[498]) + , poseidon2_B_6_0(il[499]) + , poseidon2_B_6_1(il[500]) + , poseidon2_B_6_2(il[501]) + , poseidon2_B_6_3(il[502]) + , poseidon2_B_7_0(il[503]) + , poseidon2_B_7_1(il[504]) + , poseidon2_B_7_2(il[505]) + , poseidon2_B_7_3(il[506]) + , poseidon2_B_8_0(il[507]) + , poseidon2_B_8_1(il[508]) + , poseidon2_B_8_2(il[509]) + , poseidon2_B_8_3(il[510]) + , poseidon2_B_9_0(il[511]) + , poseidon2_B_9_1(il[512]) + , poseidon2_B_9_2(il[513]) + , poseidon2_B_9_3(il[514]) + , poseidon2_EXT_LAYER_4(il[515]) + , poseidon2_EXT_LAYER_5(il[516]) + , poseidon2_EXT_LAYER_6(il[517]) + , poseidon2_EXT_LAYER_7(il[518]) + , poseidon2_T_0_4(il[519]) + , poseidon2_T_0_5(il[520]) + , poseidon2_T_0_6(il[521]) + , poseidon2_T_0_7(il[522]) + , poseidon2_T_1_4(il[523]) + , poseidon2_T_1_5(il[524]) + , poseidon2_T_1_6(il[525]) + , poseidon2_T_1_7(il[526]) + , poseidon2_T_2_4(il[527]) + , poseidon2_T_2_5(il[528]) + , poseidon2_T_2_6(il[529]) + , poseidon2_T_2_7(il[530]) + , poseidon2_T_3_4(il[531]) + , poseidon2_T_3_5(il[532]) + , poseidon2_T_3_6(il[533]) + , poseidon2_T_3_7(il[534]) + , poseidon2_T_60_4(il[535]) + , poseidon2_T_60_5(il[536]) + , poseidon2_T_60_6(il[537]) + , poseidon2_T_60_7(il[538]) + , poseidon2_T_61_4(il[539]) + , poseidon2_T_61_5(il[540]) + , poseidon2_T_61_6(il[541]) + , poseidon2_T_61_7(il[542]) + , poseidon2_T_62_4(il[543]) + , poseidon2_T_62_5(il[544]) + , poseidon2_T_62_6(il[545]) + , poseidon2_T_62_7(il[546]) + , poseidon2_T_63_4(il[547]) + , poseidon2_T_63_5(il[548]) + , poseidon2_T_63_6(il[549]) + , poseidon2_T_63_7(il[550]) + , poseidon2_a_0(il[551]) + , poseidon2_a_1(il[552]) + , poseidon2_a_2(il[553]) + , poseidon2_a_3(il[554]) + , poseidon2_b_0(il[555]) + , poseidon2_b_1(il[556]) + , poseidon2_b_2(il[557]) + , poseidon2_b_3(il[558]) + , poseidon2_clk(il[559]) + , poseidon2_input_addr(il[560]) + , poseidon2_mem_addr_read_a(il[561]) + , poseidon2_mem_addr_read_b(il[562]) + , poseidon2_mem_addr_read_c(il[563]) + , poseidon2_mem_addr_read_d(il[564]) + , poseidon2_mem_addr_write_a(il[565]) + , poseidon2_mem_addr_write_b(il[566]) + , poseidon2_mem_addr_write_c(il[567]) + , poseidon2_mem_addr_write_d(il[568]) + , poseidon2_output_addr(il[569]) + , poseidon2_sel_poseidon_perm(il[570]) + , range_check_alu_rng_chk(il[571]) + , range_check_clk(il[572]) + , range_check_cmp_hi_bits_rng_chk(il[573]) + , range_check_cmp_lo_bits_rng_chk(il[574]) + , range_check_dyn_diff(il[575]) + , range_check_dyn_rng_chk_bits(il[576]) + , range_check_dyn_rng_chk_pow_2(il[577]) + , range_check_gas_da_rng_chk(il[578]) + , range_check_gas_l2_rng_chk(il[579]) + , range_check_is_lte_u112(il[580]) + , range_check_is_lte_u128(il[581]) + , range_check_is_lte_u16(il[582]) + , range_check_is_lte_u32(il[583]) + , range_check_is_lte_u48(il[584]) + , range_check_is_lte_u64(il[585]) + , range_check_is_lte_u80(il[586]) + , range_check_is_lte_u96(il[587]) + , range_check_mem_rng_chk(il[588]) + , range_check_rng_chk_bits(il[589]) + , range_check_sel_lookup_0(il[590]) + , range_check_sel_lookup_1(il[591]) + , range_check_sel_lookup_2(il[592]) + , range_check_sel_lookup_3(il[593]) + , range_check_sel_lookup_4(il[594]) + , range_check_sel_lookup_5(il[595]) + , range_check_sel_lookup_6(il[596]) + , range_check_sel_rng_chk(il[597]) + , range_check_u16_r0(il[598]) + , range_check_u16_r1(il[599]) + , range_check_u16_r2(il[600]) + , range_check_u16_r3(il[601]) + , range_check_u16_r4(il[602]) + , range_check_u16_r5(il[603]) + , range_check_u16_r6(il[604]) + , range_check_u16_r7(il[605]) + , range_check_value(il[606]) + , sha256_clk(il[607]) + , sha256_input(il[608]) + , sha256_output(il[609]) + , sha256_sel_sha256_compression(il[610]) + , sha256_state(il[611]) + , slice_addr(il[612]) + , slice_clk(il[613]) + , slice_cnt(il[614]) + , slice_col_offset(il[615]) + , slice_one_min_inv(il[616]) + , slice_sel_cd_cpy(il[617]) + , slice_sel_mem_active(il[618]) + , slice_sel_return(il[619]) + , slice_sel_start(il[620]) + , slice_space_id(il[621]) + , slice_val(il[622]) + , lookup_rng_chk_pow_2_counts(il[623]) + , lookup_rng_chk_diff_counts(il[624]) + , lookup_rng_chk_0_counts(il[625]) + , lookup_rng_chk_1_counts(il[626]) + , lookup_rng_chk_2_counts(il[627]) + , lookup_rng_chk_3_counts(il[628]) + , lookup_rng_chk_4_counts(il[629]) + , lookup_rng_chk_5_counts(il[630]) + , lookup_rng_chk_6_counts(il[631]) + , lookup_rng_chk_7_counts(il[632]) + , lookup_pow_2_0_counts(il[633]) + , lookup_pow_2_1_counts(il[634]) + , lookup_byte_lengths_counts(il[635]) + , lookup_byte_operations_counts(il[636]) + , lookup_opcode_gas_counts(il[637]) + , kernel_output_lookup_counts(il[638]) + , lookup_into_kernel_counts(il[639]) + , lookup_cd_value_counts(il[640]) + , lookup_ret_value_counts(il[641]) + , incl_main_tag_err_counts(il[642]) + , incl_mem_tag_err_counts(il[643]) + , perm_rng_mem_inv(il[644]) + , perm_rng_cmp_lo_inv(il[645]) + , perm_rng_cmp_hi_inv(il[646]) + , perm_rng_alu_inv(il[647]) + , perm_cmp_alu_inv(il[648]) + , perm_rng_gas_l2_inv(il[649]) + , perm_rng_gas_da_inv(il[650]) + , perm_pos_mem_read_a_inv(il[651]) + , perm_pos_mem_read_b_inv(il[652]) + , perm_pos_mem_read_c_inv(il[653]) + , perm_pos_mem_read_d_inv(il[654]) + , perm_pos_mem_write_a_inv(il[655]) + , perm_pos_mem_write_b_inv(il[656]) + , perm_pos_mem_write_c_inv(il[657]) + , perm_pos_mem_write_d_inv(il[658]) + , perm_slice_mem_inv(il[659]) + , perm_main_alu_inv(il[660]) + , perm_main_bin_inv(il[661]) + , perm_main_conv_inv(il[662]) + , perm_main_pos2_perm_inv(il[663]) + , perm_main_pedersen_inv(il[664]) + , perm_main_slice_inv(il[665]) + , perm_main_mem_a_inv(il[666]) + , perm_main_mem_b_inv(il[667]) + , perm_main_mem_c_inv(il[668]) + , perm_main_mem_d_inv(il[669]) + , perm_main_mem_ind_addr_a_inv(il[670]) + , perm_main_mem_ind_addr_b_inv(il[671]) + , perm_main_mem_ind_addr_c_inv(il[672]) + , perm_main_mem_ind_addr_d_inv(il[673]) + , lookup_rng_chk_pow_2_inv(il[674]) + , lookup_rng_chk_diff_inv(il[675]) + , lookup_rng_chk_0_inv(il[676]) + , lookup_rng_chk_1_inv(il[677]) + , lookup_rng_chk_2_inv(il[678]) + , lookup_rng_chk_3_inv(il[679]) + , lookup_rng_chk_4_inv(il[680]) + , lookup_rng_chk_5_inv(il[681]) + , lookup_rng_chk_6_inv(il[682]) + , lookup_rng_chk_7_inv(il[683]) + , lookup_pow_2_0_inv(il[684]) + , lookup_pow_2_1_inv(il[685]) + , lookup_byte_lengths_inv(il[686]) + , lookup_byte_operations_inv(il[687]) + , lookup_opcode_gas_inv(il[688]) + , kernel_output_lookup_inv(il[689]) + , lookup_into_kernel_inv(il[690]) + , lookup_cd_value_inv(il[691]) + , lookup_ret_value_inv(il[692]) + , incl_main_tag_err_inv(il[693]) + , incl_mem_tag_err_inv(il[694]) + , binary_acc_ia_shift(il[695]) + , binary_acc_ib_shift(il[696]) + , binary_acc_ic_shift(il[697]) + , binary_mem_tag_ctr_shift(il[698]) + , binary_op_id_shift(il[699]) + , cmp_a_hi_shift(il[700]) + , cmp_a_lo_shift(il[701]) + , cmp_b_hi_shift(il[702]) + , cmp_b_lo_shift(il[703]) + , cmp_cmp_rng_ctr_shift(il[704]) + , cmp_op_gt_shift(il[705]) + , cmp_p_sub_a_hi_shift(il[706]) + , cmp_p_sub_a_lo_shift(il[707]) + , cmp_p_sub_b_hi_shift(il[708]) + , cmp_p_sub_b_lo_shift(il[709]) + , cmp_sel_rng_chk_shift(il[710]) + , main_da_gas_remaining_shift(il[711]) + , main_emit_l2_to_l1_msg_write_offset_shift(il[712]) + , main_emit_note_hash_write_offset_shift(il[713]) + , main_emit_nullifier_write_offset_shift(il[714]) + , main_emit_unencrypted_log_write_offset_shift(il[715]) + , main_internal_return_ptr_shift(il[716]) + , main_l1_to_l2_msg_exists_write_offset_shift(il[717]) + , main_l2_gas_remaining_shift(il[718]) + , main_note_hash_exist_write_offset_shift(il[719]) + , main_nullifier_exists_write_offset_shift(il[720]) + , main_nullifier_non_exists_write_offset_shift(il[721]) + , main_pc_shift(il[722]) + , main_sel_execution_row_shift(il[723]) + , main_sload_write_offset_shift(il[724]) + , main_sstore_write_offset_shift(il[725]) + , mem_glob_addr_shift(il[726]) + , mem_rw_shift(il[727]) + , mem_sel_mem_shift(il[728]) + , mem_tag_shift(il[729]) + , mem_tsp_shift(il[730]) + , mem_val_shift(il[731]) + , slice_addr_shift(il[732]) + , slice_clk_shift(il[733]) + , slice_cnt_shift(il[734]) + , slice_col_offset_shift(il[735]) + , slice_sel_cd_cpy_shift(il[736]) + , slice_sel_mem_active_shift(il[737]) + , slice_sel_return_shift(il[738]) + , slice_sel_start_shift(il[739]) + , slice_space_id_shift(il[740]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -947,7 +946,6 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id 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_ecadd[row_idx], @@ -1693,7 +1691,6 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() 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_ecadd = "MAIN_SEL_OP_ECADD"; @@ -2286,4 +2283,20 @@ AvmFlavor::ProvingKey::ProvingKey(const size_t circuit_size, const size_t num_pu } }; +/** + * @brief Serialize verification key to field elements + * + * @return std::vector + */ +std::vector AvmFlavor::VerificationKey::to_field_elements() const +{ + std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; + + for (auto const& comm : get_all()) { + std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); + elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); + } + return elements; +} + } // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index d2bce4ef8a3..7d3cabeeca8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -89,7 +89,7 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // The entities that will be used in the flavor. // clang-format off #define PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_base_da_gas_fixed_table, gas_base_l2_gas_fixed_table, gas_dyn_da_gas_fixed_table, gas_dyn_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_first, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_mem_rng_chk, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts +#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_mem_rng_chk, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts #define DERIVED_WITNESS_ENTITIES perm_rng_mem_inv, perm_rng_cmp_lo_inv, perm_rng_cmp_hi_inv, perm_rng_alu_inv, perm_cmp_alu_inv, perm_rng_gas_l2_inv, perm_rng_gas_da_inv, perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_rng_chk_pow_2_inv, lookup_rng_chk_diff_inv, lookup_rng_chk_0_inv, lookup_rng_chk_1_inv, lookup_rng_chk_2_inv, lookup_rng_chk_3_inv, lookup_rng_chk_4_inv, lookup_rng_chk_5_inv, lookup_rng_chk_6_inv, lookup_rng_chk_7_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, lookup_cd_value_inv, lookup_ret_value_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv #define SHIFTED_ENTITIES binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, cmp_a_hi_shift, cmp_a_lo_shift, cmp_b_hi_shift, cmp_b_lo_shift, cmp_cmp_rng_ctr_shift, cmp_op_gt_shift, cmp_p_sub_a_hi_shift, cmp_p_sub_a_lo_shift, cmp_p_sub_b_hi_shift, cmp_p_sub_b_lo_shift, cmp_sel_rng_chk_shift, main_da_gas_remaining_shift, main_emit_l2_to_l1_msg_write_offset_shift, main_emit_note_hash_write_offset_shift, main_emit_nullifier_write_offset_shift, main_emit_unencrypted_log_write_offset_shift, main_internal_return_ptr_shift, main_l1_to_l2_msg_exists_write_offset_shift, main_l2_gas_remaining_shift, main_note_hash_exist_write_offset_shift, main_nullifier_exists_write_offset_shift, main_nullifier_non_exists_write_offset_shift, main_pc_shift, main_sel_execution_row_shift, main_sload_write_offset_shift, main_sstore_write_offset_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift #define TO_BE_SHIFTED(e) e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.cmp_a_hi, e.cmp_a_lo, e.cmp_b_hi, e.cmp_b_lo, e.cmp_cmp_rng_ctr, e.cmp_op_gt, e.cmp_p_sub_a_hi, e.cmp_p_sub_a_lo, e.cmp_p_sub_b_hi, e.cmp_p_sub_b_lo, e.cmp_sel_rng_chk, e.main_da_gas_remaining, e.main_emit_l2_to_l1_msg_write_offset, e.main_emit_note_hash_write_offset, e.main_emit_nullifier_write_offset, e.main_emit_unencrypted_log_write_offset, e.main_internal_return_ptr, e.main_l1_to_l2_msg_exists_write_offset, e.main_l2_gas_remaining, e.main_note_hash_exist_write_offset, e.main_nullifier_exists_write_offset, e.main_nullifier_non_exists_write_offset, e.main_pc, e.main_sel_execution_row, e.main_sload_write_offset, e.main_sstore_write_offset, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id @@ -118,12 +118,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 16; - static constexpr size_t NUM_WITNESS_ENTITIES = 680; + static constexpr size_t NUM_WITNESS_ENTITIES = 679; static constexpr size_t NUM_SHIFTED_ENTITIES = 46; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 742; + static constexpr size_t NUM_ALL_ENTITIES = 741; // The total number of witnesses including shifts and derived entities. static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; @@ -315,6 +315,8 @@ class AvmFlavor { class VerificationKey : public VerificationKey_, VerifierCommitmentKey> { public: + using FF = VerificationKey_::FF; + VerificationKey() = default; VerificationKey(const std::shared_ptr& proving_key) @@ -338,23 +340,7 @@ class AvmFlavor { pcs_verification_key = std::make_shared(); } - // Override FF alias in VerificationKey_ - using FF = AvmFlavor::FF; - /** - * @brief Serialize verification key to field elements - * - * @return std::vector - */ - std::vector to_field_elements() const - { - std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; - - for (auto const& comm : get_all()) { - std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); - elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); - } - return elements; - } + std::vector to_field_elements() const; }; class AllValues : public AllEntities { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index 01ac46e02d8..1f465d4098c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -203,7 +203,6 @@ template std::vector AvmFullRow::names() "main_sel_op_cast", "main_sel_op_chain_id", "main_sel_op_cmov", - "main_sel_op_coinbase", "main_sel_op_dagasleft", "main_sel_op_div", "main_sel_op_ecadd", @@ -904,7 +903,6 @@ template RefVector AvmFullRow::as_vector() const main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, - main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index bf958cce1b4..c4bbe015e9c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -194,7 +194,6 @@ template struct AvmFullRow { FF main_sel_op_cast{}; FF main_sel_op_chain_id{}; FF main_sel_op_cmov{}; - FF main_sel_op_coinbase{}; FF main_sel_op_dagasleft{}; FF main_sel_op_div{}; FF main_sel_op_ecadd{}; @@ -710,7 +709,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 696; + static constexpr size_t SIZE = 695; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp index 4ac010e7171..1542c964bff 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/kernel.hpp @@ -10,9 +10,9 @@ template class kernelImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; template void static accumulate(ContainerOverSubrelations& evals, @@ -28,7 +28,6 @@ template class kernelImpl { const auto constants_VERSION_SELECTOR = FF(30); const auto constants_BLOCK_NUMBER_SELECTOR = FF(31); const auto constants_TIMESTAMP_SELECTOR = FF(33); - const auto constants_COINBASE_SELECTOR = FF(34); const auto constants_FEE_PER_DA_GAS_SELECTOR = FF(36); const auto constants_FEE_PER_L2_GAS_SELECTOR = FF(37); const auto constants_TRANSACTION_FEE_SELECTOR = FF(41); @@ -43,14 +42,13 @@ template class kernelImpl { const auto constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET = FF(160); const auto constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET = FF(162); const auto main_KERNEL_INPUT_SELECTORS = - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + + ((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + + new_term.main_sel_op_sender) + + new_term.main_sel_op_function_selector) + + new_term.main_sel_op_transaction_fee) + + new_term.main_sel_op_chain_id) + + new_term.main_sel_op_version) + + new_term.main_sel_op_block_number) + new_term.main_sel_op_timestamp) + new_term.main_sel_op_fee_per_l2_gas) + new_term.main_sel_op_fee_per_da_gas); @@ -208,54 +206,48 @@ template class kernelImpl { } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (new_term.main_kernel_in_offset - constants_COINBASE_SELECTOR)); - tmp *= scaling_factor; - std::get<19>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_fee_per_da_gas * (new_term.main_kernel_in_offset - constants_FEE_PER_DA_GAS_SELECTOR)); tmp *= scaling_factor; - std::get<20>(evals) += typename Accumulator::View(tmp); + std::get<19>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (new_term.main_kernel_in_offset - constants_FEE_PER_L2_GAS_SELECTOR)); tmp *= scaling_factor; - std::get<21>(evals) += typename Accumulator::View(tmp); + std::get<20>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_note_hash_exists * (new_term.main_kernel_out_offset - (constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET + new_term.main_note_hash_exist_write_offset))); tmp *= scaling_factor; - std::get<22>(evals) += typename Accumulator::View(tmp); + std::get<21>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_note_hash_exist_write_offset); tmp *= scaling_factor; - std::get<23>(evals) += typename Accumulator::View(tmp); + std::get<22>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_note_hash * (new_term.main_kernel_out_offset - (constants_START_EMIT_NOTE_HASH_WRITE_OFFSET + new_term.main_emit_note_hash_write_offset))); tmp *= scaling_factor; - std::get<24>(evals) += typename Accumulator::View(tmp); + std::get<23>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_note_hash_write_offset); tmp *= scaling_factor; - std::get<25>(evals) += typename Accumulator::View(tmp); + std::get<24>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_nullifier_exists * (new_term.main_kernel_out_offset - ((new_term.main_ib * @@ -263,115 +255,115 @@ template class kernelImpl { ((FF(1) - new_term.main_ib) * (constants_START_NULLIFIER_NON_EXISTS_OFFSET + new_term.main_nullifier_non_exists_write_offset))))); tmp *= scaling_factor; - std::get<26>(evals) += typename Accumulator::View(tmp); + std::get<25>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_nullifier_exists_write_offset); tmp *= scaling_factor; - std::get<27>(evals) += typename Accumulator::View(tmp); + std::get<26>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_nullifier_non_exists_write_offset); tmp *= scaling_factor; - std::get<28>(evals) += typename Accumulator::View(tmp); + std::get<27>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_nullifier * (new_term.main_kernel_out_offset - (constants_START_EMIT_NULLIFIER_WRITE_OFFSET + new_term.main_emit_nullifier_write_offset))); tmp *= scaling_factor; - std::get<29>(evals) += typename Accumulator::View(tmp); + std::get<28>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_nullifier_write_offset); tmp *= scaling_factor; - std::get<30>(evals) += typename Accumulator::View(tmp); + std::get<29>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (new_term.main_kernel_out_offset - (constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + new_term.main_l1_to_l2_msg_exists_write_offset))); tmp *= scaling_factor; - std::get<31>(evals) += typename Accumulator::View(tmp); + std::get<30>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_l1_to_l2_msg_exists_write_offset); tmp *= scaling_factor; - std::get<32>(evals) += typename Accumulator::View(tmp); + std::get<31>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_unencrypted_log * (new_term.main_kernel_out_offset - (constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET + new_term.main_emit_unencrypted_log_write_offset))); tmp *= scaling_factor; - std::get<33>(evals) += typename Accumulator::View(tmp); + std::get<32>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_unencrypted_log_write_offset); tmp *= scaling_factor; - std::get<34>(evals) += typename Accumulator::View(tmp); + std::get<33>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (new_term.main_kernel_out_offset - (constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + new_term.main_emit_l2_to_l1_msg_write_offset))); tmp *= scaling_factor; - std::get<35>(evals) += typename Accumulator::View(tmp); + std::get<34>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_emit_l2_to_l1_msg_write_offset); tmp *= scaling_factor; - std::get<36>(evals) += typename Accumulator::View(tmp); + std::get<35>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_sload * (new_term.main_kernel_out_offset - (constants_START_SLOAD_WRITE_OFFSET + new_term.main_sload_write_offset))); tmp *= scaling_factor; - std::get<37>(evals) += typename Accumulator::View(tmp); + std::get<36>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_sload_write_offset); tmp *= scaling_factor; - std::get<38>(evals) += typename Accumulator::View(tmp); + std::get<37>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_sstore * (new_term.main_kernel_out_offset - (constants_START_SSTORE_WRITE_OFFSET + new_term.main_sstore_write_offset))); tmp *= scaling_factor; - std::get<39>(evals) += typename Accumulator::View(tmp); + std::get<38>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_first * new_term.main_sstore_write_offset); tmp *= scaling_factor; - std::get<40>(evals) += typename Accumulator::View(tmp); + std::get<39>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; auto tmp = (main_KERNEL_INPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_lookup)); tmp *= scaling_factor; - std::get<41>(evals) += typename Accumulator::View(tmp); + std::get<40>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_output_lookup)); tmp *= scaling_factor; - std::get<42>(evals) += typename Accumulator::View(tmp); + std::get<41>(evals) += typename Accumulator::View(tmp); } } }; @@ -422,32 +414,30 @@ template class kernel : public Relation> { case 18: return "TIMESTAMP_KERNEL"; case 19: - return "COINBASE_KERNEL"; - case 20: return "FEE_DA_GAS_KERNEL"; - case 21: + case 20: return "FEE_L2_GAS_KERNEL"; - case 22: + case 21: return "NOTE_HASH_KERNEL_OUTPUT"; - case 24: + case 23: return "EMIT_NOTE_HASH_KERNEL_OUTPUT"; - case 26: + case 25: return "NULLIFIER_EXISTS_KERNEL_OUTPUT"; - case 29: + case 28: return "EMIT_NULLIFIER_KERNEL_OUTPUT"; - case 31: + case 30: return "L1_TO_L2_MSG_EXISTS_KERNEL_OUTPUT"; - case 33: + case 32: return "EMIT_UNENCRYPTED_LOG_KERNEL_OUTPUT"; - case 35: + case 34: return "EMIT_L2_TO_L1_MSGS_KERNEL_OUTPUT"; - case 37: + case 36: return "SLOAD_KERNEL_OUTPUT"; - case 39: + case 38: return "SSTORE_KERNEL_OUTPUT"; - case 41: + case 40: return "KERNEL_INPUT_ACTIVE_CHECK"; - case 42: + case 41: return "KERNEL_OUTPUT_ACTIVE_CHECK"; } return std::to_string(index); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index 0c62e3d4004..146bb6d1bc2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -10,11 +10,11 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 }; template @@ -25,14 +25,13 @@ template class mainImpl { { const auto constants_misc_INTERNAL_CALL_SPACE_ID = FF(255); const auto main_KERNEL_INPUT_SELECTORS = - (((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + - new_term.main_sel_op_sender) + - new_term.main_sel_op_function_selector) + - new_term.main_sel_op_transaction_fee) + - new_term.main_sel_op_chain_id) + - new_term.main_sel_op_version) + - new_term.main_sel_op_block_number) + - new_term.main_sel_op_coinbase) + + ((((((((((new_term.main_sel_op_address + new_term.main_sel_op_storage_address) + + new_term.main_sel_op_sender) + + new_term.main_sel_op_function_selector) + + new_term.main_sel_op_transaction_fee) + + new_term.main_sel_op_chain_id) + + new_term.main_sel_op_version) + + new_term.main_sel_op_block_number) + new_term.main_sel_op_timestamp) + new_term.main_sel_op_fee_per_l2_gas) + new_term.main_sel_op_fee_per_da_gas); @@ -148,651 +147,645 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); + auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); + auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); + auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); + auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); + auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); + auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); + auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); + auto tmp = + (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); + auto tmp = + (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); + auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); + auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); + auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); + auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); + auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); + auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); + auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); + auto tmp = (new_term.main_sel_op_ecadd * (FF(1) - new_term.main_sel_op_ecadd)); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_ecadd * (FF(1) - new_term.main_sel_op_ecadd)); + auto tmp = (new_term.main_sel_op_pedersen_commit * (FF(1) - new_term.main_sel_op_pedersen_commit)); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen_commit * (FF(1) - new_term.main_sel_op_pedersen_commit)); + auto tmp = (new_term.main_sel_op_msm * (FF(1) - new_term.main_sel_op_msm)); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_msm * (FF(1) - new_term.main_sel_op_msm)); + auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); + auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); + auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); + auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); + auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); + auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); + auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); + auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); + auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); + auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); + auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); + auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); + auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); + auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); + auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); + auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); + auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); + auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); tmp *= scaling_factor; std::get<50>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); + auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); + auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); tmp *= scaling_factor; std::get<52>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); + auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); tmp *= scaling_factor; std::get<53>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); + auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); + auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); + auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); + auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); + auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); + auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); + auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); + auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); + auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); + auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); + auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); + auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); + auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); + auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); + auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); + auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); + auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); + auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); + auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); + auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * + (new_term.main_w_in_tag - FF(1))); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * - (new_term.main_w_in_tag - FF(1))); + auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * + ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * - ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); + auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * + (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * - (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); + auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<77>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); + auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); + auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<81>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_jumpi * + (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + + (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); tmp *= scaling_factor; std::get<82>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * - (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + - (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); + auto tmp = (new_term.main_sel_op_internal_call * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<83>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); + auto tmp = + (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<88, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<88>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<89, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<89>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<90, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_op_internal_return * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); + ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); tmp *= scaling_factor; std::get<90>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<91, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<91>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<92, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); tmp *= scaling_factor; std::get<92>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<93, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<93>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<94, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); tmp *= scaling_factor; std::get<94>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<95, ContainerOverSubrelations>; auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); + (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); tmp *= scaling_factor; std::get<95>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<96, ContainerOverSubrelations>; - auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); + auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * + (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); tmp *= scaling_factor; std::get<96>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<97, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * - (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); + auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * + (new_term.main_call_ptr - new_term.main_space_id)); tmp *= scaling_factor; std::get<97>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<98, ContainerOverSubrelations>; - auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * - (new_term.main_call_ptr - new_term.main_space_id)); + auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * + (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); tmp *= scaling_factor; std::get<98>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * - (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); + auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_mov_ia_to_ic - + (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic - - (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); + auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); + auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); + auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * + (new_term.main_r_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * - (new_term.main_r_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_alu - + ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_alu - - ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); + auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); + auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); - tmp *= scaling_factor; - std::get<110>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; auto tmp = ((new_term.main_ib * (FF(1) - new_term.main_tag_err)) * ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) - new_term.main_sel_slice_gadget)); tmp *= scaling_factor; - std::get<111>(evals) += typename Accumulator::View(tmp); + std::get<110>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); tmp *= scaling_factor; - std::get<112>(evals) += typename Accumulator::View(tmp); + std::get<111>(evals) += typename Accumulator::View(tmp); } { - using Accumulator = typename std::tuple_element_t<113, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_bin - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)); tmp *= scaling_factor; - std::get<113>(evals) += typename Accumulator::View(tmp); + std::get<112>(evals) += typename Accumulator::View(tmp); } } }; @@ -806,53 +799,53 @@ template class main : public Relation> { switch (index) { case 0: return "OPCODE_SELECTORS"; - case 75: + case 74: return "OUTPUT_U8"; - case 76: + case 75: return "SUBOP_FDIV"; - case 77: + case 76: return "SUBOP_FDIV_ZERO_ERR1"; - case 78: + case 77: return "SUBOP_FDIV_ZERO_ERR2"; - case 79: + case 78: return "SUBOP_FDIV_R_IN_TAG_FF"; - case 80: + case 79: return "SUBOP_FDIV_W_IN_TAG_FF"; - case 81: + case 80: return "SUBOP_ERROR_RELEVANT_OP"; - case 82: + case 81: return "PC_JUMP"; - case 83: + case 82: return "PC_JUMPI"; - case 84: + case 83: return "RETURN_POINTER_INCREMENT"; - case 90: + case 89: return "RETURN_POINTER_DECREMENT"; - case 95: + case 94: return "PC_INCREMENT"; - case 96: + case 95: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 97: + case 96: return "SPACE_ID_INTERNAL"; - case 98: + case 97: return "SPACE_ID_STANDARD_OPCODES"; - case 99: + case 98: return "CMOV_CONDITION_RES_1"; - case 100: + case 99: return "CMOV_CONDITION_RES_2"; - case 103: + case 102: return "MOV_SAME_VALUE_A"; - case 104: + case 103: return "MOV_SAME_VALUE_B"; - case 105: + case 104: return "MOV_MAIN_SAME_TAG"; - case 109: + case 108: return "L2GASLEFT"; - case 110: + case 109: return "DAGASLEFT"; - case 112: + case 111: return "BIN_SEL_1"; - case 113: + case 112: return "BIN_SEL_2"; } return std::to_string(index); diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs index b114505d498..6d06471851a 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs @@ -124,4 +124,20 @@ AvmFlavor::ProvingKey::ProvingKey(const size_t circuit_size, const size_t num_pu } }; +/** + * @brief Serialize verification key to field elements + * + * @return std::vector + */ +std::vector AvmFlavor::VerificationKey::to_field_elements() const +{ + std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; + + for (auto const& comm : get_all()) { + std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); + elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); + } + return elements; +} + } // 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 723130e0e43..0a9830d51c5 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -195,6 +195,8 @@ class {{name}}Flavor { class VerificationKey : public VerificationKey_, VerifierCommitmentKey> { public: + using FF = VerificationKey_::FF; + VerificationKey() = default; VerificationKey(const std::shared_ptr& proving_key) @@ -218,23 +220,7 @@ class {{name}}Flavor { pcs_verification_key = std::make_shared(); } - // Override FF alias in VerificationKey_ - using FF = AvmFlavor::FF; - /** - * @brief Serialize verification key to field elements - * - * @return std::vector - */ - std::vector to_field_elements() const - { - std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; - - for (auto const& comm : get_all()) { - std::vector comm_as_fields = field_conversion::convert_to_bn254_frs(comm); - elements.insert(elements.end(), comm_as_fields.begin(), comm_as_fields.end()); - } - return elements; - } + std::vector to_field_elements() const; }; {{!-- Used by sumcheck --}} From 796ce7375e8c905c64958e4bd39c78f5370842bf Mon Sep 17 00:00:00 2001 From: jeanmon Date: Mon, 9 Sep 2024 15:53:32 +0000 Subject: [PATCH 7/7] 8285: fixes after rebase on master --- .../dsl/acir_format/avm_recursion_constraint.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp index 63c8179c644..dbbd169c3cd 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.test.cpp @@ -4,7 +4,7 @@ #include "acir_format.hpp" #include "acir_format_mocks.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" -#include "barretenberg/sumcheck/instance/prover_instance.hpp" +#include "barretenberg/ultra_honk/decider_keys.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" #include "barretenberg/vm/avm/generated/circuit_builder.hpp"