Trait hotshot_types::traits::election::Membership
source · pub trait Membership<TYPES: NodeType>: Clone + Debug + Eq + PartialEq + Send + Sync + Hash + 'static {
// Required methods
fn new(
eligible_leaders: Vec<PeerConfig<TYPES::SignatureKey>>,
committee_members: Vec<PeerConfig<TYPES::SignatureKey>>,
committee_topic: Topic
) -> Self;
fn stake_table(
&self
) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
fn committee_members(
&self,
view_number: TYPES::Time
) -> BTreeSet<TYPES::SignatureKey>;
fn stake(
&self,
pub_key: &TYPES::SignatureKey
) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
fn has_stake(&self, pub_key: &TYPES::SignatureKey) -> bool;
fn leader(&self, view_number: TYPES::Time) -> TYPES::SignatureKey;
fn committee_topic(&self) -> Topic;
fn total_nodes(&self) -> usize;
fn success_threshold(&self) -> NonZeroU64;
fn failure_threshold(&self) -> NonZeroU64;
fn upgrade_threshold(&self) -> NonZeroU64;
}
Expand description
A protocol for determining membership in and participating in a committee.
Required Methods§
sourcefn new(
eligible_leaders: Vec<PeerConfig<TYPES::SignatureKey>>,
committee_members: Vec<PeerConfig<TYPES::SignatureKey>>,
committee_topic: Topic
) -> Self
fn new( eligible_leaders: Vec<PeerConfig<TYPES::SignatureKey>>, committee_members: Vec<PeerConfig<TYPES::SignatureKey>>, committee_topic: Topic ) -> Self
Create a committee
sourcefn stake_table(
&self
) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
fn stake_table( &self ) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
Get all participants in the committee (including their stake)
sourcefn committee_members(
&self,
view_number: TYPES::Time
) -> BTreeSet<TYPES::SignatureKey>
fn committee_members( &self, view_number: TYPES::Time ) -> BTreeSet<TYPES::SignatureKey>
Get all participants in the committee for a specific view
sourcefn stake(
&self,
pub_key: &TYPES::SignatureKey
) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
fn stake( &self, pub_key: &TYPES::SignatureKey ) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
Get the stake table entry for a public key, returns None
if the
key is not in the table
sourcefn has_stake(&self, pub_key: &TYPES::SignatureKey) -> bool
fn has_stake(&self, pub_key: &TYPES::SignatureKey) -> bool
See if a node has stake in the committee
sourcefn leader(&self, view_number: TYPES::Time) -> TYPES::SignatureKey
fn leader(&self, view_number: TYPES::Time) -> TYPES::SignatureKey
The leader of the committee for view view_number
.
sourcefn committee_topic(&self) -> Topic
fn committee_topic(&self) -> Topic
Get the network topic for the committee
sourcefn total_nodes(&self) -> usize
fn total_nodes(&self) -> usize
Returns the number of total nodes in the committee
sourcefn success_threshold(&self) -> NonZeroU64
fn success_threshold(&self) -> NonZeroU64
Returns the threshold for a specific Membership
implementation
sourcefn failure_threshold(&self) -> NonZeroU64
fn failure_threshold(&self) -> NonZeroU64
Returns the threshold for a specific Membership
implementation
sourcefn upgrade_threshold(&self) -> NonZeroU64
fn upgrade_threshold(&self) -> NonZeroU64
Returns the threshold required to upgrade the network protocol
Object Safety§
This trait is not object safe.