Type Alias PoseidonTranscript

Source
pub type PoseidonTranscript<L, S> = PoseidonTranscript<G1Affine, L, S, T, RATE, R_F, R_P>;

Aliased Type§

struct PoseidonTranscript<L, S> {
    pub loaded_stream: Vec<TranscriptObject<G1Affine, L>>,
    /* private fields */
}

Fields§

§loaded_stream: Vec<TranscriptObject<G1Affine, L>>

Only relevant for Halo2 loader: as elements from stream are read, they are assigned as witnesses. The loaded witnesses are pushed to loaded_stream. This way at the end we have the entire proof transcript as loaded witnesses.

Implementations

Source§

impl<C, S, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> PoseidonTranscript<C, NativeLoader, S, T, RATE, R_F, R_P>
where C: CurveAffine,

Source

pub fn new<const SECURE_MDS: usize>( stream: S, ) -> PoseidonTranscript<C, NativeLoader, S, T, RATE, R_F, R_P>

Initialize PoseidonTranscript given readable or writeable stream for verifying or proving with NativeLoader.

Source

pub fn from_spec( stream: S, spec: OptimizedPoseidonSpec<<C as PrimeCurveAffine>::Scalar, T, RATE>, ) -> PoseidonTranscript<C, NativeLoader, S, T, RATE, R_F, R_P>

Initialize PoseidonTranscript from a precomputed spec of round constants and MDS matrix because computing the constants is expensive.

Source

pub fn new_stream(&mut self, stream: S)

Clear the buffer and set the stream to a new one. Effectively the same as starting from a new transcript.

Source§

impl<C, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> PoseidonTranscript<C, NativeLoader, Vec<u8>, T, RATE, R_F, R_P>
where C: CurveAffine,

Source

pub fn clear(&mut self)

Clear the buffer and stream.

Source§

impl<C, W, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> PoseidonTranscript<C, NativeLoader, W, T, RATE, R_F, R_P>
where C: CurveAffine, W: Write,

Source

pub fn stream_mut(&mut self) -> &mut W

Returns mutable stream.

Source

pub fn finalize(self) -> W

Finalize transcript and returns stream.

Source§

impl<C, R, EccChip, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> PoseidonTranscript<C, Rc<Halo2Loader<C, EccChip>>, R, T, RATE, R_F, R_P>
where C: CurveAffine, R: Read, EccChip: NativeEncoding<C>,

Source

pub fn new<const SECURE_MDS: usize>( loader: &Rc<Halo2Loader<C, EccChip>>, stream: R, ) -> PoseidonTranscript<C, Rc<Halo2Loader<C, EccChip>>, R, T, RATE, R_F, R_P>

Initialize PoseidonTranscript given readable or writeable stream for verifying or proving with NativeLoader.

Source

pub fn from_spec( loader: &Rc<Halo2Loader<C, EccChip>>, stream: R, spec: OptimizedPoseidonSpec<<C as PrimeCurveAffine>::Scalar, T, RATE>, ) -> PoseidonTranscript<C, Rc<Halo2Loader<C, EccChip>>, R, T, RATE, R_F, R_P>

Initialize PoseidonTranscript from a precomputed spec of round constants and MDS matrix because computing the constants is expensive.

Source

pub fn new_stream(&mut self, stream: R)

Clear the buffer and set the stream to a new one. Effectively the same as starting from a new transcript.

Trait Implementations

Source§

impl<C, L, S, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> Debug for PoseidonTranscript<C, L, S, T, RATE, R_F, R_P>
where C: Debug + CurveAffine, L: Debug + Loader<C>, S: Debug, <C as PrimeCurveAffine>::Scalar: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<C, S, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> Transcript<C, ChallengeScalar<C>> for PoseidonTranscript<C, NativeLoader, S, T, RATE, R_F, R_P>
where C: CurveAffine,

Source§

fn squeeze_challenge(&mut self) -> ChallengeScalar<C>

Squeeze an encoded verifier challenge from the transcript.
Source§

fn common_point(&mut self, ec_point: C) -> Result<(), Error>

Writing the point to the transcript without writing it to the proof, treating it as a common input.
Source§

fn common_scalar( &mut self, scalar: <C as PrimeCurveAffine>::Scalar, ) -> Result<(), Error>

Writing the scalar to the transcript without writing it to the proof, treating it as a common input.
Source§

fn squeeze_challenge_scalar<T>(&mut self) -> ChallengeScalar<C, T>

Squeeze a typed challenge (in the scalar field) from the transcript.
Source§

impl<C, S, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> Transcript<C, NativeLoader> for PoseidonTranscript<C, NativeLoader, S, T, RATE, R_F, R_P>
where C: CurveAffine,

Source§

fn loader(&self) -> &NativeLoader

Returns Loader.
Source§

fn squeeze_challenge(&mut self) -> <C as PrimeCurveAffine>::Scalar

Squeeze a challenge.
Source§

fn common_scalar( &mut self, scalar: &<C as PrimeCurveAffine>::Scalar, ) -> Result<(), Error>

Update with a scalar.
Source§

fn common_ec_point(&mut self, ec_point: &C) -> Result<(), Error>

Update with an elliptic curve point.
Source§

fn squeeze_n_challenges( &mut self, n: usize, ) -> Vec<<L as ScalarLoader<<C as CurveAffine>::ScalarExt>>::LoadedScalar>

