Trait Certificate

Source
pub trait Certificate<TYPES: NodeType, T>: HasViewNumber<TYPES> {
    type Voteable: Voteable<TYPES>;
    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: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry],
        threshold: U256,
        upgrade_lock: &UpgradeLock<TYPES, V>,
    ) -> impl Future<Output = Result<()>>;
    fn threshold(
        membership: &EpochMembership<TYPES>,
    ) -> impl Future<Output = U256> + Send;
    fn stake_table(
        membership: &EpochMembership<TYPES>,
    ) -> impl Future<Output = HSStakeTable<TYPES>> + Send;
    fn total_nodes(
        membership: &EpochMembership<TYPES>,
    ) -> impl Future<Output = usize> + Send;
    fn stake_table_entry(
        membership: &EpochMembership<TYPES>,
        pub_key: &TYPES::SignatureKey,
    ) -> impl Future<Output = Option<PeerConfig<TYPES>>> + Send;
    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<TYPES>

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: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry], threshold: U256, upgrade_lock: &UpgradeLock<TYPES, V>, ) -> impl Future<Output = Result<()>>

Checks if the cert is valid in the given epoch

Source

fn threshold( membership: &EpochMembership<TYPES>, ) -> impl Future<Output = U256> + Send

Returns the amount of stake needed to create this certificate

Source

fn stake_table( membership: &EpochMembership<TYPES>, ) -> impl Future<Output = HSStakeTable<TYPES>> + Send

Get Stake Table from Membership implementation.

Source

fn total_nodes( membership: &EpochMembership<TYPES>, ) -> impl Future<Output = usize> + Send

Get Total Nodes from Membership implementation.

Source

fn stake_table_entry( membership: &EpochMembership<TYPES>, pub_key: &TYPES::SignatureKey, ) -> impl Future<Output = Option<PeerConfig<TYPES>>> + Send

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

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§

Source§

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

Source§

type Voteable = DaData2<TYPES>

Source§

type Threshold = THRESHOLD

Source§

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

Source§

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

Source§

type Voteable = VOTEABLE

Source§

type Threshold = THRESHOLD