logo
pub struct TrustThresholdFraction { /* private fields */ }
Expand description

TrustThresholdFraction defines what fraction of the total voting power of a known and trusted validator set is sufficient for a commit to be accepted going forward. The Default::default() returns true, iff at least a third of the trusted voting power signed (in other words at least one honest validator signed). Some clients might require more than +1/3 and can implement their own TrustThreshold which can be passed into all relevant methods.

Implementations

Constant for a trust threshold of 1/3.

Constant for a trust threshold of 2/3.

Instantiate a TrustThresholdFraction if the given denominator and numerator are valid.

The parameters are valid iff 1/3 <= numerator/denominator < 1. In any other case we return an error.

The numerator of this fraction.

The denominator of this fraction.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Check whether the given signed voting power is sufficient according to this trust threshold against the given total voting power. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.