Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
acir_format::TestClass< Base > Class Template Reference

#include <test_class.hpp>

Public Types

using Builder = Base::Builder
 
using AcirConstraint = Base::AcirConstraint
 
using InvalidWitness = Base::InvalidWitness
 
using InvalidWitnessTarget = Base::InvalidWitness::Target
 

Static Public Member Functions

static std::pair< AcirConstraint, WitnessVectorgenerate_constraints (const InvalidWitnessTarget &invalid_witness_target=InvalidWitnessTarget::None)
 Generate constraints and witness values based on the invalidation target.
 
static std::tuple< bool, bool, std::string > test_constraints (const InvalidWitnessTarget &invalid_witness_target)
 General purpose testing function. It generates the test based on the predicate and invalidation target.
 
template<typename Flavor >
static size_t test_vk_independence ()
 Test vk generation is independent of the witness values supplied.
 
static std::vector< std::string > test_tampering ()
 Test all invalid witness targets.
 

Detailed Description

template<TestBase Base>
class acir_format::TestClass< Base >

Definition at line 558 of file test_class.hpp.

Member Typedef Documentation

◆ AcirConstraint

template<TestBase Base>
using acir_format::TestClass< Base >::AcirConstraint = Base::AcirConstraint

Definition at line 561 of file test_class.hpp.

◆ Builder

template<TestBase Base>
using acir_format::TestClass< Base >::Builder = Base::Builder

Definition at line 560 of file test_class.hpp.

◆ InvalidWitness

template<TestBase Base>
using acir_format::TestClass< Base >::InvalidWitness = Base::InvalidWitness

Definition at line 562 of file test_class.hpp.

◆ InvalidWitnessTarget

template<TestBase Base>
using acir_format::TestClass< Base >::InvalidWitnessTarget = Base::InvalidWitness::Target

Definition at line 563 of file test_class.hpp.

Member Function Documentation

◆ generate_constraints()

template<TestBase Base>
static std::pair< AcirConstraint, WitnessVector > acir_format::TestClass< Base >::generate_constraints ( const InvalidWitnessTarget invalid_witness_target = InvalidWitnessTarget::None)
inlinestatic

Generate constraints and witness values based on the invalidation target.

Definition at line 568 of file test_class.hpp.

◆ test_constraints()

template<TestBase Base>
static std::tuple< bool, bool, std::string > acir_format::TestClass< Base >::test_constraints ( const InvalidWitnessTarget invalid_witness_target)
inlinestatic

General purpose testing function. It generates the test based on the predicate and invalidation target.

In a real flow, we have: Noir --> ACIR --> Bytes --> AcirFormat (via circuit_buf_to_acir_format) --> Builder We simulate the above flow by generating an AcirConstraint (one of the constraints stored in an AcirFormat struct), rewinding it into its Acir::Opcode form (which is the output of the byte deserialization step in the diagram above), and then feeding it into circuit_serde_to_acir_format as an Acir::Circuit with a single opcode. The function circuit_buf_to_acir_format internally calls circuit_serde_to_acir_format after having deserialized the byte buffer to an Acir::Circuit, so the flow in this test is the same as the real flow, minus the byte serialization/deserialization. The rationale for doing the rewinding is ensuring that barretenberg internally tests circuit_serde_to_acir_format, which would otherwise only be tested via the tests in acir_tests.

Definition at line 596 of file test_class.hpp.

◆ test_tampering()

template<TestBase Base>
static std::vector< std::string > acir_format::TestClass< Base >::test_tampering ( )
inlinestatic

Test all invalid witness targets.

Returns
std::vector<std::string> List of error messages from the builder for each invalid witness target.

Definition at line 664 of file test_class.hpp.

◆ test_vk_independence()

template<TestBase Base>
template<typename Flavor >
static size_t acir_format::TestClass< Base >::test_vk_independence ( )
inlinestatic

Test vk generation is independent of the witness values supplied.

This function tests that the verification key is deterministic and independent of the witness values by going through the full ACIR flow.

Template Parameters
Flavor

Definition at line 618 of file test_class.hpp.


The documentation for this class was generated from the following file: