Common transcript class for both parties. Stores the data for the current round, as well as the manifest.
More...
#include <transcript.hpp>
|
|
using | Proof = std::vector< uint8_t > |
| |
|
| | BaseTranscript (const Proof &proof_data) |
| | Construct a new Base Transcript object for Verifier using proof_data.
|
| |
| std::vector< uint8_t > | export_proof () |
| | Return the proof data starting at proof_start.
|
| |
|
void | load_proof (const std::vector< uint8_t > &proof) |
| |
| template<typename... Strings> |
| std::array< uint256_t, 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 create the number of requested challenges.
|
| |
| template<class T > |
| 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.
|
| |
| template<class T > |
| 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.
|
| |
|
uint256_t | get_challenge (const std::string &label) |
| |
|
TranscriptManifest | get_manifest () const |
| |
|
void | print () |
| |
|
|
std::ptrdiff_t | proof_start = 0 |
| |
|
size_t | num_bytes_written = 0 |
| |
|
size_t | num_bytes_read = 0 |
| |
|
size_t | round_number = 0 |
| |
|
Proof | proof_data |
| |
|
|
static constexpr size_t | HASH_OUTPUT_SIZE = 32 |
| |
|
| void | consume_prover_element_bytes (const std::string &label, std::span< const uint8_t > element_bytes) |
| | Adds challenge elements to the current_round_buffer and updates the manifest.
|
| |
| template<typename T > |
| void | serialize_to_buffer (const T &element, Proof &proof_data) |
| | Serializes object and appends it to proof_data.
|
| |
| template<typename T > |
| T | deserialize_from_buffer (const Proof &proof_data, size_t &offset) const |
| | Deserializes the bytes starting at offset into the typed element and returns that element.
|
| |
Common transcript class for both parties. Stores the data for the current round, as well as the manifest.
◆ BaseTranscript()
| proof_system::honk::BaseTranscript::BaseTranscript |
( |
const Proof & |
proof_data | ) |
|
|
inlineexplicit |
Construct a new Base Transcript object for Verifier using proof_data.
- Parameters
-
◆ consume_prover_element_bytes()
| void proof_system::honk::BaseTranscript::consume_prover_element_bytes |
( |
const std::string & |
label, |
|
|
std::span< const uint8_t > |
element_bytes |
|
) |
| |
|
inlineprotected |
Adds challenge elements to the current_round_buffer and updates the manifest.
- Parameters
-
| label | of the element sent |
| element_bytes | serialized |
◆ deserialize_from_buffer()
template<typename T >
| T proof_system::honk::BaseTranscript::deserialize_from_buffer |
( |
const Proof & |
proof_data, |
|
|
size_t & |
offset |
|
) |
| const |
|
inlineprotected |
Deserializes the bytes starting at offset into the typed element and returns that element.
Using the template parameter and the offset argument, this function deserializes the bytes with from_buffer and then increments the offset appropriately based on the number of bytes that were deserialized.
- Template Parameters
-
- Parameters
-
- Returns
- T
◆ export_proof()
| std::vector< uint8_t > proof_system::honk::BaseTranscript::export_proof |
( |
| ) |
|
|
inline |
Return the proof data starting at proof_start.
This is useful for when two different provers share a transcript.
◆ get_challenges()
template<typename... Strings>
| std::array< uint256_t, sizeof...(Strings)> proof_system::honk::BaseTranscript::get_challenges |
( |
const Strings &... |
labels | ) |
|
|
inline |
After all the prover messages have been sent, finalize the round by hashing all the data and then create the number of requested challenges.
Challenges are generated by iteratively hashing over the previous challenge, using get_next_challenge_buffer(). TODO(#741): Optimizations for this function include generalizing type of hash, splitting hashes into multiple challenges.
- Parameters
-
| labels | human-readable names for the challenges for the manifest |
- Returns
- std::array<uint256_t, num_challenges> challenges for this round.
◆ prover_init_empty()
| static std::shared_ptr< BaseTranscript > proof_system::honk::BaseTranscript::prover_init_empty |
( |
| ) |
|
|
inlinestatic |
For testing: initializes transcript with some arbitrary data so that a challenge can be generated after initialization. Only intended to be used by Prover.
- Returns
- BaseTranscript
◆ receive_from_prover()
template<class T >
| T proof_system::honk::BaseTranscript::receive_from_prover |
( |
const std::string & |
label | ) |
|
|
inline |
Reads the next element of type T from the transcript, with a predefined label, only used by verifier.
- Parameters
-
| label | Human readable name for the challenge. |
- Returns
- deserialized element of type T
◆ send_to_verifier()
template<class T >
| void proof_system::honk::BaseTranscript::send_to_verifier |
( |
const std::string & |
label, |
|
|
const T & |
element |
|
) |
| |
|
inline |
Adds a prover message to the transcript, only intended to be used by the prover.
Serializes the provided object into proof_data, and updates the current round state in consume_prover_element_bytes.
- Parameters
-
| label | Description/name of the object being added. |
| element | Serializable object that will be added to the transcript |
- Todo:
- Use a concept to only allow certain types to be passed. Requirements are that the object should be serializable.
◆ serialize_to_buffer()
template<typename T >
| void proof_system::honk::BaseTranscript::serialize_to_buffer |
( |
const T & |
element, |
|
|
Proof & |
proof_data |
|
) |
| |
|
inlineprotected |
Serializes object and appends it to proof_data.
Calls to_buffer on element to serialize, and modifies proof_data object by appending the serialized bytes to it.
- Template Parameters
-
- Parameters
-
◆ verifier_init_empty()
| static std::shared_ptr< BaseTranscript > proof_system::honk::BaseTranscript::verifier_init_empty |
( |
const std::shared_ptr< BaseTranscript > & |
transcript | ) |
|
|
inlinestatic |
The documentation for this class was generated from the following file: