Trait mithril_aggregator::services::CertifierService

source ·
pub trait CertifierService: Sync + Send {
    // Required methods
    fn inform_epoch<'life0, 'async_trait>(
        &'life0 self,
        epoch: Epoch,
    ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn register_single_signature<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        signed_entity_type: &'life1 SignedEntityType,
        signature: &'life2 SingleSignatures,
    ) -> Pin<Box<dyn Future<Output = StdResult<SignatureRegistrationStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn create_open_message<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        signed_entity_type: &'life1 SignedEntityType,
        protocol_message: &'life2 ProtocolMessage,
    ) -> Pin<Box<dyn Future<Output = StdResult<OpenMessage>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_open_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        signed_entity_type: &'life1 SignedEntityType,
    ) -> Pin<Box<dyn Future<Output = StdResult<Option<OpenMessage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn mark_open_message_if_expired<'life0, 'life1, 'async_trait>(
        &'life0 self,
        signed_entity_type: &'life1 SignedEntityType,
    ) -> Pin<Box<dyn Future<Output = StdResult<Option<OpenMessage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_certificate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        signed_entity_type: &'life1 SignedEntityType,
    ) -> Pin<Box<dyn Future<Output = StdResult<Option<Certificate>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_certificate_by_hash<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hash: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = StdResult<Option<Certificate>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_latest_certificates<'life0, 'async_trait>(
        &'life0 self,
        last_n: usize,
    ) -> Pin<Box<dyn Future<Output = StdResult<Vec<Certificate>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify_certificate_chain<'life0, 'async_trait>(
        &'life0 self,
        epoch: Epoch,
    ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

§CertifierService

This service manages the open message and their beacon transitions. It can ultimately transform open messages into certificates.

Required Methods§

source

fn inform_epoch<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inform the certifier I have detected a new epoch, it may clear its state and prepare the new signature round. If the given Epoch is equal or less than the previous informed Epoch, nothing is done.

source

fn register_single_signature<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, signature: &'life2 SingleSignatures, ) -> Pin<Box<dyn Future<Output = StdResult<SignatureRegistrationStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add a new single signature for the open message at the given beacon. If the open message does not exist or the open message has been certified since then, an error is returned.

source

fn create_open_message<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, protocol_message: &'life2 ProtocolMessage, ) -> Pin<Box<dyn Future<Output = StdResult<OpenMessage>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create an open message at the given beacon. If the open message does not exist or exists at an older beacon, the older open messages are cleared along with their associated single signatures and the new open message is created. If the message already exists, an error is returned.

source

fn get_open_message<'life0, 'life1, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<Option<OpenMessage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the open message at the given Beacon. If the message does not exist, None is returned.

source

fn mark_open_message_if_expired<'life0, 'life1, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<Option<OpenMessage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark the open message if it has expired.

source

fn create_certificate<'life0, 'life1, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<Option<Certificate>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a certificate if possible. If the pointed open message does not exist or has been already certified, an error is raised. If a multi signature is created then the flag is_certified of the open message is set to true. The Certificate is created. If the stake quorum of the single signatures is not reached for the multisignature to be created, the certificate is not created and None is returned. If the certificate can be created, the list of the registered signers for the given epoch is used.

source

fn get_certificate_by_hash<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 str, ) -> Pin<Box<dyn Future<Output = StdResult<Option<Certificate>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a certificate from its hash.

source

fn get_latest_certificates<'life0, 'async_trait>( &'life0 self, last_n: usize, ) -> Pin<Box<dyn Future<Output = StdResult<Vec<Certificate>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the list of the latest created certificates.

source

fn verify_certificate_chain<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify the certificate chain and epoch gap. This will return an error if there is at least an epoch between the given epoch and the most recent certificate.

Implementors§