Trait hotshot_types::vote::Certificate
source · pub trait Certificate<TYPES: NodeType, T>: HasViewNumber<TYPES> {
type Voteable: Voteable;
type Threshold: Threshold<TYPES>;
// Required methods
fn create_signed_certificate<V: Versions>(
vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>,
data: Self::Voteable,
sig: <TYPES::SignatureKey as SignatureKey>::QcType,
view: TYPES::View,
) -> Self;
fn is_valid_cert<V: Versions>(
&self,
stake_table: Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>,
threshold: NonZeroU64,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> impl Future<Output = bool>;
fn threshold<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: <TYPES as NodeType>::Epoch,
) -> u64;
fn stake_table<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: TYPES::Epoch,
) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
fn total_nodes<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: TYPES::Epoch,
) -> usize;
fn stake_table_entry<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
pub_key: &TYPES::SignatureKey,
epoch: TYPES::Epoch,
) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
fn data(&self) -> &Self::Voteable;
fn data_commitment<V: Versions>(
&self,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> impl Future<Output = Result<Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>>>;
}
Expand description
The certificate formed from the collection of signatures a committee.
The committee is defined by the Membership
associated type.
The votes all must be over the Commitment
associated type.
Required Associated Types§
Required Methods§
sourcefn create_signed_certificate<V: Versions>(
vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>,
data: Self::Voteable,
sig: <TYPES::SignatureKey as SignatureKey>::QcType,
view: TYPES::View,
) -> Self
fn create_signed_certificate<V: Versions>( vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>, data: Self::Voteable, sig: <TYPES::SignatureKey as SignatureKey>::QcType, view: TYPES::View, ) -> Self
Build a certificate from the data commitment and the quorum of signers
sourcefn is_valid_cert<V: Versions>(
&self,
stake_table: Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>,
threshold: NonZeroU64,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> impl Future<Output = bool>
fn is_valid_cert<V: Versions>( &self, stake_table: Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>, threshold: NonZeroU64, upgrade_lock: &UpgradeLock<TYPES, V>, ) -> impl Future<Output = bool>
Checks if the cert is valid in the given epoch
sourcefn threshold<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: <TYPES as NodeType>::Epoch,
) -> u64
fn threshold<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: <TYPES as NodeType>::Epoch, ) -> u64
Returns the amount of stake needed to create this certificate
sourcefn stake_table<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: TYPES::Epoch,
) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
fn stake_table<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: TYPES::Epoch, ) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
Get Stake Table from Membership implementation.
sourcefn total_nodes<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
epoch: TYPES::Epoch,
) -> usize
fn total_nodes<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: TYPES::Epoch, ) -> usize
Get Total Nodes from Membership implementation.
sourcefn stake_table_entry<MEMBERSHIP: Membership<TYPES>>(
membership: &MEMBERSHIP,
pub_key: &TYPES::SignatureKey,
epoch: TYPES::Epoch,
) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
fn stake_table_entry<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, pub_key: &TYPES::SignatureKey, epoch: TYPES::Epoch, ) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>
Get StakeTableEntry
from Membership implementation.
sourcefn data_commitment<V: Versions>(
&self,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> impl Future<Output = Result<Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>>>
fn data_commitment<V: Versions>( &self, upgrade_lock: &UpgradeLock<TYPES, V>, ) -> impl Future<Output = Result<Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>>>
Get the vote commitment which the votes commit to
Object Safety§
This trait is not object safe.