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§

source

type Voteable: Voteable

The data commitment this certificate certifies.

source

type Threshold: Threshold<TYPES>

Threshold Functions

Required Methods§

source

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

source

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

source

fn threshold<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: <TYPES as NodeType>::Epoch, ) -> u64

Returns the amount of stake needed to create this certificate

source

fn stake_table<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: TYPES::Epoch, ) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>

Get Stake Table from Membership implementation.

source

fn total_nodes<MEMBERSHIP: Membership<TYPES>>( membership: &MEMBERSHIP, epoch: TYPES::Epoch, ) -> usize

Get Total Nodes from Membership implementation.

source

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.

source

fn data(&self) -> &Self::Voteable

Get the commitment which was voted on

source

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.

Implementors§

source§

impl<TYPES: NodeType, THRESHOLD: Threshold<TYPES>> Certificate<TYPES, DaData> for SimpleCertificate<TYPES, DaData, THRESHOLD>

source§

impl<TYPES: NodeType, VOTEABLE: Voteable + 'static + QuorumMarker, THRESHOLD: Threshold<TYPES>> Certificate<TYPES, VOTEABLE> for SimpleCertificate<TYPES, VOTEABLE, THRESHOLD>

source§

type Voteable = VOTEABLE

source§

type Threshold = THRESHOLD