Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
acir_loader.cpp
Go to the documentation of this file.
1#include "acir_loader.hpp"
7#include <fstream>
8#include <string>
9#include <vector>
10
11std::vector<uint8_t> readFile(std::string filename)
12{
13 std::ifstream file(filename, std::ios::binary);
14 file.unsetf(std::ios::skipws);
15
16 std::streampos fileSize;
17
18 file.seekg(0, std::ios::end);
19 fileSize = file.tellg();
20 file.seekg(0, std::ios::beg);
21
22 std::vector<uint8_t> vec;
23
24 vec.insert(vec.begin(), std::istream_iterator<uint8_t>(file), std::istream_iterator<uint8_t>());
25 file.close();
26 return vec;
27}
28
35
37{
39 auto builder = acir_format::create_circuit<bb::UltraCircuitBuilder>(program);
40 builder.set_variable_name(0, "a");
41 builder.set_variable_name(1, "b");
42 builder.set_variable_name(2, "c");
43 return builder;
44}
45
47{
49 // In circuits generated by the shift left (shl) opcode, there is a variable with bit length 197.
50 // This is likely because the shl operation internally calls truncate opcode to handle overflow
52}
53
58
64
70
std::vector< uint8_t > readFile(std::string filename)
acir_format::AcirFormat constraint_system
The parsed constraint system from the ACIR program.
msgpack::sbuffer circuit_buf
Buffer for circuit serialization using MessagePack.
smt_solver::Solver get_smt_solver()
Gets an SMT solver instance.
smt_circuit::UltraCircuit get_field_smt_circuit(smt_solver::Solver *solver)
Creates an SMT circuit for field operations.
std::string instruction_name
Name of the instruction/filename being processed.
AcirToSmtLoader()=delete
smt_circuit::CircuitSchema get_circuit_schema()
Gets the circuit schema from the loaded ACIR program.
bb::UltraCircuitBuilder get_circuit_builder()
Creates a circuit builder for the loaded program.
smt_circuit::UltraCircuit get_bitvec_smt_circuit(smt_solver::Solver *solver)
Creates an SMT circuit for bitvector operations.
smt_circuit::UltraCircuit get_integer_smt_circuit(smt_solver::Solver *solver)
Creates an SMT circuit for integer operations.
msgpack::sbuffer export_circuit() override
Symbolic Circuit class for Standard Circuit Builder.
Class for the solver.
Definition solver.hpp:80
AluTraceBuilder builder
Definition alu.test.cpp:124
AcirFormat circuit_buf_to_acir_format(std::vector< uint8_t > &&buf)
Convert a buffer representing a circuit into Barretenberg's internal AcirFormat representation.
CircuitSchema unpack_from_buffer(const msgpack::sbuffer &buf)
Get the CircuitSchema object.
const SolverConfiguration default_solver_config
Definition solver.hpp:37
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Serialized state of a circuit.