Struct grin_core::pow::Proof[][src]

pub struct Proof {
    pub edge_bits: u8,
    pub nonces: Vec<u64>,
}

A Cuck(at)oo Cycle proof of work, consisting of the edge_bits to get the graph size (i.e. the 2-log of the number of edges) and the nonces of the graph solution. While being expressed as u64 for simplicity, nonces a.k.a. edge indices range from 0 to (1 << edge_bits) - 1

The hash of the Proof is the hash of its packed nonces when serializing them at their exact bit size. The resulting bit sequence is padded to be byte-aligned.

Fields

edge_bits: u8

Power of 2 used for the size of the cuckoo graph

nonces: Vec<u64>

The nonces

Implementations

impl Proof[src]

pub fn new(in_nonces: Vec<u64>) -> Proof[src]

Builds a proof with provided nonces at default edge_bits

pub fn zero(proof_size: usize) -> Proof[src]

Builds a proof with all bytes zeroed out

pub fn random(proof_size: usize) -> Proof[src]

Builds a proof with random POW data, needed so that tests that ignore POW don’t fail due to duplicate hashes

pub fn proof_size(&self) -> usize[src]

Returns the proof size

Trait Implementations

impl Clone for Proof[src]

fn clone(&self) -> Proof[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Proof[src]

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

Formats the value using the given formatter. Read more

impl PartialEq<Proof> for Proof[src]

fn eq(&self, other: &Proof) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Proof) -> bool[src]

This method tests for !=.

impl PartialOrd<Proof> for Proof[src]

fn partial_cmp(&self, other: &Proof) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Readable for Proof[src]

fn read<R: Reader>(reader: &mut R) -> Result<Proof, Error>[src]

Reads the data necessary to this Readable from the provided reader

impl Serialize for Proof[src]

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

Serialize this value into the given Serde serializer. Read more

impl Writeable for Proof[src]

fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>[src]

Write the data held by this Writeable to the provided writer

impl DefaultHashable for Proof[src]

impl Eq for Proof[src]

impl StructuralPartialEq for Proof[src]

Auto Trait Implementations

impl RefUnwindSafe for Proof

impl Send for Proof

impl Sync for Proof

impl Unpin for Proof

impl UnwindSafe for Proof

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CloneAny for T where
    T: Any + Clone

pub fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>

pub fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send, Global> where
    T: Send

pub fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync, Global> where
    T: Sync

pub fn clone_any_send_sync(
    &self
) -> Box<dyn CloneAny + 'static + Sync + Send, Global> where
    T: Send + Sync

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<D> Hashed for D where
    D: DefaultHashable
[src]

pub fn hash(&Self) -> Hash[src]

Obtain the hash of the object

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> PMMRIndexHashable for T where
    T: DefaultHashable
[src]

pub fn hash_with_index(&Self, u64) -> Hash[src]

Hash with a given index

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<H> ShortIdentifiable for H where
    H: Hashed
[src]

pub fn short_id(&Self, &Hash, u64) -> ShortId[src]

Generate a short_id via the following -

  • extract k0/k1 from block_hash hashed with the nonce (first two u64 values) * initialize a siphasher24 with k0/k1
    • self.hash() passing in the siphasher24 instance
    • drop the 2 most significant bytes (to return a 6 byte short_id)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> UnsafeAny for T where
    T: Any