jf_plonk::transcript

Trait PlonkTranscript

Source
pub trait PlonkTranscript<F> {
    // Required methods
    fn new(label: &'static [u8]) -> Self;
    fn append_message(
        &mut self,
        label: &'static [u8],
        msg: &[u8],
    ) -> Result<(), PlonkError>;
    fn get_challenge<E>(
        &mut self,
        label: &'static [u8],
    ) -> Result<E::ScalarField, PlonkError>
       where E: Pairing<BaseField = F>;

    // Provided methods
    fn append_vk_and_pub_input<E, P>(
        &mut self,
        vk: &VerifyingKey<E>,
        pub_input: &[E::ScalarField],
    ) -> Result<(), PlonkError>
       where E: Pairing<BaseField = F, G1Affine = Affine<P>>,
             P: SWParam<BaseField = F> { ... }
    fn append_commitments<E, P>(
        &mut self,
        label: &'static [u8],
        comms: &[Commitment<E>],
    ) -> Result<(), PlonkError>
       where E: Pairing<BaseField = F, G1Affine = Affine<P>>,
             P: SWParam<BaseField = F> { ... }
    fn append_commitment<E, P>(
        &mut self,
        label: &'static [u8],
        comm: &Commitment<E>,
    ) -> Result<(), PlonkError>
       where E: Pairing<BaseField = F, G1Affine = Affine<P>>,
             P: SWParam<BaseField = F> { ... }
    fn append_field_elem<E>(
        &mut self,
        label: &'static [u8],
        field: &E::ScalarField,
    ) -> Result<(), PlonkError>
       where E: Pairing<BaseField = F> { ... }
    fn append_field_elems<E>(
        &mut self,
        label: &'static [u8],
        fields: &[E::ScalarField],
    ) -> Result<(), PlonkError>
       where E: Pairing<BaseField = F> { ... }
    fn append_proof_evaluations<E: Pairing<BaseField = F>>(
        &mut self,
        evals: &ProofEvaluations<E::ScalarField>,
    ) -> Result<(), PlonkError> { ... }
    fn append_plookup_evaluations<E: Pairing<BaseField = F>>(
        &mut self,
        evals: &PlookupEvaluations<E::ScalarField>,
    ) -> Result<(), PlonkError> { ... }
    fn get_n_challenges<E>(
        &mut self,
        labels: &[&'static [u8]],
    ) -> Result<Vec<E::ScalarField>, PlonkError>
       where E: Pairing<BaseField = F> { ... }
}
Expand description

Defines transcript APIs.

It has an associated type F which defines the native field for the snark circuit.

The transcript can be either a Merlin transcript (instantiated with Sha-3/keccak), or a Rescue transcript (instantiated with Rescue hash), or a Solidity-friendly transcript (instantiated with Keccak256 hash). The second is only used for recursive snarks.

Required Methods§

Source

fn new(label: &'static [u8]) -> Self

Create a new plonk transcript.

Source

fn append_message( &mut self, label: &'static [u8], msg: &[u8], ) -> Result<(), PlonkError>

Append the message to the transcript.

Source

fn get_challenge<E>( &mut self, label: &'static [u8], ) -> Result<E::ScalarField, PlonkError>
where E: Pairing<BaseField = F>,

Generate a single challenge for the current round

Provided Methods§

Source

fn append_vk_and_pub_input<E, P>( &mut self, vk: &VerifyingKey<E>, pub_input: &[E::ScalarField], ) -> Result<(), PlonkError>
where E: Pairing<BaseField = F, G1Affine = Affine<P>>, P: SWParam<BaseField = F>,

Append the verification key and the public input to the transcript.

Source

fn append_commitments<E, P>( &mut self, label: &'static [u8], comms: &[Commitment<E>], ) -> Result<(), PlonkError>
where E: Pairing<BaseField = F, G1Affine = Affine<P>>, P: SWParam<BaseField = F>,

Append a slice of commitments to the transcript.

Source

fn append_commitment<E, P>( &mut self, label: &'static [u8], comm: &Commitment<E>, ) -> Result<(), PlonkError>
where E: Pairing<BaseField = F, G1Affine = Affine<P>>, P: SWParam<BaseField = F>,

Append a single commitment to the transcript.

Source

fn append_field_elem<E>( &mut self, label: &'static [u8], field: &E::ScalarField, ) -> Result<(), PlonkError>
where E: Pairing<BaseField = F>,

Append a field element to the transcript.

Source

fn append_field_elems<E>( &mut self, label: &'static [u8], fields: &[E::ScalarField], ) -> Result<(), PlonkError>
where E: Pairing<BaseField = F>,

Append a list of field elements to the transcript

Source

fn append_proof_evaluations<E: Pairing<BaseField = F>>( &mut self, evals: &ProofEvaluations<E::ScalarField>, ) -> Result<(), PlonkError>

Append a proof evaluation to the transcript.

Source

fn append_plookup_evaluations<E: Pairing<BaseField = F>>( &mut self, evals: &PlookupEvaluations<E::ScalarField>, ) -> Result<(), PlonkError>

Append the plookup evaluation to the transcript.

Source

fn get_n_challenges<E>( &mut self, labels: &[&'static [u8]], ) -> Result<Vec<E::ScalarField>, PlonkError>
where E: Pairing<BaseField = F>,

Generate multiple challenges for the current round Implementers should be careful about domain separation for each challenge The default implementation assume self.get_challenge() already implements proper domain separation for each challenge generation, thus simply call it multiple times.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F> PlonkTranscript<F> for RescueTranscript<F>
where F: RescueParameter + SWToTEConParam,

Source§

impl<F> PlonkTranscript<F> for StandardTranscript

Source§

impl<F: PrimeField> PlonkTranscript<F> for SolidityTranscript