Skip to main content

MembershipSnapshot

Trait MembershipSnapshot 

Source
pub trait MembershipSnapshot<T: NodeType>:
    Clone
    + Send
    + Sync {
    type Error: Error + Send + Sync + 'static;
    type StakeTableHash: Committable;

Show 22 methods // Required methods fn epoch(&self) -> EpochNumber; fn first_epoch(&self) -> Option<EpochNumber>; fn has_drb(&self) -> bool; fn stake_table( &self, ) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send; fn da_stake_table( &self, ) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send; fn committee_members( &self, view: ViewNumber, ) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send; fn da_committee_members( &self, view: ViewNumber, ) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send; fn stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>; fn da_stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>; fn has_stake(&self, key: &T::SignatureKey) -> bool; fn has_da_stake(&self, key: &T::SignatureKey) -> bool; fn lookup_leader( &self, view: ViewNumber, ) -> Result<T::SignatureKey, Self::Error>; // Provided methods fn stake_table_hash(&self) -> Option<Commitment<Self::StakeTableHash>> { ... } fn total_nodes(&self) -> usize { ... } fn da_total_nodes(&self) -> usize { ... } fn total_stake(&self) -> U256 { ... } fn total_da_stake(&self) -> U256 { ... } fn success_threshold(&self) -> U256 { ... } fn da_success_threshold(&self) -> U256 { ... } fn failure_threshold(&self) -> U256 { ... } fn upgrade_threshold(&self) -> U256 { ... } fn leader(&self, view: ViewNumber) -> Result<T::SignatureKey> { ... }
}
Expand description

A consistent per-epoch view of a Membership.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Source

type StakeTableHash: Committable

Required Methods§

Source

fn epoch(&self) -> EpochNumber

The epoch this snapshot is bound to.

Source

fn first_epoch(&self) -> Option<EpochNumber>

The first epoch known to the membership (cached at snapshot creation).

Source

fn has_drb(&self) -> bool

Whether a randomized stake table (DRB result) was available for this epoch at the time the snapshot was captured.

Source

fn stake_table(&self) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send

The (non-DA) stake table for this epoch.

Iteration order is the stake-table position order — the position of a key in this iterator equals the value returned by the implementation’s get_validator_index (where applicable) and is part of the per-epoch consensus contract.

Source

fn da_stake_table(&self) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send

The DA stake table for this epoch.

Source

fn committee_members( &self, view: ViewNumber, ) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send

The set of public keys with stake in this epoch, in stake-table order.

Source

fn da_committee_members( &self, view: ViewNumber, ) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send

The set of public keys in the DA committee for this epoch.

Source

fn stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>

The stake-table entry for key, or None if the key is not in the committee for this epoch.

Source

fn da_stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>

The DA stake-table entry for key, or None.

Source

fn has_stake(&self, key: &T::SignatureKey) -> bool

Whether key has stake in this epoch.

Source

fn has_da_stake(&self, key: &T::SignatureKey) -> bool

Whether key has DA stake in this epoch.

Source

fn lookup_leader( &self, view: ViewNumber, ) -> Result<T::SignatureKey, Self::Error>

The leader for view in this epoch.

§Errors

Returns an error if the leader cannot be calculated.

Provided Methods§

Source

fn stake_table_hash(&self) -> Option<Commitment<Self::StakeTableHash>>

The commitment of the stake table for this epoch, if available.

Source

fn total_nodes(&self) -> usize

Number of members in this epoch’s stake table.

Source

fn da_total_nodes(&self) -> usize

Number of members in this epoch’s DA committee.

Source

fn total_stake(&self) -> U256

Sum of all stake in this epoch.

Source

fn total_da_stake(&self) -> U256

Sum of all DA stake in this epoch.

Source

fn success_threshold(&self) -> U256

Quorum (supermajority) threshold for this epoch.

Source

fn da_success_threshold(&self) -> U256

DA quorum threshold for this epoch.

Source

fn failure_threshold(&self) -> U256

Failure threshold (1/3 + 1) for this epoch.

Source

fn upgrade_threshold(&self) -> U256

Threshold required for a protocol upgrade.

Source

fn leader(&self, view: ViewNumber) -> Result<T::SignatureKey>

The leader for view in this epoch, returning a HotShot-internal error type. Default impl wraps Self::lookup_leader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§