Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_relation_consistency.test.cpp
Go to the documentation of this file.
6#include <gtest/gtest.h>
7namespace bb {
8
9// TODO(https://github.com/AztecProtocol/barretenberg/issues/997): Actually create consistency tests for ECCVM relations
10class EccRelationsConsistency : public testing::Test {
11 public:
18 template <template <typename> class Relation> static void validate_relation_execution()
19 {
21 using RecursiveFlavor = ECCVMRecursiveFlavor;
22 using RecursiveRelation = Relation<RecursiveFlavor::FF>;
24 RecursiveFlavor::AllValues input_elements;
25 for (auto& element : input_elements.get_all()) {
26 element = 4;
27 }
28 typename RecursiveRelation::SumcheckArrayOfValuesOverSubrelations accumulator;
29 std::fill(accumulator.begin(), accumulator.end(), typename RecursiveRelation::FF(0));
30 RecursiveRelation::accumulate(accumulator, input_elements, parameters, 1);
31
32 using NativeFlavor = ECCVMFlavor;
33 using NativeRelation = Relation<typename NativeFlavor::FF>;
35 NativeFlavor::AllValues native_input_elements;
36 for (auto& element : native_input_elements.get_all()) {
37 element = 4;
38 }
39 typename NativeRelation::SumcheckArrayOfValuesOverSubrelations native_accumulator;
40 std::fill(native_accumulator.begin(), native_accumulator.end(), typename NativeRelation::FF(0));
41 NativeRelation::accumulate(native_accumulator, native_input_elements, native_parameters, 1);
42
43 for (auto [val, native_val] : zip_view(accumulator, native_accumulator)) {
44 EXPECT_EQ(bb::fq((val.get_value() % uint512_t(bb::fq::modulus)).lo), uint256_t(native_val));
45 }
46 };
47};
48
49TEST_F(EccRelationsConsistency, RecursiveToNativeConsistency)
50{
51
52 validate_relation_execution<ECCVMLookupRelation>();
53 validate_relation_execution<ECCVMSetRelation>();
54 validate_relation_execution<ECCVMMSMRelation>();
55 validate_relation_execution<ECCVMPointTableRelation>();
56 validate_relation_execution<ECCVMTranscriptRelation>();
57 validate_relation_execution<ECCVMWnafRelation>();
58 validate_relation_execution<ECCVMBoolsRelation>();
59}
60} // namespace bb
static void validate_relation_execution()
Validate that we can instantiate ECCVM relations on bigfield and that they return the same values as ...
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
AluTraceBuilder builder
Definition alu.test.cpp:123
Entry point for Barretenberg command-line interface.
TEST_F(IPATest, ChallengesAreZero)
Definition ipa.test.cpp:123
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Container for parameters used by the grand product (permutation, lookup) Honk relations.
static constexpr uint256_t modulus