Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Oct 10, 2023
1 parent 3c7e452 commit b39bb63
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TEST_F(GoblinUltraHonkComposerTests, MultipleCircuitsMergeOnly)

auto composer = GoblinUltraComposer();

// Construct and verify Goblin ECC op queue Merge its proof
// Construct and verify Goblin ECC op queue Merge proof
auto merge_verified = construct_and_verify_merge_proof(composer, op_queue);
EXPECT_TRUE(merge_verified);
}
Expand Down Expand Up @@ -196,21 +196,21 @@ TEST_F(GoblinUltraHonkComposerTests, MultipleCircuitsHonkAndMerge)
auto honk_verified = construct_and_verify_honk_proof(composer, builder);
EXPECT_TRUE(honk_verified);

// Construct and verify Goblin ECC op queue Merge its proof
// Construct and verify Goblin ECC op queue Merge proof
auto merge_verified = construct_and_verify_merge_proof(composer, op_queue);
EXPECT_TRUE(merge_verified);
}

// // Compute the commitments to the aggregate op queue directly and check that they match those that were computed
// // iteratively during transcript aggregation by the provers and stored in the op queue.
// size_t aggregate_op_queue_size = op_queue->current_ultra_ops_size;
// auto crs_factory = std::make_shared<barretenberg::srs::factories::FileCrsFactory<Curve>>("../srs_db/ignition");
// auto commitment_key = std::make_shared<CommitmentKey>(aggregate_op_queue_size, crs_factory);
// size_t idx = 0;
// for (auto& result : op_queue->ultra_ops_commitments) {
// auto expected = commitment_key->commit(op_queue->ultra_ops[idx++]);
// EXPECT_EQ(result, expected);
// }
// Compute the commitments to the aggregate op queue directly and check that they match those that were computed
// iteratively during transcript aggregation by the provers and stored in the op queue.
size_t aggregate_op_queue_size = op_queue->current_ultra_ops_size;
auto crs_factory = std::make_shared<barretenberg::srs::factories::FileCrsFactory<Curve>>("../srs_db/ignition");
auto commitment_key = std::make_shared<CommitmentKey>(aggregate_op_queue_size, crs_factory);
size_t idx = 0;
for (auto& result : op_queue->ultra_ops_commitments) {
auto expected = commitment_key->commit(op_queue->ultra_ops[idx++]);
EXPECT_EQ(result, expected);
}
}

} // namespace test_ultra_honk_composer
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ template <typename Curve> class ZeroMorphVerifier_ {
* @param g_commitments Commitments to to-be-shifted polynomials [g_i]
* @param C_q_k Commitments to q_k
* @param alpha
* @param batched_evaluation \sum_{i=0}^{m-1} f_i(u) + \sum_{i=0}^{l-1} h_i(u)
* @param batched_evaluation \sum_{i=0}^{m-1} \alpha^i*f_i(u) + \sum_{i=0}^{l-1} \alpha^{m+i}*h_i(u)
* @param x_challenge
* @param u_challenge multilinear challenge
* @return Commitment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ template <UltraFlavor Flavor> void UltraProver_<Flavor>::execute_relation_check_
}

/**
* - Get rho challenge
* - Compute d+1 Fold polynomials and their evaluations.
* @brief Execute the ZeroMorph protocol to prove the multilinear evaluations produced by Sumcheck
* @details See https://hackmd.io/dlf9xEwhTQyE3hiGbq4FsA?view for a complete description of the unrolled protocol.
*
* */
template <UltraFlavor Flavor> void UltraProver_<Flavor>::execute_zeromorph_rounds()
Expand All @@ -124,7 +124,7 @@ template <UltraFlavor Flavor> void UltraProver_<Flavor>::execute_zeromorph_round
// Extract challenge u and claimed multilinear evaluations from Sumcheck output
std::span<FF> u_challenge = sumcheck_output.challenge;
std::span<FF> claimed_evaluations = sumcheck_output.claimed_evaluations;
size_t log_N = u_challenge.size();
size_t log_circuit_size = u_challenge.size();

// Compute batching of f_i and g_i polynomials: sum_{i=0}^{m-1}\alpha^i*f_i and
// sum_{i=0}^{l-1}\alpha^{m+i}*h_i, and also batched evaluation v = sum_{i=0}^{m-1}\alpha^i*f_i(u) +
Expand All @@ -145,7 +145,8 @@ template <UltraFlavor Flavor> void UltraProver_<Flavor>::execute_zeromorph_round
++poly_idx;
};

// The new f is f_batched + g_batched.shifted() = f_batched + h_batched
// Compute the full batched polynomial f = f_batched + g_batched.shifted() = f_batched + h_batched. This is the
// polynomial for which we compute the quotients q_k
auto f_polynomial = f_batched;
f_polynomial += g_batched.shifted();

Expand All @@ -154,8 +155,8 @@ template <UltraFlavor Flavor> void UltraProver_<Flavor>::execute_zeromorph_round

// Compute and send commitments C_{q_k} = [q_k], k = 0,...,d-1
std::vector<Commitment> q_k_commitments;
q_k_commitments.reserve(log_N);
for (size_t idx = 0; idx < log_N; ++idx) {
q_k_commitments.reserve(log_circuit_size);
for (size_t idx = 0; idx < log_circuit_size; ++idx) {
q_k_commitments[idx] = pcs_commitment_key->commit(quotients[idx]);
std::string label = "ZM:C_q_" + std::to_string(idx);
transcript.send_to_verifier(label, q_k_commitments[idx]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ template <typename Flavor> bool UltraVerifier_<Flavor>::verify_proof(const plonk

// Execute ZeroMorph rounds

// Compute powers of batching challenge rho
FF rho = transcript.get_challenge("rho");

// Compute powers of batching challenge rho
std::vector<FF> rhos = pcs::zeromorph::powers_of_challenge(rho, Flavor::NUM_ALL_ENTITIES);

// Construct batched evaluation v = sum_{i=0}^{m-1}\alpha^i*v_i + sum_{i=0}^{l-1}\alpha^{m+i}*w_i
Expand Down

0 comments on commit b39bb63

Please sign in to comment.