mithril_aggregator

Trait AggregatorRunnerTrait

source
pub trait AggregatorRunnerTrait: Sync + Send {
Show 23 methods // Required methods fn get_time_point_from_chain<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StdResult<TimePoint>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_current_open_message_for_signed_entity_type<'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 get_current_non_certified_open_message<'life0, 'life1, 'async_trait>( &'life0 self, current_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<Option<OpenMessage>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_certificate_chain_valid<'life0, 'life1, 'async_trait>( &'life0 self, time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_stake_distribution<'life0, 'life1, 'async_trait>( &'life0 self, new_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn open_signer_registration_round<'life0, 'life1, 'async_trait>( &'life0 self, new_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn close_signer_registration_round<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update_epoch_settings<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn compute_protocol_message<'life0, 'life1, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<ProtocolMessage>> + 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_new_pending_certificate<'life0, 'life1, 'async_trait>( &'life0 self, time_point: TimePoint, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<CertificatePending>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn save_pending_certificate<'life0, 'async_trait>( &'life0 self, pending_certificate: CertificatePending, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn drop_pending_certificate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StdResult<Option<CertificatePending>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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 create_artifact<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signed_entity_type: &'life1 SignedEntityType, certificate: &'life2 Certificate, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn update_era_checker<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn inform_new_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 upkeep<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn precompute_epoch_data<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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 is_open_message_outdated<'life0, 'life1, 'async_trait>( &'life0 self, open_message_signed_entity_type: SignedEntityType, last_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn increment_runtime_cycle_success_since_startup_counter(&self); fn increment_runtime_cycle_total_since_startup_counter(&self);
}
Expand description

This trait is intended to allow mocking the AggregatorRunner in tests. It exposes all the methods needed by the state machine.

Required Methods§

source

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

Return the current TimePoint from the chain

source

fn get_current_open_message_for_signed_entity_type<'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,

Retrieves the current open message for a given signed entity type.

source

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

Retrieves the current non-certified open message.

source

fn is_certificate_chain_valid<'life0, 'life1, 'async_trait>( &'life0 self, time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a certificate chain is valid.

source

fn update_stake_distribution<'life0, 'life1, 'async_trait>( &'life0 self, new_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the stake distribution from the blockchain and store it.

source

fn open_signer_registration_round<'life0, 'life1, 'async_trait>( &'life0 self, new_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open the signer registration round of an epoch.

source

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

Close the signer registration round of an epoch.

source

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

Ask the EpochService to update the epoch settings.

source

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

Compute the protocol message

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 expired open message.

source

fn create_new_pending_certificate<'life0, 'life1, 'async_trait>( &'life0 self, time_point: TimePoint, signed_entity_type: &'life1 SignedEntityType, ) -> Pin<Box<dyn Future<Output = StdResult<CertificatePending>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new pending certificate.

source

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

Store the given pending certificate.

source

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

Drop the actual pending certificate in the store.

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,

Tell the certifier to try to create a new certificate.

source

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

Create an artifact and persist it.

source

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

Update the EraChecker with EraReader information.

source

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

Ask services to update themselves for the new epoch

source

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

Perform the upkeep tasks.

source

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

Precompute what doesn’t change for the actual epoch

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 new open message

source

fn is_open_message_outdated<'life0, 'life1, 'async_trait>( &'life0 self, open_message_signed_entity_type: SignedEntityType, last_time_point: &'life1 TimePoint, ) -> Pin<Box<dyn Future<Output = StdResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if the open message is considered outdated.

source

fn increment_runtime_cycle_success_since_startup_counter(&self)

Increment the runtime cycle success metric.

source

fn increment_runtime_cycle_total_since_startup_counter(&self)

Increment the runtime cycle total metric.

Implementors§