pub trait Certificate<TYPES: NodeType, T>: HasViewNumber {
type Voteable: Voteable<TYPES>;
type Threshold: Threshold<TYPES>;
// Required methods
fn create_signed_certificate(
vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable>>,
data: Self::Voteable,
sig: <TYPES::SignatureKey as SignatureKey>::QcType,
view: ViewNumber,
) -> Self;
fn is_valid_cert(
&self,
stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry],
threshold: U256,
upgrade_lock: &UpgradeLock<TYPES>,
) -> Result<()>;
fn signers(
&self,
stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry],
threshold: U256,
) -> Result<Vec<<TYPES::SignatureKey as SignatureKey>::VerificationKeyType>>;
fn threshold(membership: &EpochMembership<TYPES>) -> U256;
fn stake_table(membership: &EpochMembership<TYPES>) -> HSStakeTable<TYPES>;
fn total_nodes(membership: &EpochMembership<TYPES>) -> usize;
fn stake_table_entry(
membership: &EpochMembership<TYPES>,
pub_key: &TYPES::SignatureKey,
) -> Option<PeerConfig<TYPES>>;
fn data(&self) -> &Self::Voteable;
fn data_commitment(
&self,
upgrade_lock: &UpgradeLock<TYPES>,
) -> Result<Commitment<VersionedVoteData<TYPES, Self::Voteable>>>;
}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(
vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable>>,
data: Self::Voteable,
sig: <TYPES::SignatureKey as SignatureKey>::QcType,
view: ViewNumber,
) -> Self
fn create_signed_certificate( vote_commitment: Commitment<VersionedVoteData<TYPES, Self::Voteable>>, data: Self::Voteable, sig: <TYPES::SignatureKey as SignatureKey>::QcType, view: ViewNumber, ) -> Self
Build a certificate from the data commitment and the quorum of signers
Sourcefn is_valid_cert(
&self,
stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry],
threshold: U256,
upgrade_lock: &UpgradeLock<TYPES>,
) -> Result<()>
fn is_valid_cert( &self, stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry], threshold: U256, upgrade_lock: &UpgradeLock<TYPES>, ) -> Result<()>
Checks if the cert is valid in the given epoch
Sourcefn signers(
&self,
stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry],
threshold: U256,
) -> Result<Vec<<TYPES::SignatureKey as SignatureKey>::VerificationKeyType>>
fn signers( &self, stake_table: &[<TYPES::SignatureKey as SignatureKey>::StakeTableEntry], threshold: U256, ) -> Result<Vec<<TYPES::SignatureKey as SignatureKey>::VerificationKeyType>>
Get the list of signers given a certificate.
Sourcefn threshold(membership: &EpochMembership<TYPES>) -> U256
fn threshold(membership: &EpochMembership<TYPES>) -> U256
Returns the amount of stake needed to create this certificate
Sourcefn stake_table(membership: &EpochMembership<TYPES>) -> HSStakeTable<TYPES>
fn stake_table(membership: &EpochMembership<TYPES>) -> HSStakeTable<TYPES>
Get Stake Table from Membership implementation.
Sourcefn total_nodes(membership: &EpochMembership<TYPES>) -> usize
fn total_nodes(membership: &EpochMembership<TYPES>) -> usize
Get Total Nodes from Membership implementation.
Sourcefn stake_table_entry(
membership: &EpochMembership<TYPES>,
pub_key: &TYPES::SignatureKey,
) -> Option<PeerConfig<TYPES>>
fn stake_table_entry( membership: &EpochMembership<TYPES>, pub_key: &TYPES::SignatureKey, ) -> Option<PeerConfig<TYPES>>
Get StakeTableEntry from Membership implementation.
Sourcefn data_commitment(
&self,
upgrade_lock: &UpgradeLock<TYPES>,
) -> Result<Commitment<VersionedVoteData<TYPES, Self::Voteable>>>
fn data_commitment( &self, upgrade_lock: &UpgradeLock<TYPES>, ) -> Result<Commitment<VersionedVoteData<TYPES, Self::Voteable>>>
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.