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 Base = Base_
 
using Builder = Base::Builder
 
using AcirConstraint = Base::AcirConstraint
 
using InvalidWitness = Base::InvalidWitness
 
using InvalidWitnessTarget = Base::InvalidWitness::Target
 

Static Public Member Functions

static std::tuple< bool, bool, std::string > test_constraints (AcirConstraint &constraint, WitnessVector &witness_values, const InvalidWitnessTarget &invalid_witness_target)
 General purpose testing function. It tests the constraints based on the 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 586 of file test_class.hpp.

Member Typedef Documentation

◆ AcirConstraint

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

Definition at line 590 of file test_class.hpp.

◆ Base

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

Definition at line 588 of file test_class.hpp.

◆ Builder

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

Definition at line 589 of file test_class.hpp.

◆ InvalidWitness

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

Definition at line 591 of file test_class.hpp.

◆ InvalidWitnessTarget

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

Definition at line 592 of file test_class.hpp.

Member Function Documentation

◆ test_constraints()

template<TestBase Base_>
static std::tuple< bool, bool, std::string > acir_format::TestClass< Base_ >::test_constraints ( AcirConstraint constraint,
WitnessVector witness_values,
const InvalidWitnessTarget invalid_witness_target 
)
inlinestatic

General purpose testing function. It tests the constraints based on the 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 608 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 681 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 632 of file test_class.hpp.


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