PovwNonce

Struct PovwNonce 

Source
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

Source

pub const ZERO: Self

A zero nonce constant.

Source

pub fn to_bytes(self) -> [u8; 32]

Converts the nonce to a 256-bit byte array in little-endian format.

Source

pub fn from_bytes(bytes: [u8; 32]) -> Self

Creates a nonce from a 256-bit byte array in little-endian format.

Source

pub fn to_u256(self) -> U256

Converts the nonce to its U256 representation.

Source

pub fn to_u32s(self) -> [u32; 8]

Converts the nonce to an array of 8 u32 values.

Source

pub fn to_u16s(self) -> [u16; 16]

Converts the nonce to an array of 16 u16 values.

Source

pub fn from_u16s(u16s: [u16; 16]) -> Self

Creates a nonce from an array of 16 u16 values.

Source

pub fn encode_to_seal(&self, buf: &mut Vec<u32>)

Encodes the nonce to a seal buffer.

Source

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

Source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

Source§

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>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for PovwNonce

Source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

Source§

impl Clone for PovwNonce

Source§

fn clone(&self) -> PovwNonce

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PovwNonce

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PovwNonce

Source§

fn default() -> PovwNonce

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PovwNonce

Source§

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.
Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> PovwNonce

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> Map<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Map sampled values to type S Read more
Source§

impl From<PovwNonce> for U256

Source§

fn from(value: PovwNonce) -> Self

Convert a PovwNonce to its U256 representation.

Source§

impl From<Uint<256, 4>> for PovwNonce

Source§

fn from(value: U256) -> Self

Convert a U256 to a PovwNonce.

All U256 can be mapped to a unique PoVW nonce.

Source§

impl PartialEq for PovwNonce

Source§

fn eq(&self, other: &PovwNonce) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PovwNonce

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&[u8]> for PovwNonce

Source§

type Error = TryFromSliceError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<u8>> for PovwNonce

Source§

type Error = TryFromSliceError

The type returned in the event of a conversion error.
Source§

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for PovwNonce

Source§

impl Eq for PovwNonce

Source§

impl StructuralPartialEq for PovwNonce

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,