@@ -380,8 +380,7 @@ void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath,
380
380
381
381
// Write the proof and verification keys into the working directory in 'binary' format (in practice it seems this
382
382
// directory is passed by bb.js)
383
- std::string vkPath = outputDir + " /final_decider_vk" ; // the vk of the last circuit in the stack
384
- std::string accPath = outputDir + " /pg_acc" ;
383
+ std::string vkPath = outputDir + " /mega_vk" ; // the vk of the last circuit in the stack
385
384
std::string proofPath = outputDir + " /client_ivc_proof" ;
386
385
std::string translatorVkPath = outputDir + " /translator_vk" ;
387
386
std::string eccVkPath = outputDir + " /ecc_vk" ;
@@ -391,12 +390,11 @@ void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath,
391
390
auto translator_vk = std::make_shared<TranslatorVK>(ivc.goblin .get_translator_proving_key ());
392
391
393
392
auto last_vk = std::make_shared<DeciderVerificationKey>(ivc.honk_vk );
394
- vinfo (" ensure valid proof: " , ivc.verify (proof, { ivc. verifier_accumulator , last_vk } ));
393
+ vinfo (" ensure valid proof: " , ivc.verify (proof));
395
394
396
395
vinfo (" write proof and vk data to files.." );
397
396
write_file (proofPath, to_buffer (proof));
398
397
write_file (vkPath, to_buffer (ivc.honk_vk ));
399
- write_file (accPath, to_buffer (ivc.verifier_accumulator ));
400
398
write_file (translatorVkPath, to_buffer (translator_vk));
401
399
write_file (eccVkPath, to_buffer (eccvm_vk));
402
400
}
@@ -419,26 +417,23 @@ template <typename T> std::shared_ptr<T> read_to_shared_ptr(const std::filesyste
419
417
* @return true (resp., false) if the proof is valid (resp., invalid).
420
418
*/
421
419
bool verify_client_ivc (const std::filesystem::path& proof_path,
422
- const std::filesystem::path& accumulator_path,
423
- const std::filesystem::path& final_vk_path,
420
+ const std::filesystem::path& mega_vk,
424
421
const std::filesystem::path& eccvm_vk_path,
425
422
const std::filesystem::path& translator_vk_path)
426
423
{
427
424
init_bn254_crs (1 );
428
425
init_grumpkin_crs (1 << 15 );
429
426
430
427
const auto proof = from_buffer<ClientIVC::Proof>(read_file (proof_path));
431
- const auto accumulator = read_to_shared_ptr<ClientIVC::DeciderVerificationKey>(accumulator_path );
432
- accumulator-> verification_key ->pcs_verification_key = std::make_shared<VerifierCommitmentKey<curve::BN254>>();
433
- const auto final_vk = read_to_shared_ptr<ClientIVC::VerificationKey>(final_vk_path);
428
+ const auto final_vk = read_to_shared_ptr<ClientIVC::VerificationKey>(mega_vk );
429
+ final_vk ->pcs_verification_key = std::make_shared<VerifierCommitmentKey<curve::BN254>>();
430
+
434
431
const auto eccvm_vk = read_to_shared_ptr<ECCVMFlavor::VerificationKey>(eccvm_vk_path);
435
432
eccvm_vk->pcs_verification_key =
436
433
std::make_shared<VerifierCommitmentKey<curve::Grumpkin>>(eccvm_vk->circuit_size + 1 );
437
434
const auto translator_vk = read_to_shared_ptr<TranslatorFlavor::VerificationKey>(translator_vk_path);
438
435
translator_vk->pcs_verification_key = std::make_shared<VerifierCommitmentKey<curve::BN254>>();
439
-
440
- const bool verified = ClientIVC::verify (
441
- proof, accumulator, std::make_shared<ClientIVC::DeciderVerificationKey>(final_vk), eccvm_vk, translator_vk);
436
+ const bool verified = ClientIVC::verify (proof, final_vk, eccvm_vk, translator_vk);
442
437
vinfo (" verified: " , verified);
443
438
return verified;
444
439
}
@@ -499,7 +494,6 @@ void client_ivc_prove_output_all(const std::string& bytecodePath,
499
494
using Builder = Flavor::CircuitBuilder;
500
495
using ECCVMVK = ECCVMFlavor::VerificationKey;
501
496
using TranslatorVK = TranslatorFlavor::VerificationKey;
502
- using DeciderVK = ClientIVC::DeciderVerificationKey;
503
497
504
498
init_bn254_crs (1 << 22 );
505
499
init_grumpkin_crs (1 << 16 );
@@ -531,23 +525,19 @@ void client_ivc_prove_output_all(const std::string& bytecodePath,
531
525
532
526
// Write the proof and verification keys into the working directory in 'binary' format (in practice it seems this
533
527
// directory is passed by bb.js)
534
- std::string vkPath = outputPath + " /final_decider_vk" ; // the vk of the last circuit in the stack
535
- std::string accPath = outputPath + " /pg_acc" ;
528
+ std::string vkPath = outputPath + " /mega_vk" ; // the vk of the last circuit in the stack
536
529
std::string proofPath = outputPath + " /client_ivc_proof" ;
537
530
std::string translatorVkPath = outputPath + " /translator_vk" ;
538
531
std::string eccVkPath = outputPath + " /ecc_vk" ;
539
532
540
533
auto proof = ivc.prove ();
541
534
auto eccvm_vk = std::make_shared<ECCVMVK>(ivc.goblin .get_eccvm_proving_key ());
542
535
auto translator_vk = std::make_shared<TranslatorVK>(ivc.goblin .get_translator_proving_key ());
543
-
544
- auto last_vk = std::make_shared<DeciderVK>(ivc.honk_vk );
545
- vinfo (" ensure valid proof: " , ivc.verify (proof, { ivc.verifier_accumulator , last_vk }));
536
+ vinfo (" ensure valid proof: " , ivc.verify (proof));
546
537
547
538
vinfo (" write proof and vk data to files.." );
548
539
write_file (proofPath, to_buffer (proof));
549
540
write_file (vkPath, to_buffer (ivc.honk_vk )); // maybe dereference
550
- write_file (accPath, to_buffer (ivc.verifier_accumulator ));
551
541
write_file (translatorVkPath, to_buffer (translator_vk));
552
542
write_file (eccVkPath, to_buffer (eccvm_vk));
553
543
}
@@ -561,18 +551,15 @@ void client_ivc_prove_output_all(const std::string& bytecodePath,
561
551
void prove_tube (const std::string& output_path)
562
552
{
563
553
using ClientIVC = stdlib::recursion::honk::ClientIVCRecursiveVerifier;
564
- using StackDeciderVK = ClientIVC::FoldVerifierInput::DeciderVK;
565
554
using StackHonkVK = typename MegaFlavor::VerificationKey;
566
555
using ECCVMVk = ECCVMFlavor::VerificationKey;
567
556
using TranslatorVk = TranslatorFlavor::VerificationKey;
568
- using FoldVerifierInput = ClientIVC::FoldVerifierInput;
569
557
using GoblinVerifierInput = ClientIVC::GoblinVerifierInput;
570
558
using VerifierInput = ClientIVC::VerifierInput;
571
559
using Builder = UltraCircuitBuilder;
572
560
using GrumpkinVk = bb::VerifierCommitmentKey<curve::Grumpkin>;
573
561
574
- std::string vkPath = output_path + " /final_decider_vk" ; // the vk of the last circuit in the stack
575
- std::string accPath = output_path + " /pg_acc" ;
562
+ std::string vkPath = output_path + " /mega_vk" ; // the vk of the last circuit in the stack
576
563
std::string proofPath = output_path + " /client_ivc_proof" ;
577
564
std::string translatorVkPath = output_path + " /translator_vk" ;
578
565
std::string eccVkPath = output_path + " /ecc_vk" ;
@@ -583,10 +570,7 @@ void prove_tube(const std::string& output_path)
583
570
584
571
// Read the proof and verification data from given files
585
572
auto proof = from_buffer<ClientIVC::Proof>(read_file (proofPath));
586
- std::shared_ptr<StackHonkVK> final_stack_vk =
587
- std::make_shared<StackHonkVK>(from_buffer<StackHonkVK>(read_file (vkPath)));
588
- std::shared_ptr<StackDeciderVK> verifier_accumulator =
589
- std::make_shared<StackDeciderVK>(from_buffer<StackDeciderVK>(read_file (accPath)));
573
+ std::shared_ptr<StackHonkVK> mega_vk = std::make_shared<StackHonkVK>(from_buffer<StackHonkVK>(read_file (vkPath)));
590
574
std::shared_ptr<TranslatorVk> translator_vk =
591
575
std::make_shared<TranslatorVk>(from_buffer<TranslatorVk>(read_file (translatorVkPath)));
592
576
std::shared_ptr<ECCVMVk> eccvm_vk = std::make_shared<ECCVMVk>(from_buffer<ECCVMVk>(read_file (eccVkPath)));
@@ -595,30 +579,30 @@ void prove_tube(const std::string& output_path)
595
579
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1025)
596
580
eccvm_vk->pcs_verification_key = std::make_shared<GrumpkinVk>(eccvm_vk->circuit_size + 1 );
597
581
598
- FoldVerifierInput fold_verifier_input{ verifier_accumulator, { final_stack_vk } };
599
582
GoblinVerifierInput goblin_verifier_input{ eccvm_vk, translator_vk };
600
- VerifierInput input{ fold_verifier_input , goblin_verifier_input };
583
+ VerifierInput input{ mega_vk , goblin_verifier_input };
601
584
auto builder = std::make_shared<Builder>();
602
- // Padding needed for sending the right number of public inputs
585
+
586
+ // Preserve the public inputs that should be passed to the base rollup by making them public inputs to the tube
587
+ // circuit
603
588
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1048): INSECURE - make this tube proof actually use
604
- // these public inputs by turning proof into witnesses and call
605
- // set_public on each witness
606
- auto num_public_inputs = static_cast <uint32_t >(static_cast <uint256_t >(proof.folding_proof [1 ]));
607
- num_public_inputs -= bb::AGGREGATION_OBJECT_SIZE; // don't add the agg object
608
- num_public_inputs -= bb::PROPAGATED_DATABUS_COMMITMENTS_SIZE; // exclude propagated databus commitments
589
+ // these public inputs by turning proof into witnesses and calling set_public on each witness
590
+ auto num_public_inputs = static_cast <uint32_t >(static_cast <uint256_t >(proof.mega_proof [1 ]));
591
+ num_public_inputs -= bb::AGGREGATION_OBJECT_SIZE; // don't add the agg object
592
+
609
593
for (size_t i = 0 ; i < num_public_inputs; i++) {
610
- auto offset = acir_format::HONK_RECURSION_PUBLIC_INPUT_OFFSET ;
611
- builder->add_public_variable (proof.folding_proof [i + offset]);
594
+ auto offset = bb::HONK_PROOF_PUBLIC_INPUT_OFFSET ;
595
+ builder->add_public_variable (proof.mega_proof [i + offset]);
612
596
}
613
597
ClientIVC verifier{ builder, input };
614
598
615
599
verifier.verify (proof);
616
600
617
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1069): Add aggregation to goblin recursive verifiers.
618
- // This is currently just setting the aggregation object to the default one.
619
601
AggregationObjectIndices current_aggregation_object =
620
602
stdlib::recursion::init_default_agg_obj_indices<Builder>(*builder);
621
603
604
+ // TODO(https://github.com/AztecProtocol/barretenberg/issues/1069): Add aggregation to goblin recursive verifiers.
605
+ // This is currently just setting the aggregation object to the default one.
622
606
builder->add_recursive_proof (current_aggregation_object);
623
607
624
608
using Prover = UltraProver_<UltraFlavor>;
@@ -1477,15 +1461,11 @@ int main(int argc, char* argv[])
1477
1461
if (command == " verify_client_ivc" ) {
1478
1462
std::filesystem::path output_dir = get_option (args, " -o" , " ./target" );
1479
1463
std::filesystem::path client_ivc_proof_path = output_dir / " client_ivc_proof" ;
1480
- std::filesystem::path accumulator_path = output_dir / " pg_acc" ;
1481
- std::filesystem::path final_vk_path = output_dir / " final_decider_vk" ;
1464
+ std::filesystem::path mega_vk_path = output_dir / " mega_vk" ;
1482
1465
std::filesystem::path eccvm_vk_path = output_dir / " ecc_vk" ;
1483
1466
std::filesystem::path translator_vk_path = output_dir / " translator_vk" ;
1484
1467
1485
- return verify_client_ivc (
1486
- client_ivc_proof_path, accumulator_path, final_vk_path, eccvm_vk_path, translator_vk_path)
1487
- ? 0
1488
- : 1 ;
1468
+ return verify_client_ivc (client_ivc_proof_path, mega_vk_path, eccvm_vk_path, translator_vk_path) ? 0 : 1 ;
1489
1469
}
1490
1470
if (command == " fold_and_verify_program" ) {
1491
1471
return foldAndVerifyProgram (bytecode_path, witness_path) ? 0 : 1 ;
0 commit comments