Squeeze n challenges.
Source§

impl<C, R, EccChip, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> Transcript<C, Rc<Halo2Loader<C, EccChip>>> for PoseidonTranscript<C, Rc<Halo2Loader<C, EccChip>>, R, T, RATE, R_F, R_P>
where C: CurveAffine, R: Read, EccChip: NativeEncoding<C>,

Source§

fn loader(&self) -> &Rc<Halo2Loader<C, EccChip>>

Returns Loader.
Source§

fn squeeze_challenge(&mut self) -> Scalar<C, EccChip>

Squeeze a challenge.
Source§

fn common_scalar(&mut self, scalar: &Scalar<C, EccChip>) -> Result<(), Error>

Update with a scalar.
Source§

fn common_ec_point( &mut self, ec_point: &EcPoint<C, EccChip>, ) -> Result<(), Error>

Update with an elliptic curve point.
Source§

fn squeeze_n_challenges( &mut self, n: usize, ) -> Vec<<L as ScalarLoader<<C as CurveAffine>::ScalarExt>>::LoadedScalar>

Squeeze n challenges.
Source§

impl<C, R, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptRead<C, ChallengeScalar<C>> for PoseidonTranscript<C, NativeLoader, R, T, RATE, R_F, R_P>
where C: CurveAffine, R: Read,

Source§

fn read_point(&mut self) -> Result<C, Error>

Read a curve point from the prover.
Source§

fn read_scalar(&mut self) -> Result<<C as PrimeCurveAffine>::Scalar, Error>

Read a curve scalar from the prover.
Source§

impl<C, R, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptRead<C, NativeLoader> for PoseidonTranscript<C, NativeLoader, R, T, RATE, R_F, R_P>
where C: CurveAffine, R: Read,

Source§

fn read_scalar(&mut self) -> Result<<C as PrimeCurveAffine>::Scalar, Error>

Read a scalar.
Source§

fn read_ec_point(&mut self) -> Result<C, Error>

Read a elliptic curve point.
Source§

fn read_n_scalars( &mut self, n: usize, ) -> Result<Vec<<L as ScalarLoader<<C as CurveAffine>::ScalarExt>>::LoadedScalar>, Error>

Read n scalar.
Source§

fn read_n_ec_points( &mut self, n: usize, ) -> Result<Vec<<L as EcPointLoader<C>>::LoadedEcPoint>, Error>

Read n elliptic curve point.
Source§

impl<C, R, EccChip, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptRead<C, Rc<Halo2Loader<C, EccChip>>> for PoseidonTranscript<C, Rc<Halo2Loader<C, EccChip>>, R, T, RATE, R_F, R_P>
where C: CurveAffine, R: Read, EccChip: NativeEncoding<C>,

Source§

fn read_scalar(&mut self) -> Result<Scalar<C, EccChip>, Error>

Read a scalar.
Source§

fn read_ec_point(&mut self) -> Result<EcPoint<C, EccChip>, Error>

Read a elliptic curve point.
Source§

fn read_n_scalars( &mut self, n: usize, ) -> Result<Vec<<L as ScalarLoader<<C as CurveAffine>::ScalarExt>>::LoadedScalar>, Error>

Read n scalar.
Source§

fn read_n_ec_points( &mut self, n: usize, ) -> Result<Vec<<L as EcPointLoader<C>>::LoadedEcPoint>, Error>

Read n elliptic curve point.
Source§

impl<C, R, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptReadBuffer<R, C, ChallengeScalar<C>> for PoseidonTranscript<C, NativeLoader, R, T, RATE, R_F, R_P>

Source§

fn init(reader: R) -> PoseidonTranscript<C, NativeLoader, R, T, RATE, R_F, R_P>

Initialize a transcript given an input buffer.
Source§

impl<C, W, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptWrite<C> for PoseidonTranscript<C, NativeLoader, W, T, RATE, R_F, R_P>
where C: CurveAffine, W: Write,

Source§

fn write_scalar( &mut self, scalar: <C as PrimeCurveAffine>::Scalar, ) -> Result<(), Error>

Write a scalar.
Source§

fn write_ec_point(&mut self, ec_point: C) -> Result<(), Error>

Write a elliptic curve point.
Source§

impl<C, W, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptWrite<C, ChallengeScalar<C>> for PoseidonTranscript<C, NativeLoader, W, T, RATE, R_F, R_P>
where C: CurveAffine, W: Write,

Source§

fn write_point(&mut self, ec_point: C) -> Result<(), Error>

Write a curve point to the proof and the transcript.
Source§

fn write_scalar( &mut self, scalar: <C as PrimeCurveAffine>::Scalar, ) -> Result<(), Error>

Write a scalar to the proof and the transcript.
Source§

impl<C, W, const T: usize, const RATE: usize, const R_F: usize, const R_P: usize> TranscriptWriterBuffer<W, C, ChallengeScalar<C>> for PoseidonTranscript<C, NativeLoader, W, T, RATE, R_F, R_P>

Source§

fn init(writer: W) -> PoseidonTranscript<C, NativeLoader, W, T, RATE, R_F, R_P>

Initialize a transcript given an output buffer.
Source§

fn finalize(self) -> W

Conclude the interaction and return the output buffer (writer).