#[repr(C)]pub struct Proofs<const K: u8> {
pub found_proofs: [u8; 8192],
pub proofs: [[u8; _]; 32768],
}Expand description
Proof-of-space proofs
Fields§
§found_proofs: [u8; 8192]S-buckets at which proofs were found.
S-buckets are grouped by 8, within each u8 bits right to left (LSB) indicate the presence
of a proof for corresponding s-bucket, so that the whole array of bytes can be thought as a
large set of bits.
There are always exactly [Record::NUM_CHUNKS] proofs produced/bits set to 1. This is a
protected invariant. Proofs::for_s_bucket() relies on it, and so does plotting in the
farmer, which encodes every record chunk with one of these proofs. Some of them may be
Proofs::PLACEHOLDER_PROOF.
proofs: [[u8; _]; 32768][Record::NUM_CHUNKS] proofs, corresponding to set bits of found_proofs.
Implementations§
Source§impl<const K: u8> Proofs<K>
impl<const K: u8> Proofs<K>
Sourcepub const PLACEHOLDER_PROOF: [u8; _]
pub const PLACEHOLDER_PROOF: [u8; _]
Proof for s-buckets that are marked as having a proof without actually having one.
There are always exactly [Record::NUM_CHUNKS] proofs, but very rarely fewer s-buckets have
a proof (roughly once in 2^40 seeds for K = 20). Then the first s-buckets without a
proof are marked as having this all-zero one instead. It can be used for encoding like any
other proof, but it is not a valid proof.
Sourcepub fn for_s_bucket(&self, s_bucket: SBucket) -> Option<[u8; _]>
pub fn for_s_bucket(&self, s_bucket: SBucket) -> Option<[u8; _]>
Get proof for specified s-bucket (if exists).
Note that this is not the most efficient API possible, so prefer using the proofs field
directly if the use case allows.
Trait Implementations§
Auto Trait Implementations§
impl<const K: u8> Forget for Proofs<K>
impl<const K: u8> Freeze for Proofs<K>
impl<const K: u8> Move for Proofs<K>
impl<const K: u8> RefUnwindSafe for Proofs<K>
impl<const K: u8> Send for Proofs<K>
impl<const K: u8> Sync for Proofs<K>
impl<const K: u8> Unpin for Proofs<K>
impl<const K: u8> UnsafeUnpin for Proofs<K>
impl<const K: u8> UnwindSafe for Proofs<K>
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> 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