Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
transcript.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
16
17template <typename Builder> struct StdlibTranscriptParams {
19 using Proof = std::vector<DataType>;
20
21 static inline DataType hash(const std::vector<DataType>& data)
22 {
23
24 ASSERT(!data.empty());
25 ASSERT(data[0].get_context() != nullptr);
26
27 Builder* builder = data[0].get_context();
29 }
38 static inline std::array<DataType, 2> split_challenge(const DataType& challenge)
39 {
40 // use existing field-splitting code in cycle_scalar
42 const cycle_scalar scalar = cycle_scalar(challenge);
45 return std::array<DataType, 2>{ scalar.lo, scalar.hi };
46 }
47 template <typename T> static inline T convert_challenge(const DataType& challenge)
48 {
49 Builder* builder = challenge.get_context();
50 return bb::stdlib::field_conversion::convert_challenge<Builder, T>(*builder, challenge);
51 }
52
53 template <typename T> static constexpr size_t calc_num_data_types()
54 {
55 return bb::stdlib::field_conversion::calc_num_bn254_frs<Builder, T>();
56 }
57
58 template <typename T> static inline T deserialize(std::span<const DataType> frs)
59 {
60 ASSERT(!frs.empty());
61 ASSERT(frs[0].get_context() != nullptr);
62 Builder* builder = frs[0].get_context();
63 return bb::stdlib::field_conversion::convert_from_bn254_frs<Builder, T>(*builder, frs);
64 }
65
66 template <typename T> static inline std::vector<DataType> serialize(const T& element)
67 {
68 return bb::stdlib::field_conversion::convert_to_bn254_frs<Builder, T>(element);
69 }
70};
71
74} // namespace bb::stdlib::recursion::honk
#define ASSERT(expression,...)
Definition assert.hpp:49
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
cycle_scalar represents a member of the cycle curve SCALAR FIELD. This is NOT the native circuit fiel...
static constexpr size_t LO_BITS
static constexpr size_t HI_BITS
void create_range_constraint(size_t num_bits, std::string const &msg="field_t::range_constraint") const
Let x = *this.normalize(), constrain x.v < 2^{num_bits}.
Definition field.cpp:908
Builder * get_context() const
Definition field.hpp:389
AluTraceBuilder builder
Definition alu.test.cpp:123
const std::vector< FF > data
std::conditional_t< IsGoblinBigGroup< C, Fq, Fr, G >, element_goblin::goblin_element< C, goblin_field< C >, Fr, G >, element_default::element< C, Fq, Fr, G > > element
element wraps either element_default::element or element_goblin::goblin_element depending on parametr...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
static DataType hash(const std::vector< DataType > &data)
static T convert_challenge(const DataType &challenge)
static std::array< DataType, 2 > split_challenge(const DataType &challenge)
Split a challenge field element into two half-width challenges.
static T deserialize(std::span< const DataType > frs)
static std::vector< DataType > serialize(const T &element)