17#include "barretenberg/bbapi/generated/bb_types.hpp"
41inline const std::array<uint8_t, 32>&
wire_bytes(
const std::array<uint8_t, 32>& w)
46template <
typename Wire>
inline const std::array<uint8_t, 32>&
wire_bytes(
const Wire& w)
48 return static_cast<const std::array<uint8_t, 32>&
>(w);
51template <
typename Field>
inline std::array<uint8_t, 32>
field_to_bytes(
const Field& d)
53 std::array<uint8_t, 32> r{};
54 Field::serialize_to_buffer(d, r.data());
58template <
typename Field>
inline std::array<uint8_t, 32>
field_to_wire(
const Field& d)
68template <
typename Field,
typename Wire>
inline Field
field_from_wire(
const Wire& w)
75 return field_to_wire_as<Fr>(d);
79 return field_from_wire<bb::fr>(w);
86 for (
const auto& x : d) {
94 std::vector<bb::fr> r;
96 for (
const auto& x : w) {
129 return { .x = field_to_wire_as<Fr>(d.
x), .y = field_to_wire_as<Fr>(d.
y) };
134 return { field_from_wire<grumpkin::fq>(w.x), field_from_wire<grumpkin::fq>(w.y) };
141 for (
const auto& p : d) {
151 for (
const auto& p : w) {
159 return { .
x = field_to_wire_as<Fq>(d.
x), .y = field_to_wire_as<Fq>(d.
y) };
164 return { field_from_wire<bb::fq>(w.x), field_from_wire<bb::fq>(w.y) };
170 return { field_to_wire_as<Fq>(d.
c0), field_to_wire_as<Fq>(d.
c1) };
175 return { field_from_wire<bb::fq>(w[0]), field_from_wire<bb::fq>(w[1]) };
190 return { .x = field_to_wire_as<Secp256k1Fq>(d.
x), .y = field_to_wire_as<Secp256k1Fq>(d.
y) };
195 return { field_from_wire<secp256k1::fq>(w.x), field_from_wire<secp256k1::fq>(w.y) };
200 return { .
x = field_to_wire_as<Secp256r1Fq>(d.
x), .y = field_to_wire_as<Secp256r1Fq>(d.
y) };
205 return { field_from_wire<secp256r1::fq>(w.x), field_from_wire<secp256r1::fq>(w.y) };
217 const uint64_t v = d.
data[3 - i];
219 r[i * 8 + j] =
static_cast<uint8_t
>(v >> (56 - j * 8));
231 v = (v << 8) | w[i * 8 + j];
242 for (
const auto& x : d) {
250 std::vector<bb::numeric::uint256_t> r;
252 for (
const auto& x : w) {
Stateful Chonk batch-verifier service used by the IPC handlers.
Shared type definitions for the Barretenberg RPC API.
bb::numeric::uint256_t uint256_from_wire(const Uint256 &w)
wire::ChonkProof chonk_proof_to_wire(const ChonkProof &d)
Field field_from_wire(const Wire &w)
bb::fq2 fq2_from_wire(const std::array< Fq, 2 > &w)
std::vector< Uint256 > uint256_vec_to_wire(const std::vector< bb::numeric::uint256_t > &d)
ChonkProof chonk_proof_from_wire(wire::ChonkProof &&w)
std::vector< Fr > fr_vec_to_wire(const std::vector< bb::fr > &d)
Wire field_to_wire_as(const Field &d)
Fr fr_to_wire(const bb::fr &d)
wire::Bn254G2Point bn254_g2_point_to_wire(const bb::g2::affine_element &d)
std::vector< bb::numeric::uint256_t > uint256_vec_from_wire(const std::vector< Uint256 > &w)
std::vector< ChonkProof > chonk_proof_vec_from_wire(std::vector< wire::ChonkProof > &&w)
secp256r1::g1::affine_element secp256r1_point_from_wire(const wire::Secp256r1Point &w)
std::vector< grumpkin::g1::affine_element > grumpkin_point_vec_from_wire(const std::vector< wire::GrumpkinPoint > &w)
std::array< Fq, 2 > fq2_to_wire(const bb::fq2 &d)
std::array< bb::fr, N > fr_array_from_wire(const std::array< Fr, N > &w)
std::array< Fr, N > fr_array_to_wire(const std::array< bb::fr, N > &d)
secp256k1::g1::affine_element secp256k1_point_from_wire(const wire::Secp256k1Point &w)
bb::fr fr_from_wire(const Fr &w)
bb::g1::affine_element bn254_g1_point_from_wire(const wire::Bn254G1Point &w)
wire::GrumpkinPoint grumpkin_point_to_wire(const grumpkin::g1::affine_element &d)
bb::g2::affine_element bn254_g2_point_from_wire(const wire::Bn254G2Point &w)
std::vector< bb::fr > fr_vec_from_wire(const std::vector< Fr > &w)
std::vector< wire::GrumpkinPoint > grumpkin_point_vec_to_wire(const std::vector< grumpkin::g1::affine_element > &d)
wire::Bn254G1Point bn254_g1_point_to_wire(const bb::g1::affine_element &d)
Uint256 uint256_to_wire(const bb::numeric::uint256_t &d)
wire::Secp256r1Point secp256r1_point_to_wire(const secp256r1::g1::affine_element &d)
std::array< uint8_t, 32 > field_to_bytes(const Field &d)
std::array< uint8_t, 32 > field_to_wire(const Field &d)
grumpkin::g1::affine_element grumpkin_point_from_wire(const wire::GrumpkinPoint &w)
wire::Secp256k1Point secp256k1_point_to_wire(const secp256k1::g1::affine_element &d)
const std::array< uint8_t, 32 > & wire_bytes(const std::array< uint8_t, 32 > &w)
ChonkProof_< false > ChonkProof
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
HonkProof hiding_oink_proof