Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gate_separator.test.cpp
Go to the documentation of this file.
1#include "gate_separator.hpp"
3#include <gtest/gtest.h>
4
5using namespace bb;
6
7TEST(GateSeparatorPolynomial, FullPowConsistency)
8{
9 constexpr size_t d = 5;
10 std::vector<fr> betas(d);
11 for (auto& beta : betas) {
12 beta = fr::random_element();
13 }
14
16 std::array<fr, d> variables{};
17 for (auto& u_i : variables) {
18 u_i = fr::random_element();
19 poly.partially_evaluate(u_i);
20 }
21
22 size_t beta_idx = 0;
23 fr expected_eval = 1;
24 for (auto& u_i : variables) {
25 expected_eval *= fr(1) - u_i + u_i * poly.betas[beta_idx];
26 beta_idx++;
27 }
28
29 EXPECT_EQ(poly.partial_evaluation_result, expected_eval);
30}
31
32TEST(GateSeparatorPolynomial, GateSeparatorPolynomialsOnPowers)
33{
34 std::vector<fr> betas{ 2, 4, 16 };
36 std::vector<fr> expected_values{ 1, 2, 4, 8, 16, 32, 64, 128 };
37 EXPECT_EQ(expected_values, poly.beta_products);
38}
std::vector< FF > betas
The challenges .
Entry point for Barretenberg command-line interface.
TEST(MegaCircuitBuilder, CopyConstructor)
field< Bn254FrParams > fr
Definition fr.hpp:174
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Implementation of the methods for the -polynomials used in Protogalaxy and -polynomials used in Sumch...
std::vector< FF > beta_products
The consecutive evaluations for identified with the integers .
std::vector< FF > betas
The challenges .
void partially_evaluate(FF challenge)
Partially evaluate the -polynomial at the new challenge and update .
FF partial_evaluation_result
The value obtained by partially evaluating one variable in the power polynomial at each round....
static field random_element(numeric::RNG *engine=nullptr) noexcept