Skip to content

Commit

Permalink
Remove create_verifier_instance
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Mar 1, 2024
1 parent 2c702c5 commit 24a53a9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ class GoblinRecursionTests : public ::testing::Test {
using GoblinUltraBuilder = GoblinUltraCircuitBuilder;
using KernelInput = Goblin::AccumulationOutput;
using ProverInstance = ProverInstance_<GoblinUltraFlavor>;
using VerifierInstance = VerifierInstance_<GoblinUltraFlavor>;

static Goblin::AccumulationOutput construct_accumulator(GoblinUltraBuilder& builder)
{
GoblinUltraComposer composer;
auto prover_instance = std::make_shared<ProverInstance>(builder);
auto verifier_instance = composer.create_verifier_instance(prover_instance);
auto verifier_instance = std::make_shared<VerifierInstance>(prover_instance->verification_key);
auto prover = composer.create_prover(prover_instance);
auto ultra_proof = prover.construct_proof();
return { ultra_proof, verifier_instance->verification_key };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ template <typename RecursiveFlavor> class ProtoGalaxyRecursiveTests : public tes

auto prover_instance_1 = std::make_shared<ProverInstance>(builder1);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder2);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
auto folding_prover = composer.create_folding_prover({ prover_instance_1, prover_instance_2 });
auto folding_verifier = composer.create_folding_verifier({ verifier_instance_1, verifier_instance_2 });

Expand Down Expand Up @@ -170,9 +170,9 @@ template <typename RecursiveFlavor> class ProtoGalaxyRecursiveTests : public tes

Composer composer = Composer();
auto prover_instance_1 = std::make_shared<ProverInstance>(builder1);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder2);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
// Generate a folding proof
auto folding_prover = composer.create_folding_prover({ prover_instance_1, prover_instance_2 });
auto folding_proof = folding_prover.fold_instances();
Expand Down Expand Up @@ -232,9 +232,9 @@ template <typename RecursiveFlavor> class ProtoGalaxyRecursiveTests : public tes

Composer composer = Composer();
auto prover_instance_1 = std::make_shared<ProverInstance>(builder1);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder2);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
// Generate a folding proof
auto folding_prover = composer.create_folding_prover({ prover_instance_1, prover_instance_2 });
auto folding_proof = folding_prover.fold_instances();
Expand Down Expand Up @@ -336,7 +336,7 @@ template <typename RecursiveFlavor> class ProtoGalaxyRecursiveTests : public tes
Builder builder;
create_function_circuit(builder);
auto prover_inst = std::make_shared<ProverInstance>(builder);
auto verifier_inst = composer.create_verifier_instance(prover_inst);
auto verifier_inst = std::make_shared<VerifierInstance>(prover_inst->verification_key);

prover_accumulator->prover_polynomials.w_l[1] = FF::random_element();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ template <typename Flavor> class ProtoGalaxyTests : public testing::Test {
construct_circuit(builder_1);

auto prover_instance_1 = std::make_shared<ProverInstance>(builder_1);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);

auto builder_2 = typename Flavor::CircuitBuilder();
construct_circuit(builder_2);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder_2);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
auto [prover_accumulator, verifier_accumulator] = fold_and_verify(
{ prover_instance_1, prover_instance_2 }, { verifier_instance_1, verifier_instance_2 }, composer);

