From 8658abd46612d3fdf8c8b54902c201c790a52345 Mon Sep 17 00:00:00 2001 From: ledwards2225 <98505400+ledwards2225@users.noreply.github.com> Date: Mon, 28 Oct 2024 07:42:16 -0700 Subject: [PATCH] feat: fixed number of pub inputs for databus commitment propagation (#9336) This work is motivated by the need to have a "write vk" method for kernel circuits that depends only on acir constraints (no witness data or historical data about the previously accumulated circuits). This is made difficult by the inter-circuit databus consistency check mechanism which, until now, added structure to a present circuit based on the structure of previous circuits. This PR makes updates to the mechanism so that the constraints associated with the databus consistency checks are consistent across all kernel circuits. There are two components to this: (1) Every kernel propagates 2 commitments worth of data (one for app return data, one for kernel return data) on its public inputs. (Previously this was allowed to be 0, 1 or 2 depending on the number of recursive verifications performed by the kernel). If data does not exist for either of these (e.g. if the kernel is only verifying a proof of one or the other), a default value is propagated. (This value is set to match the commitment to the "empty" calldata that will correspond to the missing return data). (2) Every kernel performs two commitment consistency checks: one that checks that the app `return_data` is equal to the `secondary_calldata` and one that checks that the previous kernel `return_data` is equal to the `calldata`. (Previously there could be 0, 1, or 2 such checks depending on the data propagated on the public inputs of the kernel being recursively verified - hence the need for knowledge of history / witness data). Closes https://github.com/AztecProtocol/barretenberg/issues/1125 (had to do with dynamically determining the number of public inputs associated with databus commitments which is now fixed in size to 16). --- barretenberg/cpp/src/barretenberg/bb/main.cpp | 4 +- .../barretenberg/client_ivc/client_ivc.cpp | 26 ++-- .../client_ivc_integration.test.cpp | 10 +- .../primitives/bigfield/goblin_field.hpp | 10 ++ .../stdlib/primitives/biggroup/biggroup.hpp | 9 ++ .../primitives/biggroup/biggroup_goblin.hpp | 9 ++ .../stdlib/primitives/databus/databus.hpp | 112 ++++++++++++------ .../stdlib_circuit_builders/databus.hpp | 22 ++-- .../flavor_serialization.test.cpp | 2 - .../mega_circuit_builder.cpp | 25 ++-- .../stdlib_circuit_builders/mega_flavor.hpp | 2 - .../mega_recursive_flavor.hpp | 4 - .../src/core/libraries/ConstantsGen.sol | 2 +- .../crates/types/src/constants.nr | 2 +- yarn-project/circuits.js/src/constants.gen.ts | 2 +- 15 files changed, 157 insertions(+), 84 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 58bbb33f8bd..07fabf7029d 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -598,8 +598,8 @@ void prove_tube(const std::string& output_path) // these public inputs by turning proof into witnesses and call // set_public on each witness auto num_public_inputs = static_cast(static_cast(proof.folding_proof[1])); - num_public_inputs -= bb::AGGREGATION_OBJECT_SIZE; // don't add the agg object - num_public_inputs -= 1 * 8; // TODO(https://github.com/AztecProtocol/barretenberg/issues/1125) Make this dynamic + num_public_inputs -= bb::AGGREGATION_OBJECT_SIZE; // don't add the agg object + num_public_inputs -= bb::PROPAGATED_DATABUS_COMMITMENTS_SIZE; // exclude propagated databus commitments for (size_t i = 0; i < num_public_inputs; i++) { auto offset = acir_format::HONK_RECURSION_PUBLIC_INPUT_OFFSET; builder->add_public_variable(proof.folding_proof[i + offset]); diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 66926c1a07d..9dc931e0c1d 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -54,6 +54,9 @@ void ClientIVC::perform_recursive_verification_and_databus_consistency_checks( const std::shared_ptr& vkey, const QUEUE_TYPE type) { + // Store the decider vk for the incoming circuit; its data is used in the databus consistency checks below + std::shared_ptr decider_vk; + switch (type) { case QUEUE_TYPE::PG: { // Construct stdlib verifier accumulator from the native counterpart computed on a previous round @@ -66,10 +69,8 @@ void ClientIVC::perform_recursive_verification_and_databus_consistency_checks( // Extract native verifier accumulator from the stdlib accum for use on the next round verifier_accumulator = std::make_shared(verifier_accum->get_value()); - // Perform databus commitment consistency checks and propagate return data commitments via public inputs - bus_depot.execute(verifier.keys_to_fold[1]->witness_commitments, - verifier.keys_to_fold[1]->public_inputs, - verifier.keys_to_fold[1]->verification_key->databus_propagation_data); + decider_vk = verifier.keys_to_fold[1]; // decider vk for the incoming circuit + break; } case QUEUE_TYPE::OINK: { @@ -86,14 +87,20 @@ void ClientIVC::perform_recursive_verification_and_databus_consistency_checks( // Initialize the gate challenges to zero for use in first round of folding verifier_accumulator->gate_challenges = std::vector(CONST_PG_LOG_N, 0); - // Perform databus commitment consistency checks and propagate return data commitments via public inputs - bus_depot.execute(verifier_accum->witness_commitments, - verifier_accum->public_inputs, - verifier_accum->verification_key->databus_propagation_data); + decider_vk = verifier_accum; // decider vk for the incoming circuit break; } } + + // Set the return data commitment to be propagated on the public inputs of the present kernel and peform consistency + // checks between the calldata commitments and the return data commitments contained within the public inputs + bus_depot.set_return_data_to_be_propagated_and_perform_consistency_checks( + decider_vk->witness_commitments.return_data, + decider_vk->witness_commitments.calldata, + decider_vk->witness_commitments.secondary_calldata, + decider_vk->public_inputs, + decider_vk->verification_key->databus_propagation_data); } /** @@ -133,6 +140,9 @@ void ClientIVC::complete_kernel_circuit_logic(ClientCircuit& circuit) } stdlib_verification_queue.clear(); + // Propagate return data commitments via the public inputs for use in databus consistency checks + bus_depot.propagate_return_data_commitments(circuit); + // Perform recursive merge verification for every merge proof in the queue process_recursive_merge_verification_queue(circuit); } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc_integration.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc_integration.test.cpp index fe62b038db2..5b08a08c810 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc_integration.test.cpp @@ -93,10 +93,14 @@ TEST_F(ClientIVCIntegrationTests, BenchmarkCasePrecomputedVKs) size_t NUM_CIRCUITS = 6; - MockCircuitProducer circuit_producer; - - auto precomputed_vks = circuit_producer.precompute_verification_keys(NUM_CIRCUITS, ivc.trace_structure); + // Precompute the verification keys for each circuit in the IVC + std::vector> precomputed_vks; + { + MockCircuitProducer circuit_producer; + precomputed_vks = circuit_producer.precompute_verification_keys(NUM_CIRCUITS, ivc.trace_structure); + } + MockCircuitProducer circuit_producer; // Construct and accumulate a series of mocked private function execution circuits for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) { Builder circuit = circuit_producer.create_next_circuit(ivc); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/goblin_field.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/goblin_field.hpp index 8e3885e46a6..8e18a679ce4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/goblin_field.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/goblin_field.hpp @@ -74,6 +74,16 @@ template class goblin_field { return goblin_field(lo, hi); } + /** + * Create a witness from a constant. This way the value of the witness is fixed and public. + **/ + void convert_constant_to_fixed_witness(Builder* builder) + { + for (auto& limb : limbs) { + limb.convert_constant_to_fixed_witness(builder); + } + } + static goblin_field conditional_assign(const bool_ct& predicate, const goblin_field& lhs, goblin_field& rhs) { goblin_field result; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp index 110df1f0cbe..e033d481f35 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp @@ -75,6 +75,15 @@ template class element { } } + /** + * @brief Creates fixed witnesses from a constant element. + **/ + void convert_constant_to_fixed_witness(Builder* builder) + { + this->x.convert_constant_to_fixed_witness(builder); + this->y.convert_constant_to_fixed_witness(builder); + } + static element one(Builder* ctx) { uint256_t x = uint256_t(NativeGroup::one.x); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp index 96fa5b85997..dcb321b3e5c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp @@ -69,6 +69,15 @@ template class goblin_ele return out; } + /** + * @brief Creates fixed witnesses from a constant element. + **/ + void convert_constant_to_fixed_witness(Builder* builder) + { + this->x.convert_constant_to_fixed_witness(builder); + this->y.convert_constant_to_fixed_witness(builder); + } + void validate_on_curve() const { // happens in goblin eccvm diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/databus/databus.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/databus/databus.hpp index 3bdd40c02cd..6639158e411 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/databus/databus.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/databus/databus.hpp @@ -68,6 +68,8 @@ template class DataBusDepot { using Commitment = typename Curve::Group; using Fr = typename Curve::ScalarField; using Fq = typename Curve::BaseField; + using CommitmentNative = typename Curve::AffineElementNative; + using FrNative = typename Curve::ScalarFieldNative; using RecursiveFlavor = MegaRecursiveFlavor_; using RecursiveDeciderVerificationKeys = @@ -77,54 +79,98 @@ template class DataBusDepot { static constexpr size_t NUM_FR_LIMBS_PER_FQ = Fq::NUM_LIMBS; static constexpr size_t NUM_FR_LIMBS_PER_COMMITMENT = NUM_FR_LIMBS_PER_FQ * 2; + Commitment app_return_data_commitment; + Commitment kernel_return_data_commitment; + bool app_return_data_commitment_exists = false; + bool kernel_return_data_commitment_exists = false; + /** * @brief Execute circuit logic to establish proper transfer of databus data between circuits * @details The databus mechanism establishes the transfer of data between two circuits (i-1 and i) in a third * circuit (i+1) via commitment equality checks of the form [R_{i-1}] = [C_i], where R and C represent return data * and calldata, respectively. In practice, circuit (i+1) is given access to [R_{i-1}] via the public inputs of * \pi_i, and it has access to [C_i] directly from \pi_i. The consistency checks in circuit (i+1) are thus of the - * form \pi_i.public_inputs.[R_{i-1}] = \pi_i.[C_i]. This method peforms the two primary operations required for - * these checks: (1) extract commitments [R] from proofs received as private witnesses and propagate them to the - * next circuit via adding them to the public inputs. (2) Assert equality of commitments. + * form \pi_i.public_inputs.[R_{i-1}] = \pi_i.[C_i]. This method performs these consistency checks. It also prepares + * return data commitments [R] to be propagated via the public inputs of the present circuit. * - * In Aztec private function execution, this mechanism is used as follows. Kernel circuit K_{i+1} must in general - * perform two databus consistency checks: (1) that the return_data of app circuit A_{i} was secondary calldata to - * K_{i}, and (2) that the return_data of K_{i-1} was calldata to K_{i}. + * @note In Aztec private function execution, this mechanism is used as follows. Kernel circuit K_{i+1} must in + * general perform two databus consistency checks: (1) that the return_data of app circuit A_{i} was secondary + * calldata to K_{i}, and (2) that the return_data of K_{i-1} was calldata to K_{i}. * - * @param commitments Witness polynomial commitments for an key that has been accumulated - * @param public_inputs The public inputs of that key - * @param propagation_data Data about the presence of databus commitments on the public inputs of the key. + * @param return_data Return data from either an app or a kernel + * @param calldata Calldata corresponding to return data from a previous kernel + * @param secondary_calldata Calldata corresponding to some app return data + * @param public_inputs Public inputs of a kernel proof which contain propagated return data commitments + * @param propagation_data Info about the return data commitments stored in the provided public inputs */ - void execute(const WitnessCommitments& commitments, - const std::vector& public_inputs, - const DatabusPropagationData& propagation_data) + void set_return_data_to_be_propagated_and_perform_consistency_checks(const Commitment& return_data, + const Commitment& calldata, + const Commitment& secondary_calldata, + const std::vector& public_inputs, + const DatabusPropagationData& propagation_data) { - // Flag indicating whether the input data corresponds to a kernel decider proving key (else, an app decider - // proving key). This is used to indicate whether the return data commitment being propagated belongs to a - // kernel or an app so that it can be checked against the appropriate calldata commitment in a subsequent round. - bool is_kernel_data = propagation_data.is_kernel; - - // Assert equality between return data commitments propagated via the public inputs and the corresponding - // calldata commitment - if (propagation_data.contains_app_return_data_commitment) { // public inputs contain [R]_app - ASSERT(is_kernel_data); // Only kernels should contain databus commitments in their public inputs - size_t start_idx = propagation_data.app_return_data_public_input_idx; - Commitment app_return_data = reconstruct_commitment_from_public_inputs(public_inputs, start_idx); - // App return data should correspond to the secondary calldata of the subsequent kernel - assert_equality_of_commitments(app_return_data, commitments.secondary_calldata); + // Set the kernel/app return data commitment to be propagated via the public inputs + if (propagation_data.is_kernel) { + kernel_return_data_commitment = return_data; + kernel_return_data_commitment_exists = true; + } else { + app_return_data_commitment = return_data; + app_return_data_commitment_exists = true; } - if (propagation_data.contains_kernel_return_data_commitment) { // pub inputs contain [R]_kernel - ASSERT(is_kernel_data); // Only kernels should contain databus commitments in their public inputs + // If the input data corresponds to a kernel, perform consistency checks between the provided calldata + // commitments and the return data commitments stored in the provided kernel proof public inputs + if (propagation_data.is_kernel) { + // Reconstruct the kernel and app return data commitments stored in the public inputs of the kernel proof size_t start_idx = propagation_data.kernel_return_data_public_input_idx; Commitment kernel_return_data = reconstruct_commitment_from_public_inputs(public_inputs, start_idx); - // Previous kernel return data should correspond to the calldata of the subsequent kernel - assert_equality_of_commitments(kernel_return_data, commitments.calldata); + start_idx = propagation_data.app_return_data_public_input_idx; + Commitment app_return_data = reconstruct_commitment_from_public_inputs(public_inputs, start_idx); + + // Assert equality between the corresponding calldata and return data commitments + assert_equality_of_commitments(kernel_return_data, calldata); + assert_equality_of_commitments(app_return_data, secondary_calldata); } + } - // Propagate the return data commitment via the public inputs mechanism - propagate_commitment_via_public_inputs(commitments.return_data, is_kernel_data); - }; + /** + * @brief Propagate the existing return data commitments via the public inputs of the provided circuit + * @details For consistent behavior across kernels, every kernel propagates two return data commitments via its + * public inputs. If one of either the app or kernel return data does not exist, it is populated with a default + * value that will satisfy the consistency check on the next cycle. For example, the first kernel has no previous + * kernel to verify and thus neither receives a previous kernel return data commitment nor a calldata input + * corresponding to a previous kernel. The commitment to the "empty" calldata will take a default value and thus we + * set the same value for the missing return data so that the consistency check will be satisfied. + * TODO(https://github.com/AztecProtocol/barretenberg/issues/1138): Resolve issues around default commitment value + * and bool_t "existence" type flags. + * @note The ordering of the kernel/app return data commitments within the public inputs is arbitrary but must be + * consistent across all kernels in order for the corresponding conistency check constraints to be consistent. + * + * @param builder + */ + void propagate_return_data_commitments(Builder& builder) + { + // Set default commitment value to be used in the absence of one or the other return_data commitment + CommitmentNative default_commitment_val = CommitmentNative::one() * FrNative(BusVector::DEFAULT_VALUE); + if (kernel_return_data_commitment_exists) { + propagate_commitment_via_public_inputs(kernel_return_data_commitment, /*is_kernel=*/true); + } else { + Commitment default_commitment(default_commitment_val); + default_commitment.convert_constant_to_fixed_witness(&builder); + propagate_commitment_via_public_inputs(default_commitment, /*is_kernel=*/true); + } + + if (app_return_data_commitment_exists) { + propagate_commitment_via_public_inputs(app_return_data_commitment, /*is_kernel=*/false); + } else { + Commitment default_commitment(default_commitment_val); + default_commitment.convert_constant_to_fixed_witness(&builder); + propagate_commitment_via_public_inputs(default_commitment, /*is_kernel=*/false); + } + // Reset flags indicating existence of return data commitments + kernel_return_data_commitment_exists = false; + app_return_data_commitment_exists = false; + } /** * @brief Set the witness indices for a commitment to public @@ -142,10 +188,8 @@ template class DataBusDepot { // Set flag indicating propagation of return data; save the index at which it will be stored in public inputs auto start_idx = static_cast(context->public_inputs.size()); if (is_kernel) { - context->databus_propagation_data.contains_kernel_return_data_commitment = true; context->databus_propagation_data.kernel_return_data_public_input_idx = start_idx; } else { - context->databus_propagation_data.contains_app_return_data_commitment = true; context->databus_propagation_data.app_return_data_public_input_idx = start_idx; } diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp index f40f44eb50a..92fda074a99 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp @@ -1,14 +1,22 @@ #pragma once +#include "barretenberg/ecc/curves/bn254/fr.hpp" #include namespace bb { +// We assume all kernels have space for two return data commitments on their public inputs +constexpr uint32_t PROPAGATED_DATABUS_COMMITMENTS_SIZE = 16; + /** * @brief A DataBus column * */ struct BusVector { + // TODO(https://github.com/AztecProtocol/barretenberg/issues/1138): A default value added to every databus column to + // avoid the point at infinity commitment and to ensure the validity of the databus commitment consistency checks. + static constexpr bb::fr DEFAULT_VALUE = 25; + /** * @brief Add an element to the data defining this bus column * @@ -70,10 +78,6 @@ enum class BusId { CALLDATA, SECONDARY_CALLDATA, RETURNDATA }; struct DatabusPropagationData { bool operator==(const DatabusPropagationData&) const = default; - // Flags indicating whether the public inputs contain commitment(s) to app/kernel return data - bool contains_app_return_data_commitment = false; - bool contains_kernel_return_data_commitment = false; - // The start index of the return data commitments (if present) in the public inputs. Note: a start index is all // that's needed here since the commitents are represented by a fixed number of witnesses and are contiguous in the // public inputs by construction. @@ -85,19 +89,13 @@ struct DatabusPropagationData { friend std::ostream& operator<<(std::ostream& os, DatabusPropagationData const& data) { - os << data.contains_app_return_data_commitment << ",\n" - << data.contains_kernel_return_data_commitment << ",\n" - << data.app_return_data_public_input_idx << ",\n" + os << data.app_return_data_public_input_idx << ",\n" << data.kernel_return_data_public_input_idx << ",\n" << data.is_kernel << "\n"; return os; }; - MSGPACK_FIELDS(contains_app_return_data_commitment, - contains_kernel_return_data_commitment, - app_return_data_public_input_idx, - kernel_return_data_public_input_idx, - is_kernel); + MSGPACK_FIELDS(app_return_data_public_input_idx, kernel_return_data_public_input_idx, is_kernel); }; } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp index 46b73cbbfe4..162385bdcba 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp @@ -49,8 +49,6 @@ TYPED_TEST(FlavorSerializationTests, VerificationKeySerialization) // Populate some non-zero values in the databus_propagation_data to ensure its being handled if constexpr (IsMegaBuilder) { - original_vkey.databus_propagation_data.contains_app_return_data_commitment = 1; - original_vkey.databus_propagation_data.contains_kernel_return_data_commitment = 1; original_vkey.databus_propagation_data.app_return_data_public_input_idx = 2; original_vkey.databus_propagation_data.kernel_return_data_public_input_idx = 4; original_vkey.databus_propagation_data.is_kernel = 1; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.cpp index 3accdd2b758..e05d1f10f90 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.cpp @@ -29,33 +29,30 @@ template void MegaCircuitBuilder_::finalize_circuit(const bool * @param in Structure containing variables and witness selectors */ // TODO(https://github.com/AztecProtocol/barretenberg/issues/1066): This function adds valid (but arbitrary) gates to -// ensure that the circuit which includes them will not result in any zero-polynomials. It also ensures that the first -// coefficient of the wire polynomials is zero, which is required for them to be shiftable. +// ensure that the circuit which includes them will not result in any zero-polynomials. This method is designed to be +// used in conjunction with the corresponding method on the Ultra builder. It handles databus and ecc-op related +// polynomials. template void MegaCircuitBuilder_::add_mega_gates_to_ensure_all_polys_are_non_zero() { - // All that remains is to handle databus related and poseidon2 related polynomials. In what follows we populate the - // calldata with some mock data then constuct a single calldata read gate - - // Define a single dummy value to add to all databus columns. Note: This value must be equal across all columns in - // order for inter-circuit databus commitment checks to pass in IVC settings. These dummy gates can be deleted with - // all of the others when (https://github.com/AztecProtocol/barretenberg/issues/1066) is resolved. - FF databus_dummy_value = 25; + // Add a single default value to all databus columns. Note: This value must be equal across all columns in order for + // inter-circuit databus commitment checks to pass in IVC settings. + // TODO(https://github.com/AztecProtocol/barretenberg/issues/1138): Consider default value. // Create an arbitrary calldata read gate - add_public_calldata(this->add_variable(databus_dummy_value)); // add one entry in calldata + add_public_calldata(this->add_variable(BusVector::DEFAULT_VALUE)); // add one entry in calldata auto raw_read_idx = static_cast(get_calldata().size()) - 1; // read data that was just added auto read_idx = this->add_variable(raw_read_idx); read_calldata(read_idx); // Create an arbitrary secondary_calldata read gate - add_public_secondary_calldata(this->add_variable(databus_dummy_value)); // add one entry in secondary_calldata - raw_read_idx = static_cast(get_secondary_calldata().size()) - 1; // read data that was just added + add_public_secondary_calldata(this->add_variable(BusVector::DEFAULT_VALUE)); // add one entry in secondary_calldata + raw_read_idx = static_cast(get_secondary_calldata().size()) - 1; // read data that was just added read_idx = this->add_variable(raw_read_idx); read_secondary_calldata(read_idx); // Create an arbitrary return data read gate - add_public_return_data(this->add_variable(databus_dummy_value)); // add one entry in return data - raw_read_idx = static_cast(get_return_data().size()) - 1; // read data that was just added + add_public_return_data(this->add_variable(BusVector::DEFAULT_VALUE)); // add one entry in return data + raw_read_idx = static_cast(get_return_data().size()) - 1; // read data that was just added read_idx = this->add_variable(raw_read_idx); read_return_data(read_idx); diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp index e8560197a6d..787c4e782b7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp @@ -578,8 +578,6 @@ class MegaFlavor { serialize_to_field_buffer(this->contains_recursive_proof, elements); serialize_to_field_buffer(this->recursive_proof_public_input_indices, elements); - serialize_to_field_buffer(this->databus_propagation_data.contains_app_return_data_commitment, elements); - serialize_to_field_buffer(this->databus_propagation_data.contains_kernel_return_data_commitment, elements); serialize_to_field_buffer(this->databus_propagation_data.app_return_data_public_input_idx, elements); serialize_to_field_buffer(this->databus_propagation_data.kernel_return_data_public_input_idx, elements); serialize_to_field_buffer(this->databus_propagation_data.is_kernel, elements); diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp index f650f4b2761..fc310b80e54 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp @@ -155,10 +155,6 @@ template class MegaRecursiveFlavor_ { idx = uint32_t(deserialize_from_frs(builder, elements, num_frs_read).get_value()); } - this->databus_propagation_data.contains_app_return_data_commitment = - bool(deserialize_from_frs(builder, elements, num_frs_read).get_value()); - this->databus_propagation_data.contains_kernel_return_data_commitment = - bool(deserialize_from_frs(builder, elements, num_frs_read).get_value()); this->databus_propagation_data.app_return_data_public_input_idx = uint32_t(deserialize_from_frs(builder, elements, num_frs_read).get_value()); this->databus_propagation_data.kernel_return_data_public_input_idx = diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 1483b140a3b..8c42fe769d9 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -243,7 +243,7 @@ library Constants { uint256 internal constant NESTED_RECURSIVE_PROOF_LENGTH = 463; uint256 internal constant TUBE_PROOF_LENGTH = 463; uint256 internal constant HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; - uint256 internal constant CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 145; + uint256 internal constant CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 143; uint256 internal constant MEM_TAG_FF = 0; uint256 internal constant MEM_TAG_U1 = 1; uint256 internal constant MEM_TAG_U8 = 2; diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index d06bfd00f76..2854cfd0068 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -479,7 +479,7 @@ global TUBE_PROOF_LENGTH: u32 = RECURSIVE_PROOF_LENGTH; // in the future these c global HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 128; -global CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 145; +global CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 143; // VK is composed of // - circuit size encoded as a fr field element (32 bytes) // - num of inputs encoded as a fr field element (32 bytes) diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index c1b4bc2c576..479e46bbfd3 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -221,7 +221,7 @@ export const RECURSIVE_PROOF_LENGTH = 463; export const NESTED_RECURSIVE_PROOF_LENGTH = 463; export const TUBE_PROOF_LENGTH = 463; export const HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; -export const CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 145; +export const CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 143; export const AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 86; export const AVM_PROOF_LENGTH_IN_FIELDS = 4166; export const AVM_PUBLIC_COLUMN_MAX_SIZE = 1024;