#[repr(C)]pub struct Solution {Show 17 fields
pub public_key_hash: Blake3Hash,
pub shard_commitment: SolutionShardCommitment,
pub piece_local_segment_index: LocalSegmentIndex,
pub piece_super_segment_index: SuperSegmentIndex,
pub segment_root: SegmentRoot,
pub segment_proof: SegmentProof,
pub record_root: RecordRoot,
pub record_proof: RecordProof,
pub chunk: RecordChunk,
pub chunk_proof: ChunkProof,
pub proof_of_space: PosProof,
pub history_size: HistorySize,
pub sector_index: SectorIndex,
pub piece_offset: PieceOffset,
pub segment_position: SegmentPosition,
pub piece_shard_index: ShardIndex,
pub padding: [u8; 4],
}Expand description
Farmer solution for slot challenge.
Fields§
§public_key_hash: Blake3HashPublic key of the farmer that created the solution
shard_commitment: SolutionShardCommitmentFarmer’s shard commitment
piece_local_segment_index: LocalSegmentIndexLocal segment index of the piece
piece_super_segment_index: SuperSegmentIndexSuper segment index
segment_root: SegmentRootSegment root
segment_proof: SegmentProofSegment proof
record_root: RecordRootRecord root that can use used to verify that the piece was included in blockchain history
record_proof: RecordProofProof that the record (root) belongs to a segment
chunk: RecordChunkChunk at the below piece offset
chunk_proof: ChunkProofProof for the above chunk
proof_of_space: PosProofProof of space for piece offset
history_size: HistorySizeSize of the blockchain history at the time of sector creation
sector_index: SectorIndexIndex of the sector where the solution was found
piece_offset: PieceOffsetPieces offset within sector
segment_position: SegmentPositionPosition of the segment in the super segment
piece_shard_index: ShardIndexShard index on which the piece was archived
padding: [u8; 4]Padding for data structure alignment
Implementations§
Source§impl Solution
impl Solution
Sourcepub fn genesis_solution() -> Self
pub fn genesis_solution() -> Self
Fake solution for the genesis block
Sourcepub fn verify_full<PotVerifier>(
&self,
slot: SlotNumber,
params: &SolutionVerifyFullParams,
) -> Result<(), SolutionVerifyError>where
PotVerifier: SolutionPotVerifier,
pub fn verify_full<PotVerifier>(
&self,
slot: SlotNumber,
params: &SolutionVerifyFullParams,
) -> Result<(), SolutionVerifyError>where
PotVerifier: SolutionPotVerifier,
Check solution validity
Sourcepub fn verify_stateless<PotVerifier>(
&self,
slot: SlotNumber,
params: &SolutionVerifyStatelessParams,
) -> Result<(), SolutionVerifyError>where
PotVerifier: SolutionPotVerifier,
pub fn verify_stateless<PotVerifier>(
&self,
slot: SlotNumber,
params: &SolutionVerifyStatelessParams,
) -> Result<(), SolutionVerifyError>where
PotVerifier: SolutionPotVerifier,
Stateless solution verification.
Checks most things, except checking that the piece belongs to the global history.
For piece verification use Self::verify_piece() or call Self::verify_full() for more
efficient verification of both at once.
Sourcepub fn verify_piece(
&self,
piece_check_params: &SolutionVerifyPieceParams,
) -> Result<(), SolutionVerifyError>
pub fn verify_piece( &self, piece_check_params: &SolutionVerifyPieceParams, ) -> Result<(), SolutionVerifyError>
Verify the piece details of the solution
Trait Implementations§
Source§impl Decode for Solution
impl Decode for Solution
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Source§impl<'de> Deserialize<'de> for Solution
impl<'de> Deserialize<'de> for Solution
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Encode for Solution
impl Encode for Solution
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl MaxEncodedLen for Solution
impl MaxEncodedLen for Solution
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Source§impl TrivialType for Solutionwhere
Blake3Hash: TrivialType,
SolutionShardCommitment: TrivialType,
LocalSegmentIndex: TrivialType,
SuperSegmentIndex: TrivialType,
SegmentRoot: TrivialType,
SegmentProof: TrivialType,
RecordRoot: TrivialType,
RecordProof: TrivialType,
RecordChunk: TrivialType,
ChunkProof: TrivialType,
PosProof: TrivialType,
HistorySize: TrivialType,
SectorIndex: TrivialType,
PieceOffset: TrivialType,
SegmentPosition: TrivialType,
ShardIndex: TrivialType,
[u8; 4]: TrivialType,
impl TrivialType for Solutionwhere
Blake3Hash: TrivialType,
SolutionShardCommitment: TrivialType,
LocalSegmentIndex: TrivialType,
SuperSegmentIndex: TrivialType,
SegmentRoot: TrivialType,
SegmentProof: TrivialType,
RecordRoot: TrivialType,
RecordProof: TrivialType,
RecordChunk: TrivialType,
ChunkProof: TrivialType,
PosProof: TrivialType,
HistorySize: TrivialType,
SectorIndex: TrivialType,
PieceOffset: TrivialType,
SegmentPosition: TrivialType,
ShardIndex: TrivialType,
[u8; 4]: TrivialType,
Source§const METADATA: &[u8]
const METADATA: &[u8]
IoTypeMetadataKind] for encoding details.const SIZE: u32 = _
§unsafe fn read_unaligned(bytes: &[u8]) -> Option<Self>
unsafe fn read_unaligned(bytes: &[u8]) -> Option<Self>
§unsafe fn read_unaligned_unchecked(bytes: &[u8]) -> Self
unsafe fn read_unaligned_unchecked(bytes: &[u8]) -> Self
Self::read_unaligned()], but doesn’t do any checks at all. Read more§unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
§unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
Self::from_bytes()], but doesn’t do any checks at all. Read more§unsafe fn from_bytes_mut(bytes: &mut [u8]) -> Option<&mut Self>
unsafe fn from_bytes_mut(bytes: &mut [u8]) -> Option<&mut Self>
§unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
Self::from_bytes_mut()], but doesn’t do any checks at all. Read more§unsafe fn as_bytes_mut(&mut self) -> &mut [u8; { _ }]
unsafe fn as_bytes_mut(&mut self) -> &mut [u8; { _ }]
impl Copy for Solution
impl EncodeLike for Solution
impl Eq for Solution
impl StructuralPartialEq for Solution
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnsafeUnpin for Solution
impl UnwindSafe for Solution
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,
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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§impl<T> IoType for Twhere
T: TrivialType,
impl<T> IoType for Twhere
T: TrivialType,
§const METADATA: &'static [u8] = T::METADATA
const METADATA: &'static [u8] = T::METADATA
IoTypeMetadataKind for encoding details§type PointerType = T
type PointerType = T
IoType represents