Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
graph_description_goblin.test.cpp
Go to the documentation of this file.
4
12
14class BoomerangGoblinRecursiveVerifierTests : public testing::Test {
15 public:
19
24
29
31
37
44 {
45 Goblin goblin;
47
48 // Merge the ecc ops from the newly constructed circuit
49 auto goblin_proof = goblin.prove(MergeSettings::APPEND);
50 // Subtable values and commitments - needed for (Recursive)MergeVerifier
51 MergeCommitments merge_commitments;
52 auto t_current = goblin.op_queue->construct_current_ultra_ops_subtable_columns();
53 auto T_prev = goblin.op_queue->construct_previous_ultra_ops_table_columns();
54 CommitmentKey<curve::BN254> pcs_commitment_key(goblin.op_queue->get_ultra_ops_table_num_rows());
55 for (size_t idx = 0; idx < MegaFlavor::NUM_WIRES; idx++) {
56 merge_commitments.t_commitments[idx] = pcs_commitment_key.commit(t_current[idx]);
57 merge_commitments.T_prev_commitments[idx] = pcs_commitment_key.commit(T_prev[idx]);
58 }
59
60 // Output is a goblin proof plus ECCVM/Translator verification keys
61 return { goblin_proof, { std::make_shared<ECCVMVK>(), std::make_shared<TranslatorVK>() }, merge_commitments };
62 }
63};
64
70{
71 auto [proof, verifier_input, merge_commitments] = create_goblin_prover_output();
72
74
75 // Merge commitments
76 RecursiveMergeCommitments recursive_merge_commitments;
77 for (size_t idx = 0; idx < MegaFlavor::NUM_WIRES; idx++) {
78 recursive_merge_commitments.t_commitments[idx] =
79 RecursiveCommitment::from_witness(&builder, merge_commitments.t_commitments[idx]);
80 recursive_merge_commitments.T_prev_commitments[idx] =
81 RecursiveCommitment::from_witness(&builder, merge_commitments.T_prev_commitments[idx]);
82 recursive_merge_commitments.t_commitments[idx].unset_free_witness_tag();
83 recursive_merge_commitments.T_prev_commitments[idx].unset_free_witness_tag();
84 }
85
86 GoblinRecursiveVerifier verifier{ &builder, verifier_input };
87 GoblinRecursiveVerifierOutput output = verifier.verify(proof, recursive_merge_commitments, MergeSettings::APPEND);
89 // Construct and verify a proof for the Goblin Recursive Verifier circuit
90 {
91 auto prover_instance = std::make_shared<OuterProverInstance>(builder);
92 auto verification_key =
93 std::make_shared<typename OuterFlavor::VerificationKey>(prover_instance->get_precomputed());
94 OuterProver prover(prover_instance, verification_key);
95 OuterVerifier verifier(verification_key);
96 auto proof = prover.construct_proof();
97 bool verified = verifier.template verify_proof<bb::DefaultIO>(proof).result;
98
99 ASSERT_TRUE(verified);
100 }
101 auto translator_pairing_points = output.points_accumulator;
102 translator_pairing_points.P0.x.fix_witness();
103 translator_pairing_points.P0.y.fix_witness();
104 translator_pairing_points.P1.x.fix_witness();
105 translator_pairing_points.P1.y.fix_witness();
106 info("Recursive Verifier: num gates = ", builder.num_gates);
107 auto graph = cdg::StaticAnalyzer(builder, false);
108 auto variables_in_one_gate = graph.get_variables_in_one_gate();
109 EXPECT_EQ(variables_in_one_gate.size(), 0);
110}
111
112} // namespace bb::stdlib::recursion::honk
CommitmentKey object over a pairing group 𝔾₁.
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
TranslatorFlavor::VerificationKey TranslatorVerificationKey
Definition goblin.hpp:38
std::shared_ptr< OpQueue > op_queue
Definition goblin.hpp:48
GoblinProof prove(const MergeSettings merge_settings=MergeSettings::PREPEND)
Constuct a full Goblin proof (ECCVM, Translator, merge)
Definition goblin.cpp:52
ECCVMFlavor::VerificationKey ECCVMVerificationKey
Definition goblin.hpp:37
static void construct_and_merge_mock_circuits(Goblin &goblin, const size_t num_circuits=3)
static constexpr size_t NUM_WIRES
typename Curve::AffineElement Commitment
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static ProverOutput create_goblin_prover_output()
Create a goblin proof and the VM verification keys needed by the goblin recursive verifier.
void info(Args... args)
Definition log.hpp:74
AluTraceBuilder builder
Definition alu.test.cpp:123
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
TEST_F(BoomerangGoblinRecursiveVerifierTests, graph_description_basic)
Construct and check a goblin recursive verification circuit.
UltraStaticAnalyzer StaticAnalyzer
Definition graph.hpp:184
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
uint32_t set_public()
Set the witness indices for the limbs of the pairing points to public.