10#include <gtest/gtest.h>
19class TranslatorTests :
public ::testing::Test {
28 static CircuitBuilder generate_test_circuit(
const Fq& batching_challenge_v,
29 const Fq& evaluation_challenge_x,
30 const size_t circuit_size_parameter = 500)
38 op_queue->no_op_ultra_only();
40 for (
size_t i = 0; i < circuit_size_parameter; i++) {
41 op_queue->add_accumulate(P1);
42 op_queue->mul_accumulate(P2, z);
46 return CircuitBuilder{ batching_challenge_v, evaluation_challenge_x, op_queue };
58TEST_F(TranslatorTests, ProofLengthCheck)
67 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
85 auto initial_transcript = prover_transcript->export_proof();
90 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
98 verifier_transcript->load_proof(initial_transcript);
99 verifier_transcript->template receive_from_prover<Fq>(
"init");
102 bool verified = verifier.
verify_proof(proof, evaluation_challenge_x, batching_challenge_v);
103 EXPECT_TRUE(verified);
120 prover_transcript->export_proof();
128 auto compare_computed_vk_against_fixed = [&](
size_t circuit_size_parameter) {
129 CircuitBuilder circuit_builder =
130 generate_test_circuit(batching_challenge_v, evaluation_challenge_x, circuit_size_parameter);
134 auto labels = TranslatorFlavor::VerificationKey::get_labels();
136 for (
auto [vk_commitment, fixed_commitment] :
zip_view(computed_vk.get_all(), fixed_vk.get_all())) {
137 EXPECT_EQ(vk_commitment, fixed_commitment)
138 <<
"Mismatch between computed vk_commitment and fixed_commitment at label: " << labels[index];
142 EXPECT_EQ(computed_vk, fixed_vk);
146 const size_t circuit_size_parameter_1 = 1 << 2;
147 const size_t circuit_size_parameter_2 = 1 << 3;
149 compare_computed_vk_against_fixed(circuit_size_parameter_1);
150 compare_computed_vk_against_fixed(circuit_size_parameter_2);
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Used to construct execution trace representations of elliptic curve operations.
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
TranslatorCircuitBuilder CircuitBuilder
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
NativeTranscript Transcript
HonkProof construct_proof()
bool verify_proof(const HonkProof &proof, const uint256_t &evaluation_input_x, const BF &batching_challenge_v)
This function verifies a TranslatorFlavor Honk proof for given program settings.
static affine_element random_element(numeric::RNG *engine=nullptr) noexcept
Samples a random point on the curve.
group_elements::affine_element< Fq, Fr, Params > affine_element
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
field< Bn254FqParams > fq
TEST_F(IPATest, ChallengesAreZero)
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
static field random_element(numeric::RNG *engine=nullptr) noexcept