Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bb): Reuse entities from GoblinUltra in GoblinUltraRecursive #3521

Merged
merged 5 commits into from
Dec 1, 2023
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
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ template <typename Flavor> bool ECCVMVerifier_<Flavor>::verify_proof(const plonk

transcript = Transcript{ proof.proof_data };

auto commitments = VerifierCommitments(key, transcript);
auto commitment_labels = CommitmentLabels();
VerifierCommitments commitments{ key };
CommitmentLabels commitment_labels;

const auto circuit_size = transcript.template receive_from_prover<uint32_t>("circuit_size");

Expand Down
13 changes: 4 additions & 9 deletions barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,17 +519,12 @@ template <typename CycleGroup_T, typename Curve_T, typename PCS_T> class ECCVMBa
};

class VerifierCommitments : public AllEntities<Commitment> {
private:
using Base = AllEntities<Commitment>;

public:
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key,
[[maybe_unused]] const BaseTranscript& transcript)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
Copy link
Contributor

Choose a reason for hiding this comment

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

thank you

{
static_cast<void>(transcript);
Base::lagrange_first = verification_key->lagrange_first;
Base::lagrange_second = verification_key->lagrange_second;
Base::lagrange_last = verification_key->lagrange_last;
this->lagrange_first = verification_key->lagrange_first;
this->lagrange_second = verification_key->lagrange_second;
this->lagrange_last = verification_key->lagrange_last;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,8 @@ class AvmMiniFlavor {
using Base = AllEntities<Commitment>;

public:
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key, const BaseTranscript& transcript)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
{
static_cast<void>(transcript);
avmMini_clk = verification_key->avmMini_clk;
avmMini_first = verification_key->avmMini_first;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,8 @@ class FibFlavor {
using Base = AllEntities<Commitment>;

public:
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key, const BaseTranscript& transcript)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
{
static_cast<void>(transcript);
Fibonacci_LAST = verification_key->Fibonacci_LAST;
Fibonacci_FIRST = verification_key->Fibonacci_FIRST;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,7 @@ class GoblinTranslator {

class VerifierCommitments : public AllEntities<Commitment> {
public:
VerifierCommitments([[maybe_unused]] std::shared_ptr<VerificationKey> verification_key,
[[maybe_unused]] const BaseTranscript& transcript)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
{
this->lagrange_first = verification_key->lagrange_first;
this->lagrange_last = verification_key->lagrange_last;
Expand Down
326 changes: 160 additions & 166 deletions barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp

Large diffs are not rendered by default.

471 changes: 22 additions & 449 deletions barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions barretenberg/cpp/src/barretenberg/flavor/ultra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,8 @@ class Ultra {

class VerifierCommitments : public AllEntities<Commitment> {
public:
VerifierCommitments(std::shared_ptr<VerificationKey> verification_key,
[[maybe_unused]] const BaseTranscript& transcript)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
{
static_cast<void>(transcript);
q_m = verification_key->q_m;
q_l = verification_key->q_l;
q_r = verification_key->q_r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ template <typename BuilderType> class UltraRecursive_ {

class VerifierCommitments : public AllEntities<Commitment> {
public:
VerifierCommitments(std::shared_ptr<VerificationKey> verification_key)
VerifierCommitments(const std::shared_ptr<VerificationKey>& verification_key)
{
this->q_m = verification_key->q_m;
this->q_l = verification_key->q_l;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ std::array<typename Flavor::GroupElement, 2> UltraRecursiveVerifier_<Flavor>::ve

transcript = Transcript<Builder>{ builder, proof.proof_data };

auto commitments = VerifierCommitments(key);
auto commitment_labels = CommitmentLabels();
VerifierCommitments commitments{ key };
CommitmentLabels commitment_labels;

const auto circuit_size = transcript.template receive_from_prover<uint32_t>("circuit_size");
const auto public_input_size = transcript.template receive_from_prover<uint32_t>("public_input_size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool GoblinTranslatorVerifier::verify_proof(const plonk::proof& proof)
{
transcript = BaseTranscript{ proof.proof_data };

Flavor::VerifierCommitments commitments{ key, transcript };
Flavor::VerifierCommitments commitments{ key };
Flavor::CommitmentLabels commitment_labels;

// TODO(Adrian): Change the initialization of the transcript to take the VK hash?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ template <typename Flavor> bool UltraVerifier_<Flavor>::verify_proof(const plonk

transcript = BaseTranscript{ proof.proof_data };

auto commitments = VerifierCommitments(key, transcript);
auto commitment_labels = CommitmentLabels();
VerifierCommitments commitments{ key };
CommitmentLabels commitment_labels;

// TODO(Adrian): Change the initialization of the transcript to take the VK hash?
const auto circuit_size = transcript.template receive_from_prover<uint32_t>("circuit_size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ bool AvmMiniVerifier::verify_proof(const plonk::proof& proof)

transcript = BaseTranscript{ proof.proof_data };

auto commitments = VerifierCommitments(key, transcript);
auto commitment_labels = CommitmentLabels();
VerifierCommitments commitments{ key };
CommitmentLabels commitment_labels;

const auto circuit_size = transcript.template receive_from_prover<uint32_t>("circuit_size");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ bool FibVerifier::verify_proof(const plonk::proof& proof)

transcript = BaseTranscript{ proof.proof_data };

auto commitments = VerifierCommitments(key, transcript);
auto commitment_labels = CommitmentLabels();
VerifierCommitments commitments{ key };
CommitmentLabels commitment_labels;

const auto circuit_size = transcript.template receive_from_prover<uint32_t>("circuit_size");

Expand Down