pub struct PovwNonce {
pub log: PovwLogId,
pub job: u64,
pub segment: u32,
}
Expand description
A 256-bit unique nonce for Proof of Verifiable Work.
Each nonce uniquely identifies a single segment proof and prevents double-counting of work. The nonce has a structured format combining a work log ID, job number, and segment index.
Fields§
§log: PovwLogId
Work log identifier.
job: u64
Job number within the work log.
segment: u32
Segment index within the job.
Implementations§
Source§impl PovwNonce
impl PovwNonce
Sourcepub fn to_bytes(self) -> [u8; 32]
pub fn to_bytes(self) -> [u8; 32]
Converts the nonce to a 256-bit byte array in little-endian format.
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Creates a nonce from a 256-bit byte array in little-endian format.
Sourcepub fn encode_to_seal(&self, buf: &mut Vec<u32>)
pub fn encode_to_seal(&self, buf: &mut Vec<u32>)
Encodes the nonce to a seal buffer.
Sourcepub fn decode_from_seal(buf: &mut VecDeque<u32>) -> Result<Self, DecodeError>
pub fn decode_from_seal(buf: &mut VecDeque<u32>) -> Result<Self, DecodeError>
Decodes a nonce from a seal buffer.
Trait Implementations§
Source§impl BorshDeserialize for PovwNonce
impl BorshDeserialize for PovwNonce
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for PovwNonce
impl BorshSerialize for PovwNonce
Source§impl<'de> Deserialize<'de> for PovwNonce
impl<'de> Deserialize<'de> for PovwNonce
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Distribution<PovwNonce> for StandardUniform
Available on crate feature rand
only.
impl Distribution<PovwNonce> for StandardUniform
Available on crate feature
rand
only.impl Copy for PovwNonce
impl Eq for PovwNonce
impl StructuralPartialEq for PovwNonce
Auto Trait Implementations§
impl Freeze for PovwNonce
impl RefUnwindSafe for PovwNonce
impl Send for PovwNonce
impl Sync for PovwNonce
impl Unpin for PovwNonce
impl UnwindSafe for PovwNonce
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
Mutably borrows from an owned value. Read more