Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
multi_scalar_mul.test.cpp
Go to the documentation of this file.
2#include "acir_format.hpp"
6
7#include <cstdint>
8#include <gtest/gtest.h>
9#include <vector>
10
11namespace acir_format::tests {
12
13using namespace bb;
14
15class MSMTests : public ::testing::Test {
16 protected:
18};
20
26{
27 MultiScalarMul msm_constrain{
29 .index = 0,
30 .value = fr(1),
31 .is_constant = true,
32 },
34 .index = 0,
35 .value = fr("0x0000000000000002cf135e7506a45d632d270d45f1181294833fc48d823f272c"),
36 .is_constant = true,
37 },
39 .index = 0,
40 .value = fr(0),
41 .is_constant = true,
42 } },
43 .scalars = { WitnessOrConstant<fr>{
44 .index = 0,
45 .value = fr(std::string("0x000000000000000000000000000000000000000000000000000000616c696365")),
46 .is_constant = false,
47 },
49 .index = 0,
50 .value = fr(0),
51 .is_constant = true,
52 } },
53
54 .out_point_x = 1,
55 .out_point_y = 2,
56 .out_point_is_infinite = 3,
57 };
58
59 AcirFormat constraint_system{
60 .varnum = 9,
61 .num_acir_opcodes = 1,
62 .public_inputs = {},
63 .multi_scalar_mul_constraints = { msm_constrain },
64 .original_opcode_indices = create_empty_original_opcode_indices(),
65 };
66 mock_opcode_indices(constraint_system);
67
68 WitnessVector witness{
69 fr("0x000000000000000000000000000000000000000000000000000000616c696365"),
70 fr("0x0bff8247aa94b08d1c680d7a3e10831bd8c8cf2ea2c756b0d1d89acdcad877ad"),
71 fr("0x2a5d7253a6ed48462fedb2d350cc768d13956310f54e73a8a47914f34a34c5c4"),
72 fr(0),
73 };
74
75 AcirProgram program{ constraint_system, witness };
76 auto builder = create_circuit(program);
77
78 EXPECT_TRUE(CircuitChecker::check(builder));
79}
80
81} // namespace acir_format::tests
acir_format::AcirFormatOriginalOpcodeIndices create_empty_original_opcode_indices()
void mock_opcode_indices(acir_format::AcirFormat &constraint_system)
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
AluTraceBuilder builder
Definition alu.test.cpp:123
field< Bn254FrParams > fr
UltraCircuitBuilder create_circuit(AcirProgram &program, const ProgramMetadata &metadata)
Specialization for creating an Ultra circuit from an acir program.
bb::SlabVector< bb::fr > WitnessVector
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
TEST_F(IPATest, ChallengesAreZero)
Definition ipa.test.cpp:123
std::vector< WitnessOrConstant< bb::fr > > points