barretenberg
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
transcript::Transcript Class Reference

#include <transcript.hpp>

Inheritance diagram for transcript::Transcript:
transcript::StandardTranscript

Public Types

typedef proof_system::plonk::verification_key Key
 

Public Member Functions

 Transcript (const Manifest input_manifest, const HashType hash_type=HashType::Keccak256, const size_t challenge_bytes=32)
 
 Transcript (const std::vector< uint8_t > &input_transcript, const Manifest input_manifest, const HashType hash_type=HashType::Keccak256, const size_t challenge_bytes=32)
 
Manifest get_manifest () const
 
void add_element (const std::string &element_name, const std::vector< uint8_t > &buffer)
 
void apply_fiat_shamir (const std::string &challenge_name)
 
bool has_challenge (const std::string &challenge_name) const
 
std::array< uint8_t, PRNG_OUTPUT_SIZE > get_challenge (const std::string &challenge_name, const size_t idx=0) const
 
int get_challenge_index_from_map (const std::string &challenge_map_name) const
 
std::array< uint8_t, PRNG_OUTPUT_SIZE > get_challenge_from_map (const std::string &challenge_name, const std::string &challenge_map_name) const
 
size_t get_num_challenges (const std::string &challenge_name) const
 
std::vector< uint8_t > get_element (const std::string &element_name) const
 
size_t get_element_size (const std::string &element_name) const
 
std::vector< uint8_t > export_transcript () const
 
void compute_challenge_map ()
 
void mock_inputs_prior_to_challenge (const std::string &challenge_name, size_t circuit_size=1)
 Mock prover transcript interactions up to fiat-shamir of a given challenge.
 
void print ()
 

Detailed Description

Transcript is used by the Prover to store round values and derive challenges. The verifier uses it to parse serialized values and get the data and challenges back.

Constructor & Destructor Documentation

◆ Transcript() [1/2]

transcript::Transcript::Transcript ( const Manifest  input_manifest,
const HashType  hash_type = HashType::Keccak256,
const size_t  challenge_bytes = 32 
)
inline

Create a new transcript for Prover based on the manifest.

Parameters
input_manifesThe manifest with round descriptions.
hash_typeThe hash to use for Fiat-Shamir.
challenge_bytesThe number of bytes per challenge to generate.

◆ Transcript() [2/2]

transcript::Transcript::Transcript ( const std::vector< uint8_t > &  input_transcript,
const Manifest  input_manifest,
const HashType  hash_type = HashType::Keccak256,
const size_t  challenge_bytes = 32 
)

Parse a serialized version of an input_transcript into a deserialized one based on the manifest.

Parameters
input_transcriptSerialized transcript.
input_manifestThe manifest which governs the parsing.
hash_typeThe hash used for Fiat-Shamir
challenge_bytesThe number of bytes per challenge to generate.

Member Function Documentation

◆ apply_fiat_shamir()

void transcript::Transcript::apply_fiat_shamir ( const std::string &  challenge_name)

Apply Fiat-Shamir transform to create challenges for the current round. The challenges are saved to transcript. Round number is increased.

Parameters
challenge_nameChallenge name (needed to check if the challenge fits the current round).

◆ compute_challenge_map()

void transcript::Transcript::compute_challenge_map ( )

Insert element names from all rounds of the manifest into the challenge_map.

◆ export_transcript()

std::vector< uint8_t > transcript::Transcript::export_transcript ( ) const

Serialize transcript to a vector of bytes.

Returns
Serialized transcript

◆ get_challenge()

std::array< uint8_t, Transcript::PRNG_OUTPUT_SIZE > transcript::Transcript::get_challenge ( const std::string &  challenge_name,
const size_t  idx = 0 
) const

Get the challenge with the given name at index. Will fail if there is no challenge with such name or there are not enough subchallenges in the vector.

Parameters
challenge_nameThe name of the challenge.
idxThe idx of subchallenge
Returns
The challenge value

◆ get_challenge_from_map()

std::array< uint8_t, Transcript::PRNG_OUTPUT_SIZE > transcript::Transcript::get_challenge_from_map ( const std::string &  challenge_name,
const std::string &  challenge_map_name 
) const

Get a particular subchallenge value by the name of the subchallenge. For example, we use it with (nu, r).

Parameters
challenge_nameThe name of the challenge.
challenge_map_nameThe name of the subchallenge.
Returns
The value of the subchallenge.

◆ get_challenge_index_from_map()

int transcript::Transcript::get_challenge_index_from_map ( const std::string &  challenge_map_name) const

Get the challenge index from map (needed when we name subchallenges).

Parameters
challenge_map_nameThe name of the subchallenge
Returns
The index of the subchallenge in the vector corresponding to the challenge.

◆ get_element()

std::vector< uint8_t > transcript::Transcript::get_element ( const std::string &  element_name) const

Get the value of an element. Fails if there is no such element.

Parameters
element_nameThe name of the element.
Returns
The value of the element.

◆ get_element_size()

size_t transcript::Transcript::get_element_size ( const std::string &  element_name) const

Get the size of an element from the manifest.

Parameters
element_nameThe name of the element
Returns
The size of the element if found, otherwise -1.

◆ get_num_challenges()

size_t transcript::Transcript::get_num_challenges ( const std::string &  challenge_name) const

Get the number of subchallenges for a given challenge. Fails if no such challenge exists. We use it with beta/gamma which need to be created in one Fiat-Shamir transform.

Parameters
challenge_nameThe name of the challenge.
Returns
The number of subchallenges.

◆ has_challenge()

bool transcript::Transcript::has_challenge ( const std::string &  challenge_name) const

Check if a challenge exists.

Parameters
challenge_nameThe name of the challenge
Returns
true if exists, false if not

◆ mock_inputs_prior_to_challenge()

void transcript::Transcript::mock_inputs_prior_to_challenge ( const std::string &  challenge_in,
size_t  circuit_size = 1 
)

Mock prover transcript interactions up to fiat-shamir of a given challenge.

This is useful for testing individual parts of the prover since all transcript interactions must occur sequentially according to the manifest. Function allows for optional input of circuit_size since this is needed in some test cases, e.g. instantiating a Sumcheck from a mocked transcript.

Parameters
challenge_in

The documentation for this class was generated from the following files: