47 auto deserialize_point = [&]() {
49 NativeG1::PUBLIC_INPUTS_SIZE);
50 idx += NativeG1::PUBLIC_INPUTS_SIZE;
51 return FrCodec::deserialize_from_fields<NativeG1>(limbs);
54 result.pairing_inputs.P0() = deserialize_point();
55 result.pairing_inputs.P1() = deserialize_point();
56 result.kernel_return_data = deserialize_point();
57 for (
auto& app_commitment :
result.app_return_data) {
58 app_commitment = deserialize_point();
60 result.ecc_op_hash = proof[idx++];
61 result.output_hn_accum_hash = proof[idx];
77 auto serialize_fq = [&](
const NativeFq& fq_val) {
78 constexpr uint64_t NUM_LIMB_BITS = 2 * NUM_LIMB_BITS_IN_FIELD_SIMULATION;
81 proof[idx++] =
NativeFF(val & LIMB_MASK);
82 proof[idx++] =
NativeFF((val >> NUM_LIMB_BITS) & LIMB_MASK);
85 auto serialize_point = [&](
const NativeG1& point) {
86 if (point.is_point_at_infinity()) {
87 for (
size_t i = 0; i < NativeG1::PUBLIC_INPUTS_SIZE; ++i) {
91 serialize_fq(point.x);
92 serialize_fq(point.y);
100 serialize_point(app_commitment);
140 auto deserialize_point = [&]() {
142 NativeG1::PUBLIC_INPUTS_SIZE);
143 idx += NativeG1::PUBLIC_INPUTS_SIZE;
144 return FrCodec::deserialize_from_fields<NativeG1>(limbs);
147 result.pairing_inputs.P0() = deserialize_point();
148 result.pairing_inputs.P1() = deserialize_point();
163 auto serialize_fq = [&](
const NativeFq& fq_val) {
164 constexpr uint64_t NUM_LIMB_BITS = 2 * NUM_LIMB_BITS_IN_FIELD_SIMULATION;
167 proof[idx++] =
NativeFF(val & LIMB_MASK);
168 proof[idx++] =
NativeFF((val >> NUM_LIMB_BITS) & LIMB_MASK);
171 auto serialize_point = [&](
const NativeG1& point) {
172 if (point.is_point_at_infinity()) {
173 for (
size_t i = 0; i < NativeG1::PUBLIC_INPUTS_SIZE; ++i) {
177 serialize_fq(point.x);
178 serialize_fq(point.y);
typename Group::affine_element AffineElement
Native representation and serde for AppIO public inputs.
void to_proof(std::vector< NativeFF > &proof, size_t num_public_inputs) const
Serialize AppIO back to a proof vector.
NativePairingPoints pairing_inputs
static AppIOSerde from_proof(const std::vector< NativeFF > &proof, size_t num_public_inputs)
Deserialize AppIO from a proof vector.
static constexpr size_t PUBLIC_INPUTS_SIZE
curve::BN254::AffineElement NativeG1
For test purposes only: Native representation and serde for KernelIO public inputs
NativeG1 kernel_return_data
std::array< NativeG1, N > NativeAppReturnDataCommitments
void to_proof(std::vector< NativeFF > &proof, size_t num_public_inputs) const
Serialize KernelIO back to a proof vector.
NativePairingPoints pairing_inputs
NativeAppReturnDataCommitments app_return_data
curve::BN254::AffineElement NativeG1
NativeFF output_hn_accum_hash
static KernelIOSerde_ from_proof(const std::vector< NativeFF > &proof, size_t num_public_inputs)
Deserialize KernelIO from a proof vector.
static constexpr size_t PUBLIC_INPUTS_SIZE
field< Bn254FrParams > fr
constexpr std::size_t kernel_public_inputs_size(std::size_t num_apps)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
static constexpr field zero()