Skip to main content

ExecutionRuntimeContext

Trait ExecutionRuntimeContext 

Source
pub trait ExecutionRuntimeContext {
Show 14 methods // Required methods fn chain_id(&self) -> ChainId; fn thread_pool(&self) -> &Arc<ThreadPool>; fn execution_runtime_config(&self) -> ExecutionRuntimeConfig; fn user_contracts(&self) -> &Arc<HashMap<ApplicationId, UserContractCode>>; fn user_services(&self) -> &Arc<HashMap<ApplicationId, UserServiceCode>>; fn get_user_contract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_user_service<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Blob>>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Vec<u8>>>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_network_description<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NetworkDescription>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_or_load_committee<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Committee>>, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn contains_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn contains_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn get_committees<'life0, 'async_trait>( &'life0 self, epoch_range: RangeInclusive<Epoch>, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Epoch, Committee>, ExecutionError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Requirements for the extra field in our state views (and notably the ExecutionStateView).

Required Methods§

Source

fn chain_id(&self) -> ChainId

Source

fn thread_pool(&self) -> &Arc<ThreadPool>

Source

fn execution_runtime_config(&self) -> ExecutionRuntimeConfig

Source

fn user_contracts(&self) -> &Arc<HashMap<ApplicationId, UserContractCode>>

Source

fn user_services(&self) -> &Arc<HashMap<ApplicationId, UserServiceCode>>

Source

fn get_user_contract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserContractCode, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_user_service<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, description: &'life1 ApplicationDescription, txn_tracker: &'life2 TransactionTracker, ) -> Pin<Box<dyn Future<Output = Result<UserServiceCode, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Blob>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Vec<u8>>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_network_description<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NetworkDescription>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_or_load_committee<'life0, 'async_trait>( &'life0 self, epoch: Epoch, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<Committee>>, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the committee for epoch, consulting the shared cache first. On a miss, loads the NewCommittee event and the committee blob from storage and memoizes the result. Returns Ok(None) if the network description, the event, or the blob is not available locally.

Determinism during block execution: call sites inside the runtime must only ask for epochs up to and including the chain’s current epoch (self.epoch.get()). The chain-state invariant guarantees that every such committee is knowable (either in the shared cache, in storage, or — for the chain’s current epoch during a block that just created it — in the pending update on the chain’s own committees view). Queries for strictly greater epochs read from a mutable process-wide cache and are not deterministic.

Source

fn contains_blob<'life0, 'async_trait>( &'life0 self, blob_id: BlobId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn contains_event<'life0, 'async_trait>( &'life0 self, event_id: EventId, ) -> Pin<Box<dyn Future<Output = Result<bool, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn get_committees<'life0, 'async_trait>( &'life0 self, epoch_range: RangeInclusive<Epoch>, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Epoch, Committee>, ExecutionError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns the committees for the epochs in the given range. Delegates per-epoch look-ups to Self::get_or_load_committee so the process-global cache is hit, and surfaces any missing epochs as a single ExecutionError::EventsNotFound.

Implementors§