Skip to main content

CollateralRequirementResult

Enum CollateralRequirementResult 

Source
pub enum CollateralRequirementResult {
    Known {
        epoch: u64,
        protocol_version: u16,
        required_per_store_dig_base_units: u64,
        stores: u64,
        owners: u64,
        multiplier_micros: u64,
        handicap_dig_base_units: u64,
    },
    Unknown {
        reason: CollateralUnknownReason,
    },
}
Expand description

control.collateral.requirement — this epoch’s per-store collateral requirement, or a named reason the node cannot state it.

UNKNOWN is a first-class answer, not an error. A node that has not censused the epoch, or that is inside the census finality depth, is not broken; it simply does not know yet. Making that a tagged variant rather than an optional number means there is no representable state in which a client holds a figure it has not been given — which is what dig-app SPEC.md §3.7b requires when it forbids any path that renders an absent requirement as a zero cost.

The census inputs travel with the figure on purpose. A client that can show only the number can say the price moved; a client holding stores, owners, multiplier_micros and handicap_dig_base_units can say WHY it moved. The per-epoch record already holds all four, so carrying them costs the node nothing and is the difference between a figure an operator can weigh and one they can only accept.

The margin is deliberately absent here. The requirement is a consensus-derived value every node derives identically; the margin is a local operator preference that MUST NOT be a consensus input. Returning them from one method would invite exactly the conflation dig-app SPEC.md §3.7b forbids — read the margin from CollateralMarginResult instead.

Variants§

§

Known

The node holds a final record for the epoch and states its requirement.

Fields

§epoch: u64

The epoch this requirement governs, one-based.

§protocol_version: u16

The collateral protocol version that COMPUTED this epoch.

Travels with the figure because the model is versioned and upgradable: a client that knows only the number cannot tell a disagreement from a rule change.

§required_per_store_dig_base_units: u64

The per-store requirement, in DIG base units, BEFORE any local safety margin.

§stores: u64

Qualifying (owner, store, root) advertisements counted in the census.

An advertisement count, never a node count: one owner publishing two roots for one store id contributes two.

§owners: u64

Distinct owner puzzle hashes across those advertisements.

Not a node count and not an operator count. A surface displaying it MUST say “collateralised owners”.

§multiplier_micros: u64

The controller multiplier for the epoch, in millionths (MULT_SCALE = 1_000_000).

§handicap_dig_base_units: u64

The small-network handicap applied for the epoch, in DIG base units.

§

Unknown

The node cannot state the requirement, and names which fact is missing.

Fields

§reason: CollateralUnknownReason

Which fact the node is missing.

Trait Implementations§

Source§

impl Clone for CollateralRequirementResult

Source§

fn clone(&self) -> CollateralRequirementResult

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CollateralRequirementResult

Source§

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

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

impl<'de> Deserialize<'de> for CollateralRequirementResult

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 Eq for CollateralRequirementResult

Source§

impl PartialEq for CollateralRequirementResult

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for CollateralRequirementResult

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 StructuralPartialEq for CollateralRequirementResult

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.