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§
Required Methods§
Sourcefn epoch(&self) -> EpochNumber
fn epoch(&self) -> EpochNumber
The epoch this snapshot is bound to.
Sourcefn first_epoch(&self) -> Option<EpochNumber>
fn first_epoch(&self) -> Option<EpochNumber>
The first epoch known to the membership (cached at snapshot creation).
Sourcefn has_drb(&self) -> bool
fn has_drb(&self) -> bool
Whether a randomized stake table (DRB result) was available for this epoch at the time the snapshot was captured.
Sourcefn stake_table(&self) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send
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.
Sourcefn da_stake_table(&self) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send
fn da_stake_table(&self) -> impl ExactSizeIterator<Item = &PeerConfig<T>> + Send
The DA stake table for this epoch.
Sourcefn committee_members(
&self,
view: ViewNumber,
) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send
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.
Sourcefn da_committee_members(
&self,
view: ViewNumber,
) -> impl ExactSizeIterator<Item = &T::SignatureKey> + Send
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.
Sourcefn stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>
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.
Sourcefn da_stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>
fn da_stake(&self, key: &T::SignatureKey) -> Option<PeerConfig<T>>
The DA stake-table entry for key, or None.
Sourcefn has_stake(&self, key: &T::SignatureKey) -> bool
fn has_stake(&self, key: &T::SignatureKey) -> bool
Whether key has stake in this epoch.
Sourcefn has_da_stake(&self, key: &T::SignatureKey) -> bool
fn has_da_stake(&self, key: &T::SignatureKey) -> bool
Whether key has DA stake in this epoch.
Sourcefn lookup_leader(
&self,
view: ViewNumber,
) -> Result<T::SignatureKey, Self::Error>
fn lookup_leader( &self, view: ViewNumber, ) -> Result<T::SignatureKey, Self::Error>
Provided Methods§
Sourcefn stake_table_hash(&self) -> Option<Commitment<Self::StakeTableHash>>
fn stake_table_hash(&self) -> Option<Commitment<Self::StakeTableHash>>
The commitment of the stake table for this epoch, if available.
Sourcefn total_nodes(&self) -> usize
fn total_nodes(&self) -> usize
Number of members in this epoch’s stake table.
Sourcefn da_total_nodes(&self) -> usize
fn da_total_nodes(&self) -> usize
Number of members in this epoch’s DA committee.
Sourcefn total_stake(&self) -> U256
fn total_stake(&self) -> U256
Sum of all stake in this epoch.
Sourcefn total_da_stake(&self) -> U256
fn total_da_stake(&self) -> U256
Sum of all DA stake in this epoch.
Sourcefn success_threshold(&self) -> U256
fn success_threshold(&self) -> U256
Quorum (supermajority) threshold for this epoch.
Sourcefn da_success_threshold(&self) -> U256
fn da_success_threshold(&self) -> U256
DA quorum threshold for this epoch.
Sourcefn failure_threshold(&self) -> U256
fn failure_threshold(&self) -> U256
Failure threshold (1/3 + 1) for this epoch.
Sourcefn upgrade_threshold(&self) -> U256
fn upgrade_threshold(&self) -> U256
Threshold required for a protocol upgrade.
Sourcefn leader(&self, view: ViewNumber) -> Result<T::SignatureKey>
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.