pub struct Solution {
nonce: Nonce,
effort: Effort,
seed_head: SeedHead,
proof: Solution,
}
Expand description
Fields§
§nonce: Nonce
Arbitrary value chosen by the solver to reach a valid solution
Services are responsible for remembering used values to prevent replay.
effort: Effort
The effort chosen by the client
This is validated against the actual effort spent by the client using a combination of two checks:
-
We can ensure the effort value here was chosen prior to successfully solving the Equi-X puzzle just by verifying the Equi-X proof. Effort values are part of the
crate::pow::v1::challenge::Challenge
string the puzzle is constructed around. -
We can ensure, on average, that the proper proportion of Equi-X solutions have been discarded. The proof and challenge are hashed, and the resulting digest is effectively a random variable that must fit within a range inversely proportional to the effort. This test happens in
crate::pow::v1::challenge::Challenge::check_effort
.
seed_head: SeedHead
Prefix of the Seed
used in this puzzle Instance
A service will normally have two active Seed
values at once.
This prefix is sufficient to distinguish between them. (Services
skip seeds which would have the same prefix as the last seed.)
proof: Solution
Equi-X solution which claims to prove the above effort choice
Implementations§
Source§impl Solution
impl Solution
Sourcepub fn new(
nonce: Nonce,
effort: Effort,
seed_head: SeedHead,
proof: Solution,
) -> Self
pub fn new( nonce: Nonce, effort: Effort, seed_head: SeedHead, proof: Solution, ) -> Self
Construct a new Solution around a well-formed [equix::Solution
] proof.
Sourcepub fn try_from_bytes(
nonce: Nonce,
effort: Effort,
seed_head: SeedHead,
bytes: &SolutionByteArray,
) -> Result<Self, SolutionErrorV1>
pub fn try_from_bytes( nonce: Nonce, effort: Effort, seed_head: SeedHead, bytes: &SolutionByteArray, ) -> Result<Self, SolutionErrorV1>
Try to build a Solution
from an unvalidated equix::SolutionByteArray
.
This will either return a Solution
or a SolutionErrorV1::Order
.
Sourcepub fn effort(&self) -> Effort
pub fn effort(&self) -> Effort
Get the client-chosen and provable Effort
value used in this solution
Sourcepub fn seed_head(&self) -> SeedHead
pub fn seed_head(&self) -> SeedHead
Get the SeedHead
value identifying the puzzle this solution is for
Sourcepub fn proof_to_bytes(&self) -> SolutionByteArray
pub fn proof_to_bytes(&self) -> SolutionByteArray
Clone the proof portion of the solution in its canonical byte string format
Trait Implementations§
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 UnwindSafe for Solution
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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