pub struct FusedPowConfig { /* private fields */ }Expand description
A configuration for proof of work on the transcript sponge.
For bits > 0:
- The prover sends the least passing nonce
n < 2^(bits + 7)as canonical unsigned LEB128. - The verifier checks the nonce encoding and range. Both parties absorb
the nonce and squeeze
ceil(bits / 8)check bytes. The verifier rejects unless their lowbitsbits, read little-endian, are zero. - Both parties derive the verifier message from the following sponge
output via
Transcript::verifier_message.
At zero difficulty, both parties derive the verifier message directly.
§Security
For fresh, independent uniform sponge output, the check passes with
probability 2^-bits. The bytes after the check remain uniform.
The soundness benefit depends on the protocol, sponge and challenge
decoding. The difficulty, placement of this step and verifier-message
type must be fixed by the protocol and bound in the session identifier.
§Performance
The default helper searches sequentially on the calling thread. On a
ProverState whose public sponge is Send,
verifier_message_pow_parallel (feature parallel) searches on the
Rayon pool and writes the same proof. With a permutation-backed sponge,
when the nonce, the check bytes and the returned message fit in one rate
block, a search trial costs about one permutation.
§Errors
The prover returns VerificationError if:
- The search exhausts the nonce space.
- At positive difficulty, a custom transcript provides no
Transcript::verifier_message_oracle. - The live transcript rejects the nonce that passed the oracle check. The nonce has already been written, so discard the prover state.
The verifier returns an error if the nonce is truncated, noncanonical or out of range, if the check bits are nonzero, or if the transcript has already been rejected.
§Panics
Panics if bits > 57: the u64 nonce space must hold 2^(bits+7) values.
Implementations§
Trait Implementations§
Source§impl Clone for FusedPowConfig
impl Clone for FusedPowConfig
impl Copy for FusedPowConfig
Source§impl Debug for FusedPowConfig
impl Debug for FusedPowConfig
impl Eq for FusedPowConfig
Source§impl PartialEq for FusedPowConfig
impl PartialEq for FusedPowConfig
Source§impl PowStrategy for FusedPowConfig
impl PowStrategy for FusedPowConfig
Source§type Nonce = Leb128
type Nonce = Leb128
Source§fn last_nonce(&self) -> u64
fn last_nonce(&self) -> u64
Source§fn challenge_len(&self) -> usize
fn challenge_len(&self) -> usize
Source§fn accepts(&self, _nonce: u64, challenge: &[u8]) -> bool
fn accepts(&self, _nonce: u64, challenge: &[u8]) -> bool
challenge must contain exactly Self::challenge_len bytes. Read moreimpl StructuralPartialEq for FusedPowConfig
Auto Trait Implementations§
impl Forget for FusedPowConfig
impl Freeze for FusedPowConfig
impl Move for FusedPowConfig
impl RefUnwindSafe for FusedPowConfig
impl Send for FusedPowConfig
impl Sync for FusedPowConfig
impl Unpin for FusedPowConfig
impl UnsafeUnpin for FusedPowConfig
impl UnwindSafe for FusedPowConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more