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§
Required Methods§
Provided Methods§
Sourcefn check_witness(&mut self, bits: usize, witness: Self::Witness) -> bool
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.