barretenberg
Loading...
Searching...
No Matches
protogalaxy_verifier.hpp
1#pragma once
3#include "barretenberg/flavor/goblin_ultra.hpp"
4#include "barretenberg/flavor/ultra.hpp"
5#include "barretenberg/protogalaxy/folding_result.hpp"
6#include "barretenberg/sumcheck/instance/instances.hpp"
7#include "barretenberg/transcript/transcript.hpp"
8
9namespace proof_system::honk {
10template <class VerifierInstances> class ProtoGalaxyVerifier_ {
11 public:
12 using Flavor = typename VerifierInstances::Flavor;
13 using Transcript = typename Flavor::Transcript;
14 using FF = typename Flavor::FF;
15 using Commitment = typename Flavor::Commitment;
16 using Instance = typename VerifierInstances::Instance;
17 using VerificationKey = typename Flavor::VerificationKey;
18 using WitnessCommitments = typename Flavor::WitnessCommitments;
19 using CommitmentLabels = typename Flavor::CommitmentLabels;
20
21 VerifierInstances instances;
22
23 std::shared_ptr<Transcript> transcript = std::make_shared<Transcript>();
24
25 CommitmentLabels commitment_labels;
26
27 ProtoGalaxyVerifier_(VerifierInstances insts)
28 : instances(insts){};
29 ~ProtoGalaxyVerifier_() = default;
34 static std::vector<FF> compute_round_challenge_pows(size_t log_instance_size, FF round_challenge)
35 {
36 std::vector<FF> pows(log_instance_size);
37 pows[0] = round_challenge;
38 for (size_t i = 1; i < log_instance_size; i++) {
39 pows[i] = pows[i - 1].sqr();
40 }
41 return pows;
42 }
43
44 static std::vector<FF> update_gate_challenges(const FF perturbator_challenge,
45 const std::vector<FF>& gate_challenges,
46 const std::vector<FF>& round_challenges)
47 {
48 auto log_instance_size = gate_challenges.size();
49 std::vector<FF> next_gate_challenges(log_instance_size);
50 next_gate_challenges[0] = 1;
51
52 for (size_t idx = 1; idx < log_instance_size; idx++) {
53 next_gate_challenges[idx] = gate_challenges[idx] + perturbator_challenge * round_challenges[idx - 1];
54 }
55 return next_gate_challenges;
56 }
57
58 std::shared_ptr<Instance> get_accumulator() { return instances[0]; }
59
65 void prepare_for_folding(const std::vector<uint8_t>&);
66
71 void receive_accumulator(const std::shared_ptr<Instance>&, const std::string&);
72
77 void receive_and_finalise_instance(const std::shared_ptr<Instance>&, const std::string&);
78
84 bool verify_folding_proof(std::vector<uint8_t>);
85};
86
87extern template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::Ultra, 2>>;
88extern template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::GoblinUltra, 2>>;
89} // namespace proof_system::honk
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Definition: transcript.hpp:62
Definition: protogalaxy_verifier.hpp:10
bool verify_folding_proof(std::vector< uint8_t >)
Run the folding protocol on the verifier side to establish whether the public data ϕ of the new accum...
Definition: protogalaxy_verifier.cpp:129
void receive_and_finalise_instance(const std::shared_ptr< Instance > &, const std::string &)
Process the public data ϕ for the Instances to be folded.
Definition: protogalaxy_verifier.cpp:54
void receive_accumulator(const std::shared_ptr< Instance > &, const std::string &)
Instantiatied the accumulator (i.e. the relaxed instance) from the transcript.
Definition: protogalaxy_verifier.cpp:6
static std::vector< FF > compute_round_challenge_pows(size_t log_instance_size, FF round_challenge)
Given a new round challenge δ for each iteration of the full ProtoGalaxy protocol,...
Definition: protogalaxy_verifier.hpp:34
void prepare_for_folding(const std::vector< uint8_t > &)
Instatiate the instances and the transcript.
Definition: protogalaxy_verifier.cpp:107
A container for commitment labels.
Definition: goblin_translator.hpp:1022
VerificationKey_< PrecomputedEntities< Commitment > > VerificationKey
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: goblin_translator.hpp:941
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
Defines particular circuit builder types expected to be used for circuit construction in stdlib and c...
Definition: claim.hpp:6