Skip to content

Commit

Permalink
verifying final ultra proof
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Dec 7, 2023
1 parent 46e56ad commit 1af36d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class GoblinRecursionTests : public ::testing::Test {
using RecursiveVerifier = proof_system::plonk::stdlib::recursion::honk::UltraRecursiveVerifier_<RecursiveFlavor>;
using Goblin = barretenberg::Goblin;
using KernelInput = Goblin::AccumulationOutput;
using UltraVerifier = UltraVerifier_<flavor::GoblinUltra>;

/**
* @brief Construct a mock kernel circuit
Expand Down Expand Up @@ -87,9 +88,12 @@ TEST_F(GoblinRecursionTests, Pseudo)
}

Goblin::Proof proof = goblin.prove();
// WORKTODO: verify(kernel_input.proof)
// Verify the final ultra proof
UltraVerifier ultra_verifier{ kernel_input.verification_key };
bool ultra_verified = ultra_verifier.verify_proof(kernel_input.proof);
// Verify the goblin proof (eccvm, translator, merge)
bool verified = goblin.verify(proof);
EXPECT_TRUE(verified);
EXPECT_TRUE(ultra_verified && verified);
}

// TODO(https://github.com/AztecProtocol/barretenberg/issues/787) Expand these tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ UltraVerifier_<Flavor>::UltraVerifier_(const std::shared_ptr<Transcript>& transc
, transcript(transcript)
{}

template <typename Flavor>
UltraVerifier_<Flavor>::UltraVerifier_(const std::shared_ptr<VerificationKey>& verifier_key)
: key(verifier_key)
, pcs_verification_key(std::make_unique<VerifierCommitmentKey>(0, barretenberg::srs::get_crs_factory()))
, transcript(std::make_shared<Transcript>())
{}

template <typename Flavor>
UltraVerifier_<Flavor>::UltraVerifier_(UltraVerifier_&& other)
: key(std::move(other.key))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "barretenberg/flavor/goblin_ultra.hpp"
#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
#include "barretenberg/srs/global_crs.hpp"
#include "barretenberg/sumcheck/sumcheck.hpp"

namespace proof_system::honk {
Expand All @@ -15,6 +16,7 @@ template <typename Flavor> class UltraVerifier_ {
public:
explicit UltraVerifier_(const std::shared_ptr<Transcript>& transcript,
const std::shared_ptr<VerificationKey>& verifier_key = nullptr);
explicit UltraVerifier_(const std::shared_ptr<VerificationKey>& verifier_key);
UltraVerifier_(UltraVerifier_&& other);

UltraVerifier_& operator=(const UltraVerifier_& other) = delete;
Expand Down

0 comments on commit 1af36d7

Please sign in to comment.