GrindingChallenger

Trait GrindingChallenger 

Source
pub trait GrindingChallenger:
    CanObserve<Self::Witness>
    + CanSampleBits<usize>
    + Sync
    + Clone {
    type Witness: Field;

    // Required method
    fn grind(&mut self, bits: usize) -> Self::Witness;

    // Provided method
    fn check_witness(&mut self, bits: usize, witness: Self::Witness) -> bool { ... }
}
Expand description

Trait for challengers that support proof-of-work (PoW) grinding.

A GrindingChallenger can:

  • Absorb a candidate witness into the transcript
  • Sample random bitstrings to check the PoW condition
  • Brute-force search for a valid witness that satisfies the PoW

This trait is typically used in protocols requiring computational effort from the prover.

Required Associated Types§

Source

type Witness: Field

The underlying field element type used as the witness.

Required Methods§

Source

fn grind(&mut self, bits: usize) -> Self::Witness

Perform a brute-force search to find a valid PoW witness.

Given a bits parameter, this function searches for a field element witness such that after observing it, the next bits bits that challenger outputs are all 0.

Provided Methods§

Source

fn check_witness(&mut self, bits: usize, witness: Self::Witness) -> bool

Check whether a given witness satisfies the PoW condition.

After absorbing the witness, the challenger samples bits random bits and verifies that all bits sampled are zero.

Returns true if the witness passes the PoW check, false otherwise.

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, Inner> GrindingChallenger for SerializingChallenger32<F, Inner>
where F: PrimeField32, Inner: CanSample<u8> + CanObserve<u8> + Clone + Send + Sync,

Source§

impl<F, Inner> GrindingChallenger for SerializingChallenger64<F, Inner>
where F: PrimeField64, Inner: CanSample<u8> + CanObserve<u8> + Clone + Send + Sync,

Source§

impl<F, P, const WIDTH: usize, const RATE: usize> GrindingChallenger for DuplexChallenger<F, P, WIDTH, RATE>

Source§

impl<F, PF, P, const WIDTH: usize, const RATE: usize> GrindingChallenger for MultiField32Challenger<F, PF, P, WIDTH, RATE>