Common transcript class for both parties. Stores the data for the current round, as well as the manifest.
More...
|
| | BaseTranscript () |
| |
| | BaseTranscript (const Proof &proof) |
| |
| std::vector< DataType > | export_proof () |
| | Return the proof data starting at proof_start.
|
| |
| void | load_proof (const std::vector< DataType > &proof) |
| | Verifier-specific method. The verifier needs to load a proof or its segment before the verification.
|
| |
| size_t | get_proof_size () |
| |
| void | enable_manifest () |
| |
| template<typename ChallengeType > |
| std::vector< ChallengeType > | get_challenges (std::span< const std::string > 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<typename ChallengeType , size_t N> |
| std::array< ChallengeType, N > | get_challenges (const std::array< std::string, N > &labels) |
| | Wrapper around get_challenges to handle array of challenges.
|
| |
| template<typename ChallengeType > |
| std::vector< ChallengeType > | get_dyadic_powers_of_challenge (const std::string &label, size_t num_challenges) |
| | Get a challenge and compute its dyadic powers [δ, δ², δ⁴, ..., δ^(2^(num_challenges-1))].
|
| |
| template<class T > |
| void | add_to_hash_buffer (const std::string &label, const T &element) |
| | Adds an element to the transcript.
|
| |
| 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.
|
| |
| template<typename ChallengeType > |
| ChallengeType | get_challenge (const std::string &label) |
| |
| TranscriptManifest | get_manifest () const |
| |
| void | print () |
| |
| void | test_set_proof_parsing_state (std::ptrdiff_t start, size_t written) |
| | Test utility: Set proof parsing state for export after deserialization.
|
| |
| std::ptrdiff_t | test_get_proof_start () const |
| | Test utility: Get proof_start for validation.
|
| |
template<typename Codec_, typename HashFunction_>
class bb::BaseTranscript< Codec_, HashFunction_ >
Common transcript class for both parties. Stores the data for the current round, as well as the manifest.
Definition at line 41 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
template<typename T >
| T bb::BaseTranscript< Codec_, HashFunction_ >::deserialize_from_buffer |
( |
const Proof & |
proof_data, |
|
|
size_t & |
offset |
|
) |
| const |
|
inlineprotected |
Deserializes the frs starting at offset into the typed element and returns that element.
Using the template parameter and the offset argument, this function deserializes the frs with from_buffer and then increments the offset appropriately based on the number of frs that were deserialized.
- Template Parameters
-
- Parameters
-
- Returns
- T
Definition at line 172 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
Return the proof data starting at proof_start.
This function returns the elements of the transcript in the interval [proof_start : proof_start + num_frs_written] and then updates proof_start. It is useful for when two provers share a transcript, as calling export_proof at the end of each provers' code returns the slices T_1, T_2 of the transcript that must be loaded by the verifiers via load_proof.
Definition at line 193 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
template<typename ChallengeType >
| std::vector< ChallengeType > bb::BaseTranscript< Codec_, HashFunction_ >::get_challenges |
( |
std::span< const std::string > |
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(). Note that the pairs of challenges will be 127 bits each, as in they will be [127, 127, 127, 127, ...].
- Parameters
-
| labels | human-readable names for the challenges for the manifest |
- Returns
- std::vector<ChallengeType> challenges for this round.
Definition at line 228 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
template<typename ChallengeType >
| std::vector< ChallengeType > bb::BaseTranscript< Codec_, HashFunction_ >::get_dyadic_powers_of_challenge |
( |
const std::string & |
label, |
|
|
size_t |
num_challenges |
|
) |
| |
|
inline |
Get a challenge and compute its dyadic powers [δ, δ², δ⁴, ..., δ^(2^(num_challenges-1))].
Generates num_challenges elements where each element is the square of the previous one. This is Step 2 of the protocol as written in the Protogalaxy paper.
- Parameters
-
| label | Human-readable name for the challenge |
| num_challenges | Number of power-of-2 powers to generate |
- Returns
- Vector of num_challenges elements: [δ, δ², δ⁴, δ⁸, ...]
Definition at line 301 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
Compute next challenge c_next = H( Compress(c_prev || round_buffer) )
This function computes a new challenge for the current round using the previous challenge and the current round data, if they exist. It clears the current_round_data if nonempty after computing the challenge to minimize how much we compress. It also sets previous_challenge to the current challenge buffer to set up next function call.
- Returns
- std::array<DataType, CHALLENGE_BUFFER_SIZE>
Definition at line 99 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
template<class T >
| void bb::BaseTranscript< Codec_, HashFunction_ >::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 add_element_frs_to_hash_buffer.
- 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.
Definition at line 350 of file transcript.hpp.
template<typename Codec_ , typename HashFunction_ >
template<typename T >
Serializes object and appends it to proof_data.
Calls to_buffer on element to serialize, and modifies proof_data object by appending the serialized frs to it.
- Template Parameters
-
- Parameters
-
Definition at line 158 of file transcript.hpp.