15 if (c >=
'0' && c <=
'9') {
16 return static_cast<uint8_t
>(c -
'0');
18 if (c >=
'a' && c <=
'f') {
19 return static_cast<uint8_t
>(10 + (c -
'a'));
21 if (c >=
'A' && c <=
'F') {
22 return static_cast<uint8_t
>(10 + (c -
'A'));
24 throw std::invalid_argument(std::string(
"Invalid hex character: '") + c +
"'");
32 if (str.size() >= 2 && (str[0] ==
'0') && (str[1] ==
'x' || str[1] ==
'X')) {
35 size_t hex_len = str.size() -
offset;
38 throw std::invalid_argument(
39 "Hex string must be exactly 64 characters (32 bytes), excluding optional 0x prefix");
41 std::vector<uint8_t> bytes;
43 for (
size_t i = 0; i < hex_len; i += 2) {
46 bytes.push_back(
static_cast<uint8_t
>((high << 4) | low));
60 std::vector<bb::fr> witness_values;
72 for (
size_t i = 0; i < num_constraints; ++i) {
88 assert_zero.
value = expr;
90 opcode.
value = assert_zero;
91 circuit.
opcodes.push_back(opcode);
110 uint32_t witness_idx = 0;
111 for (
size_t i = 0; i < num_constraints; ++i) {
112 for (
size_t j = 0; j < 3; ++j) {
117 witness_stack.
stack.push_back(stack_item);
131 std::vector<Acir::FunctionInput> vk_inputs;
132 for (uint32_t i = 0; i < vk_size; i++) {
145 size_t total_num_witnesses = vk_size + 1;
158 .key_hash = key_hash,
161 .predicate = predicate };
164 black_box_call.
value = recursion;
185 kernel_witness.
stack.push_back({});
186 for (uint32_t i = 0; i < app_vk_fields.size(); i++) {
187 std::stringstream ss;
188 ss << app_vk_fields[i];
191 std::stringstream ss;
192 ss << crypto::Poseidon2<crypto::Poseidon2Bn254ScalarFieldParams>::hash(app_vk_fields);
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > create_simple_circuit_bytecode(size_t num_constraints=1)
Helper function to create a minimal circuit bytecode and witness for testing.
std::vector< uint8_t > create_simple_kernel(size_t vk_size, bool is_init_kernel)
Create a simple kernel circuit for IVC testing.
std::vector< uint8_t > create_kernel_witness(const std::vector< bb::fr > &app_vk_fields)
Create a kernel witness for IVC testing.
uint8_t hex_char_to_value(char c)
std::vector< uint8_t > hex_string_to_bytes(const std::string &str)
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< Acir::FunctionInput > verification_key
std::variant< AES128Encrypt, AND, XOR, RANGE, Blake2s, Blake3, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Keccakf1600, RecursiveAggregation, Poseidon2Permutation, Sha256Compression > value
Acir::PublicInputs return_values
std::vector< Acir::Opcode > opcodes
uint32_t current_witness_index
std::vector< Acir::Witness > private_parameters
Acir::PublicInputs public_parameters
std::string function_name
std::vector< std::tuple< Acir::OpcodeLocation, Acir::AssertionPayload > > assert_messages
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness > > linear_combinations
std::vector< uint8_t > q_c
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness, Acir::Witness > > mul_terms
std::variant< AssertZero, BlackBoxFuncCall, MemoryOp, MemoryInit, BrilligCall, Call > value
std::vector< Acir::Circuit > functions
std::vector< Acir::BrilligBytecode > unconstrained_functions
std::vector< uint8_t > bincodeSerialize() const
Witnesses::WitnessMap witness
std::map< Witnesses::Witness, std::vector< uint8_t > > value
std::vector< Witnesses::StackItem > stack
std::vector< uint8_t > bincodeSerialize() const
static constexpr field one()
BB_INLINE std::vector< uint8_t > to_buffer() const
static constexpr field zero()