From 616fe1d218ed787927e733b477f695ae87916b42 Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Mon, 9 Dec 2024 21:06:57 +0000 Subject: [PATCH] add TODOs and cleanup --- .../cpp/src/barretenberg/dsl/acir_format/acir_format.cpp | 5 +++-- .../dsl/acir_format/honk_recursion_constraint.cpp | 6 ++++-- .../cpp/src/barretenberg/ultra_honk/ultra_prover.cpp | 1 + 3 files changed, 8 insertions(+), 4 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 b71993548b4..a4a864625ca 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -385,8 +385,9 @@ PairingPointAccumulatorIndices process_honk_recursion_constraints( commitment_key, ipa_transcript_1, nested_ipa_claims[0], ipa_transcript_2, nested_ipa_claims[1]); } else if (nested_ipa_claims.size() == 1) { builder.add_ipa_claim(nested_ipa_claims[0].get_witness_indices()); - builder.ipa_proof = convert_stdlib_proof_to_native( - nested_ipa_proofs[0]); // WORKTODO: is this bad? or is it fine to just pass the proofs along + // This conversion looks suspicious but there's no need to make this an output of the circuit since its a proof + // that will be checked anyway. + builder.ipa_proof = convert_stdlib_proof_to_native(nested_ipa_proofs[0]); } return current_aggregation_object; } 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 5fb7728e74d..c79535ad7d4 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 @@ -42,6 +42,7 @@ void create_dummy_vkey_and_proof(Builder& builder, // Set vkey->circuit_size correctly based on the proof size size_t num_frs_comm = bb::field_conversion::calc_num_bn254_frs(); size_t num_frs_fr = bb::field_conversion::calc_num_bn254_frs(); + // TODO(https://github.com/AztecProtocol/barretenberg/issues/1168): Add formula to flavor assert((proof_size - bb::HONK_PROOF_PUBLIC_INPUT_OFFSET - Flavor::NUM_WITNESS_ENTITIES * num_frs_comm - Flavor::NUM_ALL_ENTITIES * num_frs_fr - num_frs_comm) % (num_frs_comm + num_frs_fr * (Flavor::BATCHED_RELATION_PARTIAL_LENGTH + 1)) == @@ -248,9 +249,10 @@ HonkRecursionConstraintOutput create_honk_recursion_constraints( std::vector honk_proof = proof_fields; HonkRecursionConstraintOutput output; if (is_rollup_honk_recursion_constraint) { + // TODO(https://github.com/AztecProtocol/barretenberg/issues/1168): Add formula to flavor const size_t HONK_PROOF_LENGTH = 473; - ASSERT(input.proof.size() == - HONK_PROOF_LENGTH + 65); // WORKTODO: figure out how to not involve random constants + // The extra calculation is for the IPA proof length. + ASSERT(input.proof.size() == HONK_PROOF_LENGTH + 1 + 4 * (CONST_ECCVM_LOG_N) + 2 + 2); ASSERT(proof_fields.size() == HONK_PROOF_LENGTH + 65 + input.public_inputs.size()); // split out the ipa proof const std::ptrdiff_t honk_proof_with_pub_inputs_length = diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp index 48c1b30a963..c07c75b34a3 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp @@ -38,6 +38,7 @@ template HonkProof UltraProver_::export_proof() proof = transcript->proof_data; // Add the IPA proof if constexpr (HasIPAAccumulator) { + // The extra calculation is for the IPA proof length. ASSERT(proving_key->proving_key.ipa_proof.size() == 1 + 4 * (CONST_ECCVM_LOG_N) + 2 + 2); proof.insert(proof.end(), proving_key->proving_key.ipa_proof.begin(), proving_key->proving_key.ipa_proof.end()); }