#[repr(C)]pub struct PosProofs {
pub found_proofs: [u8; 8192],
pub proofs: [PosProof; 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. PosProofs::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
PosProofs::PLACEHOLDER_PROOF.
proofs: [PosProof; 32768][Record::NUM_CHUNKS] proofs, corresponding to set bits of found_proofs.
Implementations§
Source§impl PosProofs
impl PosProofs
Sourcepub const PLACEHOLDER_PROOF: [u8; ab_core_primitives::pos::PosProof::SIZE]
pub const PLACEHOLDER_PROOF: [u8; ab_core_primitives::pos::PosProof::SIZE]
Proof for s-buckets that are marked as having a proof without actually having one.
Very rarely there are fewer s-buckets with a proof than [Record::NUM_CHUNKS]. Then the
first s-buckets without a proof are marked as having this one instead, which 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<PosProof>
pub fn for_s_bucket(&self, s_bucket: SBucket) -> Option<PosProof>
Get proof for specified s-bucket (if exists), which may be Self::PLACEHOLDER_PROOF.
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 Forget for PosProofs
impl Freeze for PosProofs
impl Move for PosProofs
impl RefUnwindSafe for PosProofs
impl Send for PosProofs
impl Sync for PosProofs
impl Unpin for PosProofs
impl UnsafeUnpin for PosProofs
impl UnwindSafe for PosProofs
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