Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions barretenberg/cpp/src/barretenberg/api/prove_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@ void prove_tube(const std::string& output_path, const std::string& vk_path)
ClientIVCRecursiveVerifier::Output client_ivc_rec_verifier_output = verifier.verify(stdlib_proof);

// The public inputs in the proof are propagated to the base rollup by making them public inputs of this circuit.
// Exclude the pairing points which are handled separately.
auto num_inner_public_inputs = vk.mega->num_public_inputs - bb::PAIRING_POINTS_SIZE;
// Exclude the public inputs of the Hiding Kernel: the pairing points are handled separately, the ecc op tables are
// not needed after this point
auto num_inner_public_inputs = vk.mega->num_public_inputs - HidingKernelIO<Builder>::PUBLIC_INPUTS_SIZE;
for (size_t i = 0; i < num_inner_public_inputs; i++) {
stdlib_proof.mega_proof[i].set_public();
}

client_ivc_rec_verifier_output.points_accumulator.set_public();
// The tube only calls an IPA recursive verifier once, so we can just add this IPA claim and proof
client_ivc_rec_verifier_output.opening_claim.set_public();
// IO
RollupIO inputs;
inputs.pairing_inputs = client_ivc_rec_verifier_output.points_accumulator;
inputs.ipa_claim = client_ivc_rec_verifier_output.opening_claim;
inputs.set_public();

// The tube only calls an IPA recursive verifier once, so we can just add this IPA proof
builder->ipa_proof = client_ivc_rec_verifier_output.ipa_proof.get_value();
BB_ASSERT_EQ(builder->ipa_proof.size(), IPA_PROOF_LENGTH, "IPA proof should be set.");

Expand Down Expand Up @@ -92,7 +97,7 @@ void prove_tube(const std::string& output_path, const std::string& vk_path)

// Break up the tube proof into the honk portion and the ipa portion
const size_t HONK_PROOF_LENGTH_WITHOUT_INNER_PUB_INPUTS =
UltraRollupFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + PAIRING_POINTS_SIZE + IPA_CLAIM_SIZE;
UltraRollupFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + RollupIO::PUBLIC_INPUTS_SIZE;
// The extra calculation is for the IPA proof length.
BB_ASSERT_EQ(tube_proof.size(),
HONK_PROOF_LENGTH_WITHOUT_INNER_PUB_INPUTS + num_inner_public_inputs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ TEST_F(ClientIVCRecursionTests, ClientTubeBase)
StdlibProof stdlib_proof(*tube_builder, proof);
CIVCRecVerifierOutput client_ivc_rec_verifier_output = verifier.verify(stdlib_proof);

client_ivc_rec_verifier_output.points_accumulator.set_public();
// The tube only calls an IPA recursive verifier once, so we can just add this IPA claim and proof
client_ivc_rec_verifier_output.opening_claim.set_public();
{
// IO
RollupIO inputs;
inputs.pairing_inputs = client_ivc_rec_verifier_output.points_accumulator;
inputs.ipa_claim = client_ivc_rec_verifier_output.opening_claim;
inputs.set_public();
}

// The tube only calls an IPA recursive verifier once, so we can just add this IPA proof
tube_builder->ipa_proof = client_ivc_rec_verifier_output.ipa_proof.get_value();

info("ClientIVC Recursive Verifier: num prefinalized gates = ", tube_builder->num_gates);
Expand Down Expand Up @@ -139,8 +145,15 @@ TEST_F(ClientIVCRecursionTests, ClientTubeBase)
UltraRecursiveVerifier base_verifier{ &base_builder, stdlib_tube_vk_and_hash };
UltraRecursiveVerifierOutput<Builder> output = base_verifier.verify_proof(base_tube_proof);
info("Tube UH Recursive Verifier: num prefinalized gates = ", base_builder.num_gates);
output.points_accumulator.set_public();
output.ipa_claim.set_public();

{
// IO
RollupIO inputs;
inputs.pairing_inputs = output.points_accumulator;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're tempted to brace this, shouldn't it have a helper method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, thanks for raising this. @federicobarbacovi @ledwards2225 tagging myself and Luke so that we can decide how to handle this.

inputs.ipa_claim = output.ipa_claim;
inputs.set_public();
}

base_builder.ipa_proof = tube_prover.proving_key->ipa_proof;
EXPECT_EQ(base_builder.failed(), false) << base_builder.err();
EXPECT_TRUE(CircuitChecker::check(base_builder));
Expand Down Expand Up @@ -169,9 +182,13 @@ TEST_F(ClientIVCRecursionTests, TubeVKIndependentOfInputCircuits)
StdlibProof stdlib_proof(*tube_builder, proof);
auto client_ivc_rec_verifier_output = verifier.verify(stdlib_proof);

client_ivc_rec_verifier_output.points_accumulator.set_public();
// The tube only calls an IPA recursive verifier once, so we can just add this IPA claim and proof
client_ivc_rec_verifier_output.opening_claim.set_public();
// IO
RollupIO inputs;
inputs.pairing_inputs = client_ivc_rec_verifier_output.points_accumulator;
inputs.ipa_claim = client_ivc_rec_verifier_output.opening_claim;
inputs.set_public();

// The tube only calls an IPA recursive verifier once, so we can just add this IPA proof
tube_builder->ipa_proof = client_ivc_rec_verifier_output.ipa_proof.get_value();

info("ClientIVC Recursive Verifier: num prefinalized gates = ", tube_builder->num_gates);
Expand Down
Loading