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// #define LOG_CHALLENGES
9// #define LOG_INTERACTIONS
10
19#include <concepts>
20
21#include <atomic>
22
23namespace bb {
24
25// TODO(https://github.com/AztecProtocol/barretenberg/issues/1226): univariates should also be logged
26template <typename T, typename... U>
27concept Loggable =
30
31// class TranscriptManifest;
33 struct RoundData {
34 std::vector<std::string> challenge_label;
36
37 void print()
38 {
39 for (auto& label : challenge_label) {
40 info("\tchallenge: ", label);
41 }
42 for (auto& entry : entries) {
43 info("\telement (", entry.second, "): ", entry.first);
44 }
45 }
46
47 bool operator==(const RoundData& other) const = default;
48 };
49
51
52 public:
53 void print()
54 {
55 for (auto& round : manifest) {
56 info("Round: ", round.first);
57 round.second.print();
58 }
59 }
60
61 template <typename... Strings> void add_challenge(size_t round, Strings&... labels)
62 {
63 manifest[round].challenge_label = { labels... };
64 }
65 template <typename String, size_t NumChallenges>
67 {
68 auto call_add_challenge = [&] {
69 auto call_fn_with_expanded_parameters =
70 [&]<size_t... Indices>([[maybe_unused]] std::index_sequence<Indices...>) {
71 return add_challenge(round, std::get<Indices>(labels)...);
72 };
73 return call_fn_with_expanded_parameters(std::make_index_sequence<NumChallenges>());
74 };
75 call_add_challenge();
76 }
77
78 void add_entry(size_t round, const std::string& element_label, size_t element_size)
79 {
80 manifest[round].entries.emplace_back(element_label, element_size);
81 }
82
83 [[nodiscard]] size_t size() const { return manifest.size(); }
84
85 RoundData operator[](const size_t& round) { return manifest[round]; };
86
87 bool operator==(const TranscriptManifest& other) const = default;
88};
89
93
94 static DataType hash(const std::vector<DataType>& data);
95 template <typename T> static inline T convert_challenge(const DataType& challenge)
96 {
97 return bb::field_conversion::convert_challenge<T>(challenge);
98 }
107 static inline std::array<DataType, 2> split_challenge(const DataType& challenge)
108 {
109 // match the parameter used in stdlib, which is derived from cycle_scalar (is 128)
110 static constexpr size_t LO_BITS = DataType::Params::MAX_BITS_PER_ENDOMORPHISM_SCALAR;
111 static constexpr size_t HI_BITS = DataType::modulus.get_msb() + 1 - LO_BITS;
112
113 auto converted = static_cast<uint256_t>(challenge);
114 uint256_t lo = converted.slice(0, LO_BITS);
115 uint256_t hi = converted.slice(LO_BITS, LO_BITS + HI_BITS);
116 return std::array<DataType, 2>{ DataType(lo), DataType(hi) };
117 }
118 template <typename T> static constexpr size_t calc_num_data_types()
119 {
120 return bb::field_conversion::calc_num_bn254_frs<T>();
121 }
122 template <typename T> static inline T deserialize(std::span<const DataType> frs)
123 {
124 return bb::field_conversion::convert_from_bn254_frs<T>(frs);
125 }
126 template <typename T> static inline std::vector<DataType> serialize(const T& element)
127 {
129 }
130};
131
132// A template for detecting whether a type is native or in-circuit
133template <typename T>
135
136template <typename T, typename = void> struct is_iterable : std::false_type {};
137
138// this gets used only when we can call std::begin() and std::end() on that type
139template <typename T>
140struct is_iterable<T, std::void_t<decltype(std::begin(std::declval<T&>())), decltype(std::end(std::declval<T&>()))>>
141 : std::true_type {};
142
143template <typename T> constexpr bool is_iterable_v = is_iterable<T>::value;
144
145// A static counter for the number of transcripts created
146// This is used to generate unique labels for the transcript origin tags
147
148// ‘inline’ (since C++17) ensures a single shared definition with external linkage.
149inline std::atomic<size_t> unique_transcript_index{ 0 };
154template <typename TranscriptParams> class BaseTranscript {
155 public:
156 using DataType = TranscriptParams::DataType;
157 using Proof = typename TranscriptParams::Proof;
158
159 // Detects whether the transcript is in-circuit or not
160 static constexpr bool in_circuit = InCircuit<DataType>;
161
162 // The unique index of the transcript
164
165 // The index of the current round of the transcript (used for the origin tag, round is only incremented if we switch
166 // from generating to receiving)
167 size_t round_index = 0;
168
169 // Indicates whether the transcript is receiving data from the prover
170 bool reception_phase = true;
171
173 {
174 // If we are in circuit, we need to get a unique index for the transcript
175 if constexpr (in_circuit) {
177 }
178 }
179
180 static constexpr size_t HASH_OUTPUT_SIZE = 32;
181
183 size_t num_frs_written = 0; // the number of bb::frs written to proof_data by the prover
184 size_t num_frs_read = 0; // the number of bb::frs read from proof_data by the verifier
185 size_t round_number = 0; // current round for manifest
186
187 private:
188 bool is_first_challenge = true; // indicates if this is the first challenge this transcript is generating
189 DataType previous_challenge{}; // default-initialized to zeros
190 std::vector<DataType>
191 current_round_data; // the data for the current round that will be hashed to generate challenges
192 std::vector<DataType>
193 independent_hash_buffer; // data that will be independently hashed to get the hash of an object
194
195 bool use_manifest = false; // indicates whether the manifest is turned on, currently only on for manifest tests.
196
197 // "Manifest" object that records a summary of the transcript interactions
199
209 {
210 // challenges need at least 110 bits in them to match the presumed security parameter of the BN254 curve.
211 BB_ASSERT_LTE(num_challenges, 2U);
212 // Prevent challenge generation if this is the first challenge we're generating,
213 // AND nothing was sent by the prover.
214 if (is_first_challenge) {
215 ASSERT(!current_round_data.empty());
216 }
217
218 // concatenate the previous challenge (if this is not the first challenge) with the current round data.
219 // TODO(Adrian): Do we want to use a domain separator as the initial challenge buffer?
220 // We could be cheeky and use the hash of the manifest as domain separator, which would prevent us from
221 // having to domain separate all the data. (See https://safe-hash.dev)
222 std::vector<DataType> full_buffer;
223 if (!is_first_challenge) {
224 // if not the first challenge, we can use the previous_challenge
225 full_buffer.emplace_back(previous_challenge);
226 } else {
227 // Update is_first_challenge for the future
228 is_first_challenge = false;
229 }
230 if (!current_round_data.empty()) {
231 // TODO(https://github.com/AztecProtocol/barretenberg/issues/832): investigate why
232 // full_buffer.insert(full_buffer.end(), current_round_data.begin(), current_round_data.end()); fails to
233 // compile with gcc
235 current_round_data.clear(); // clear the round data buffer since it has been used
236 }
237
238 // Hash the full buffer with poseidon2, which is believed to be a collision resistant hash function and a
239 // random oracle, removing the need to pre-hash to compress and then hash with a random oracle, as we
240 // previously did with Pedersen and Blake3s.
241 DataType new_challenge = TranscriptParams::hash(full_buffer);
242 std::array<DataType, 2> new_challenges = TranscriptParams::split_challenge(new_challenge);
243 // update previous challenge buffer for next time we call this function
244 previous_challenge = new_challenge;
245 return new_challenges;
246 };
247
248 protected:
249 Proof proof_data; // Contains the raw data sent by the prover.
250
257 void add_element_frs_to_hash_buffer(const std::string& label, std::span<const DataType> element_frs)
258 {
259 if (use_manifest) {
260 // Add an entry to the current round of the manifest
261 manifest.add_entry(round_number, label, element_frs.size());
262 }
263
264 current_round_data.insert(current_round_data.end(), element_frs.begin(), element_frs.end());
265 }
266
275 template <typename T> void serialize_to_buffer(const T& element, Proof& proof_data)
276 {
277 auto element_frs = TranscriptParams::serialize(element);
278 proof_data.insert(proof_data.end(), element_frs.begin(), element_frs.end());
279 }
289 template <typename T> T deserialize_from_buffer(const Proof& proof_data, size_t& offset) const
290 {
291 constexpr size_t element_fr_size = TranscriptParams::template calc_num_data_types<T>();
292 BB_ASSERT_LTE(offset + element_fr_size, proof_data.size());
293
294 auto element_frs = std::span{ proof_data }.subspan(offset, element_fr_size);
295 offset += element_fr_size;
296
297 auto element = TranscriptParams::template deserialize<T>(element_frs);
298
299 return element;
300 }
301
302 public:
310 std::vector<DataType> export_proof()
311 {
312 std::vector<DataType> result(num_frs_written);
313 std::copy_n(proof_data.begin() + proof_start, num_frs_written, result.begin());
315 num_frs_written = 0;
316 return result;
317 };
318
319 void load_proof(const std::vector<DataType>& proof)
320 {
321 std::copy(proof.begin(), proof.end(), std::back_inserter(proof_data));
322 }
323
329 size_t size_proof_data() { return proof_data.size(); }
330
335 void enable_manifest() { use_manifest = true; }
336
345 static DataType hash(const std::vector<DataType>& data) { return TranscriptParams::hash(data); }
346
353 template <typename T> static inline std::vector<DataType> serialize(const T& element)
354 {
355 return TranscriptParams::serialize(element);
356 }
357
368 template <typename ChallengeType, typename... Strings>
369 std::array<ChallengeType, sizeof...(Strings)> get_challenges(const Strings&... labels)
370 {
371 constexpr size_t num_challenges = sizeof...(Strings);
372
373 if (use_manifest) {
374 // Add challenge labels for current round to the manifest
376 }
377
378 // Compute the new challenge buffer from which we derive the challenges.
379
380 // Create challenges from Frs.
382
383 // Generate the challenges by iteratively hashing over the previous challenge.
384 for (size_t i = 0; i < num_challenges / 2; i += 1) {
385 auto challenge_buffer = get_next_duplex_challenge_buffer(2);
386 challenges[2 * i] = TranscriptParams::template convert_challenge<ChallengeType>(challenge_buffer[0]);
387 challenges[2 * i + 1] = TranscriptParams::template convert_challenge<ChallengeType>(challenge_buffer[1]);
388 }
389 if ((num_challenges & 1) == 1) {
390 auto challenge_buffer = get_next_duplex_challenge_buffer(1);
391 challenges[num_challenges - 1] =
392 TranscriptParams::template convert_challenge<ChallengeType>(challenge_buffer[0]);
393 }
394
395 // In case the transcript is used for recursive verification, we can track proper Fiat-Shamir usage
396 if constexpr (in_circuit) {
397 // We are in challenge generation mode
398 if (reception_phase) {
399 reception_phase = false;
400 }
401 // Assign origin tags to the challenges
402 for (size_t i = 0; i < num_challenges; i++) {
403 challenges[i].set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/false));
404 }
405 }
406 // Prepare for next round.
407 ++round_number;
408
409 return challenges;
410 }
411
418 template <typename ChallengeType, typename String, std::size_t N>
420 {
421 // Expand the array elements into the existing variadic get_challenges
422 return std::apply([this](auto const&... xs) { return this->get_challenges<ChallengeType>(xs...); }, labels);
423 }
424
429 template <typename ChallengeType>
431 const ChallengeType& round_challenge)
432 {
433 std::vector<ChallengeType> pows(num_powers);
434 pows[0] = round_challenge;
435 for (size_t i = 1; i < num_powers; i++) {
436 pows[i] = pows[i - 1].sqr();
437 }
438 return pows;
439 }
440
441 template <typename ChallengeType, typename String>
442 std::vector<ChallengeType> get_powers_of_challenge(const String& label, size_t num_challenges)
443 {
444 return compute_round_challenge_pows(num_challenges, get_challenge<ChallengeType>(label));
445 }
446
455 template <class T> void add_to_independent_hash_buffer([[maybe_unused]] const std::string& label, const T& element)
456 {
457 DEBUG_LOG(label, element);
458 // In case the transcript is used for recursive verification, we can track proper Fiat-Shamir usage
459 if constexpr (in_circuit) {
460 // The verifier is receiving data from the prover. If before this we were in the challenge generation phase,
461 // then we need to increment the round index
462 if (!reception_phase) {
463 reception_phase = true;
464 round_index++;
465 }
466 // If the element is iterable, then we need to assign origin tags to all the elements
467 if constexpr (is_iterable_v<T>) {
468 for (const auto& subelement : element) {
469 subelement.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
470 }
471 } else {
472 // If the element is not iterable, then we need to assign an origin tag to the element
473 element.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
474 }
475 }
476 auto element_frs = TranscriptParams::serialize(element);
477
478#ifdef LOG_INTERACTIONS
479 if constexpr (Loggable<T>) {
480 info("independent hash buffer consumed: ", label, ": ", element);
481 }
482#endif
483 independent_hash_buffer.insert(independent_hash_buffer.end(), element_frs.begin(), element_frs.end());
484 }
485
492 {
493 DataType buffer_hash = TranscriptParams::hash(independent_hash_buffer);
495 return buffer_hash;
496 }
497
506 template <class T> void add_to_hash_buffer(const std::string& label, const T& element)
507 {
508 DEBUG_LOG(label, element);
509 // In case the transcript is used for recursive verification, we can track proper Fiat-Shamir usage
510 if constexpr (in_circuit) {
511 // The verifier is receiving data from the prover. If before this we were in the challenge generation phase,
512 // then we need to increment the round index
513 if (!reception_phase) {
514 reception_phase = true;
515 round_index++;
516 }
517 // If the element is iterable, then we need to assign origin tags to all the elements
518 if constexpr (is_iterable_v<T>) {
519 for (const auto& subelement : element) {
520 subelement.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
521 }
522 } else {
523 // If the element is not iterable, then we need to assign an origin tag to the element
524 element.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
525 }
526 }
527 auto elements = TranscriptParams::serialize(element);
528
529#ifdef LOG_INTERACTIONS
530 if constexpr (Loggable<T>) {
531 info("consumed: ", label, ": ", element);
532 }
533#endif
535 }
536
550 template <class T> void send_to_verifier(const std::string& label, const T& element)
551 {
552 DEBUG_LOG(label, element);
553
554 auto element_frs = TranscriptParams::serialize(element);
555 proof_data.insert(proof_data.end(), element_frs.begin(), element_frs.end());
556 num_frs_written += element_frs.size();
557
558#ifdef LOG_INTERACTIONS
559 if constexpr (Loggable<T>) {
560 info("sent: ", label, ": ", element);
561 }
562#endif
564 // In case the transcript is used for recursive verification, we can track proper Fiat-Shamir usage
565 if constexpr (in_circuit) {
566 // The prover is sending data to the verifier. If before this we were in the challenge generation phase,
567 // then we need to increment the round index
568 if (!reception_phase) {
569 reception_phase = true;
570 round_index++;
571 }
572 // If the element is iterable, then we need to assign origin tags to all the elements
573 if constexpr (is_iterable_v<T>) {
574 for (const auto& subelement : element) {
575 subelement.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
576 }
577 } else {
578 // If the element is not iterable, then we need to assign an origin tag to the element
579 element.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
580 }
581 }
582 }
583
591 template <class T> T receive_from_prover(const std::string& label)
592 {
593 const size_t element_size = TranscriptParams::template calc_num_data_types<T>();
594 BB_ASSERT_LTE(num_frs_read + element_size, proof_data.size());
595
596 auto element_frs = std::span{ proof_data }.subspan(num_frs_read, element_size);
597 num_frs_read += element_size;
598
600
601 auto element = TranscriptParams::template deserialize<T>(element_frs);
602 DEBUG_LOG(label, element);
603
604#ifdef LOG_INTERACTIONS
605 if constexpr (Loggable<T>) {
606 info("received: ", label, ": ", element);
607 }
608#endif
609
610 // In case the transcript is used for recursive verification, we can track proper Fiat-Shamir usage
611 if constexpr (in_circuit) {
612 // The verifier is receiving data from the prover. If before this we were in the challenge generation phase,
613 // then we need to increment the round index
614 if (!reception_phase) {
615 reception_phase = true;
616 round_index++;
617 }
618 // If the element is iterable, then we need to assign origin tags to all the elements
619 if constexpr (is_iterable_v<T>) {
620 for (auto& subelement : element) {
621 subelement.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
622 }
623 } else {
624 // If the element is not iterable, then we need to assign an origin tag to the element
625 element.set_origin_tag(OriginTag(transcript_index, round_index, /*is_submitted=*/true));
626 }
627 }
628 return element;
629 }
630
638 const std::shared_ptr<BaseTranscript>& prover_transcript)
639 {
640 // We expect this function to only be used when the transcript has just been exported.
641 BB_ASSERT_EQ(prover_transcript->num_frs_written, static_cast<size_t>(0), "Expected to be empty");
642 auto verifier_transcript = std::make_shared<BaseTranscript>(*prover_transcript);
643 verifier_transcript->num_frs_read = static_cast<size_t>(verifier_transcript->proof_start);
644 verifier_transcript->proof_start = 0;
645 return verifier_transcript;
646 }
654 {
655 auto transcript = std::make_shared<BaseTranscript>();
656 constexpr uint32_t init{ 42 }; // arbitrary
657 transcript->send_to_verifier("Init", init);
658 return transcript;
659 };
660
669 {
670 auto verifier_transcript = std::make_shared<BaseTranscript>();
671 verifier_transcript->load_proof(transcript->proof_data);
672 [[maybe_unused]] auto _ = verifier_transcript->template receive_from_prover<DataType>("Init");
673 return verifier_transcript;
674 };
675
676 template <typename ChallengeType> ChallengeType get_challenge(const std::string& label)
677 {
678 ChallengeType result = get_challenges<ChallengeType>(label)[0];
679#if defined LOG_CHALLENGES || defined LOG_INTERACTIONS
680 info("challenge: ", label, ": ", result);
681#endif
682 DEBUG_LOG(label, result);
683 return result;
684 }
685
686 [[nodiscard]] TranscriptManifest get_manifest() const { return manifest; };
687
688 void print()
689 {
690 if (!use_manifest) {
691 info("Warning: manifest is not enabled!");
692 }
693 manifest.print();
694 }
695
740 {
741 ASSERT(current_round_data.empty(), "Branching a transcript with non empty round data");
742
743 BaseTranscript branched_transcript;
744
745 // Need to fetch_sub because the constructor automatically increases unique_transcript_index by 1
746 branched_transcript.transcript_index = unique_transcript_index.fetch_sub(1);
747 branched_transcript.round_index = round_index;
748 branched_transcript.add_to_hash_buffer("init", previous_challenge);
749 round_index += BRANCHING_JUMP;
750
751 return branched_transcript;
752 }
753};
754
756
758// Solidity Transcript
760
761// This is a compatible wrapper around the keccak256 function from ethash
763// Losing 2 bits of this is not an issue -> we can just reduce mod p
764{
765 // cast into uint256_t
766 std::vector<uint8_t> buffer = to_buffer(data);
767
768 keccak256 hash_result = ethash_keccak256(&buffer[0], buffer.size());
769 for (auto& word : hash_result.word64s) {
770 if (is_little_endian()) {
771 word = __builtin_bswap64(word);
772 }
773 }
774 std::array<uint8_t, 32> result;
775
776 for (size_t i = 0; i < 4; ++i) {
777 for (size_t j = 0; j < 8; ++j) {
778 uint8_t byte = static_cast<uint8_t>(hash_result.word64s[i] >> (56 - (j * 8)));
779 result[i * 8 + j] = byte;
780 }
781 }
782
783 return from_buffer<bb::fr>(result);
784}
785
787 using Fr = bb::fr;
790
791 static inline Fr hash(const std::vector<DataType>& data) { return keccak_hash_uint256(data); }
792
793 template <typename T> static inline T convert_challenge(const DataType& challenge)
794 {
795 return bb::field_conversion::convert_challenge<T>(challenge);
796 }
797
798 template <typename T> static constexpr size_t calc_num_data_types()
799 {
800 return bb::field_conversion::calc_num_uint256_ts<T>();
801 }
802 template <typename T> static inline T deserialize(std::span<const DataType> elements)
803 {
804 return bb::field_conversion::convert_from_uint256_ts<T>(elements);
805 }
806 template <typename T> static inline std::vector<DataType> serialize(const T& element)
807 {
809 }
810 static inline std::array<DataType, 2> split_challenge(const DataType& challenge)
811 {
812 // Challenges sizes are matched with the challenge sizes used in bb::fr
813 // match the parameter used in stdlib, which is derived from cycle_scalar (is 128)
814 static constexpr size_t LO_BITS = bb::fr::Params::MAX_BITS_PER_ENDOMORPHISM_SCALAR;
815 static constexpr size_t HI_BITS = bb::fr::modulus.get_msb() + 1 - LO_BITS;
816
817 auto converted = static_cast<uint256_t>(challenge);
818 uint256_t lo = converted.slice(0, LO_BITS);
819 uint256_t hi = converted.slice(LO_BITS, LO_BITS + HI_BITS);
820 return std::array<DataType, 2>{ DataType(lo), DataType(hi) };
821 }
822};
823
825
826} // namespace bb
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:59
#define BB_ASSERT_LTE(left, right,...)
Definition assert.hpp:129
#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...
DataType hash_independent_buffer()
Hashes the independent hash buffer and clears it.
static std::shared_ptr< BaseTranscript > convert_prover_transcript_to_verifier_transcript(const std::shared_ptr< BaseTranscript > &prover_transcript)
Convert a prover transcript to a verifier transcript.
T deserialize_from_buffer(const Proof &proof_data, size_t &offset) const
Deserializes the frs starting at offset into the typed element and returns that element.
DataType previous_challenge
std::array< ChallengeType, N > get_challenges(std::array< String, N > const &labels)
Wrapper around get_challenges to handle array of challenges.
T receive_from_prover(const std::string &label)
Reads the next element of type T from the transcript, with a predefined label, only used by verifier.
static constexpr size_t HASH_OUTPUT_SIZE
std::array< DataType, 2 > get_next_duplex_challenge_buffer(size_t num_challenges)
Compute next challenge c_next = H( Compress(c_prev || round_buffer) )
void load_proof(const std::vector< DataType > &proof)
void add_to_hash_buffer(const std::string &label, const T &element)
Adds an element to the transcript.
std::array< ChallengeType, sizeof...(Strings)> get_challenges(const Strings &... labels)
After all the prover messages have been sent, finalize the round by hashing all the data and then cre...
void serialize_to_buffer(const T &element, Proof &proof_data)
Serializes object and appends it to proof_data.
std::vector< DataType > export_proof()
Return the proof data starting at proof_start.
void add_element_frs_to_hash_buffer(const std::string &label, std::span< const DataType > element_frs)
Adds challenge elements to the current_round_buffer and updates the manifest.
static std::shared_ptr< BaseTranscript > verifier_init_empty(const std::shared_ptr< BaseTranscript > &transcript)
For testing: initializes transcript based on proof data then receives junk data produced by BaseTrans...
std::vector< ChallengeType > get_powers_of_challenge(const String &label, size_t num_challenges)
void send_to_verifier(const std::string &label, const T &element)
Adds a prover message to the transcript, only intended to be used by the prover.
TranscriptManifest get_manifest() const
BaseTranscript branch_transcript()
Branch a transcript to perform verifier-only computations.
void add_to_independent_hash_buffer(const std::string &label, const T &element)
Adds an element to an independent hash buffer.
std::ptrdiff_t proof_start
void enable_manifest()
Enables the manifest.
static std::vector< DataType > serialize(const T &element)
Serialize a size_t to a vector of field elements.
TranscriptParams::DataType DataType
std::vector< ChallengeType > compute_round_challenge_pows(const size_t num_powers, const ChallengeType &round_challenge)
Given δ, compute the vector [δ, δ^2,..., δ^2^num_powers].
static constexpr bool in_circuit
static std::shared_ptr< BaseTranscript > prover_init_empty()
For testing: initializes transcript with some arbitrary data so that a challenge can be generated aft...
typename TranscriptParams::Proof Proof
size_t size_proof_data()
Return the size of proof_data.
static DataType hash(const std::vector< DataType > &data)
Static hash method that forwards to TranscriptParams hash.
std::vector< DataType > independent_hash_buffer
ChallengeType get_challenge(const std::string &label)
TranscriptManifest manifest
std::vector< DataType > current_round_data
RoundData operator[](const size_t &round)
void add_entry(size_t round, const std::string &element_label, size_t element_size)
bool operator==(const TranscriptManifest &other) const =default
std::map< size_t, RoundData > manifest
void add_challenge(size_t round, Strings &... labels)
void add_challenge(size_t round, std::array< String, NumChallenges > labels)
size_t size() const
constexpr uint256_t slice(uint64_t start, uint64_t end) const
constexpr uint64_t get_msb() const
void info(Args... args)
Definition log.hpp:70
const std::vector< FF > data
struct keccak256 ethash_keccak256(const uint8_t *data, size_t size) NOEXCEPT
Definition keccak.cpp:107
#define DEBUG_LOG(...)
ssize_t offset
Definition engine.cpp:36
uint8_t buffer[RANDOM_BUFFER_SIZE]
Definition engine.cpp:34
const auto init
Definition fr.bench.cpp:141
std::vector< bb::fr > convert_to_bn254_frs(const T &val)
Conversion from transcript values to bb::frs.
std::vector< uint256_t > convert_to_uint256(const T &val)
Conversion from transcript values to bb::frs.
Entry point for Barretenberg command-line interface.
std::atomic< size_t > unique_transcript_index
constexpr bool is_iterable_v
std::vector< fr > HonkProof
Definition proof.hpp:15
field< Bn254FrParams > fr
Definition fr.hpp:174
bb::fr keccak_hash_uint256(std::vector< uint256_t > const &data)
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
bool is_little_endian()
Definition net.hpp:10
std::vector< uint8_t > to_buffer(T const &value)
static T convert_challenge(const DataType &challenge)
static std::vector< DataType > serialize(const T &element)
static T deserialize(std::span< const DataType > elements)
static std::array< DataType, 2 > split_challenge(const DataType &challenge)
static Fr hash(const std::vector< DataType > &data)
std::vector< uint256_t > Proof
static constexpr size_t calc_num_data_types()
static constexpr size_t calc_num_data_types()
static std::vector< DataType > serialize(const T &element)
static DataType hash(const std::vector< DataType > &data)
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 T convert_challenge(const DataType &challenge)
std::vector< std::string > challenge_label
bool operator==(const RoundData &other) const =default
std::vector< std::pair< std::string, size_t > > entries
static constexpr uint256_t modulus
uint64_t word64s[4]