Expand All @@ -313,7 +313,7 @@ template <typename Flavor> class ProtoGalaxyTests : public testing::Test {
auto builder_3 = typename Flavor::CircuitBuilder();
construct_circuit(builder_3);
auto prover_instance_3 = std::make_shared<ProverInstance>(builder_3);
auto verifier_instance_3 = composer.create_verifier_instance(prover_instance_3);
auto verifier_instance_3 = std::make_shared<VerifierInstance>(prover_instance_3->verification_key);

auto [prover_accumulator_2, verifier_accumulator_2] = fold_and_verify(
{ prover_accumulator, prover_instance_3 }, { verifier_accumulator, verifier_instance_3 }, composer);
Expand All @@ -334,12 +334,12 @@ template <typename Flavor> class ProtoGalaxyTests : public testing::Test {
construct_circuit(builder_1);

auto prover_instance_1 = std::make_shared<ProverInstance>(builder_1);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);

auto builder_2 = typename Flavor::CircuitBuilder();
construct_circuit(builder_2);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder_2);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
auto [prover_accumulator, verifier_accumulator] = fold_and_verify(
{ prover_instance_1, prover_instance_2 }, { verifier_instance_1, verifier_instance_2 }, composer);
check_accumulator_target_sum_manual(prover_accumulator, true);
Expand All @@ -348,7 +348,7 @@ template <typename Flavor> class ProtoGalaxyTests : public testing::Test {
auto builder_3 = typename Flavor::CircuitBuilder();
construct_circuit(builder_3);
auto prover_instance_3 = std::make_shared<ProverInstance>(builder_3);
auto verifier_instance_3 = composer.create_verifier_instance(prover_instance_3);
auto verifier_instance_3 = std::make_shared<VerifierInstance>(prover_instance_3->verification_key);

auto [prover_accumulator_2, verifier_accumulator_2] = fold_and_verify(
{ prover_accumulator, prover_instance_3 }, { verifier_accumulator, verifier_instance_3 }, composer);
Expand All @@ -370,20 +370,20 @@ template <typename Flavor> class ProtoGalaxyTests : public testing::Test {
construct_circuit(builder_1);

auto prover_instance_1 = std::make_shared<ProverInstance>(builder_1);
auto verifier_instance_1 = composer.create_verifier_instance(prover_instance_1);
auto verifier_instance_1 = std::make_shared<VerifierInstance>(prover_instance_1->verification_key);

auto builder_2 = typename Flavor::CircuitBuilder();
construct_circuit(builder_2);
auto prover_instance_2 = std::make_shared<ProverInstance>(builder_2);
auto verifier_instance_2 = composer.create_verifier_instance(prover_instance_2);
auto verifier_instance_2 = std::make_shared<VerifierInstance>(prover_instance_2->verification_key);
auto [prover_accumulator, verifier_accumulator] = fold_and_verify(
{ prover_instance_1, prover_instance_2 }, { verifier_instance_1, verifier_instance_2 }, composer);
check_accumulator_target_sum_manual(prover_accumulator, true);

auto builder_3 = typename Flavor::CircuitBuilder();
construct_circuit(builder_3);
auto prover_instance_3 = std::make_shared<ProverInstance>(builder_3);
auto verifier_instance_3 = composer.create_verifier_instance(prover_instance_3);
auto verifier_instance_3 = std::make_shared<VerifierInstance>(prover_instance_3->verification_key);

prover_accumulator->prover_polynomials.w_l[1] = FF::random_element();
auto [prover_accumulator_2, verifier_accumulator_2] = fold_and_verify(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

namespace bb {

template <IsUltraFlavor Flavor>
std::shared_ptr<VerifierInstance_<Flavor>> UltraComposer_<Flavor>::create_verifier_instance(
std::shared_ptr<ProverInstance_<Flavor>>& prover_instance)
{
auto instance = std::make_shared<VerifierInstance>(prover_instance->verification_key);
return instance;
}

template <IsUltraFlavor Flavor>
UltraProver_<Flavor> UltraComposer_<Flavor>::create_prover(const std::shared_ptr<ProverInstance>& instance,
const std::shared_ptr<Transcript>& transcript)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ template <IsUltraFlavor Flavor_> class UltraComposer_ {
using ProverInstances = ProverInstances_<Flavor>;
using VerifierInstances = VerifierInstances_<Flavor>;

/**
* @brief Create a verifier instance object.
*
* @details Currently use prover instance
*/
std::shared_ptr<VerifierInstance> create_verifier_instance(std::shared_ptr<ProverInstance>&);

UltraProver_<Flavor> create_prover(const std::shared_ptr<ProverInstance>&,
const std::shared_ptr<Transcript>& transcript = std::make_shared<Transcript>());

Expand Down

0 comments on commit 24a53a9

Please sign in to comment.