pub trait Context {
type Runtime: Runtime;
Show 16 methods
// Required methods
fn clone(&self) -> Self;
fn get_logger(&self, module: &'static str) -> Logger;
fn host_info(&self) -> &HostInfo;
fn key_manager(&self) -> Option<&dyn KeyManager>;
fn runtime_header(&self) -> &Header;
fn runtime_round_results(&self) -> &RoundResults;
fn consensus_state(&self) -> &ConsensusState;
fn history(&self) -> &dyn HistoryHost;
fn epoch(&self) -> EpochTime;
fn max_messages(&self) -> u32;
// Provided methods
fn should_execute_contracts(&self) -> bool { ... }
fn is_allowed_query<R: Runtime>(&self, method: &str) -> bool { ... }
fn local_config<T>(&self, key: &str) -> Option<T>
where T: Decode { ... }
fn runtime_id(&self) -> &Namespace { ... }
fn is_confidential(&self) -> bool { ... }
fn now(&self) -> u64 { ... }
}
Expand description
Runtime SDK context.
Required Associated Types§
Required Methods§
Sourcefn get_logger(&self, module: &'static str) -> Logger
fn get_logger(&self, module: &'static str) -> Logger
Returns a logger.
Sourcefn key_manager(&self) -> Option<&dyn KeyManager>
fn key_manager(&self) -> Option<&dyn KeyManager>
The key manager, if the runtime is confidential.
Sourcefn runtime_header(&self) -> &Header
fn runtime_header(&self) -> &Header
Last runtime block header.
Sourcefn runtime_round_results(&self) -> &RoundResults
fn runtime_round_results(&self) -> &RoundResults
Results of executing the last successful runtime round.
Sourcefn consensus_state(&self) -> &ConsensusState
fn consensus_state(&self) -> &ConsensusState
Consensus state.
Sourcefn history(&self) -> &dyn HistoryHost
fn history(&self) -> &dyn HistoryHost
Historical state.
Sourcefn max_messages(&self) -> u32
fn max_messages(&self) -> u32
Maximum number of consensus messages that the runtime can emit in this block.
Provided Methods§
Sourcefn should_execute_contracts(&self) -> bool
fn should_execute_contracts(&self) -> bool
Whether smart contracts should be executed in this context.
Sourcefn is_allowed_query<R: Runtime>(&self, method: &str) -> bool
fn is_allowed_query<R: Runtime>(&self, method: &str) -> bool
Whether method
is an allowed query per policy in the local config.
Sourcefn local_config<T>(&self, key: &str) -> Option<T>where
T: Decode,
fn local_config<T>(&self, key: &str) -> Option<T>where
T: Decode,
Returns node operator-provided local configuration.
This method will always return None
in Mode::ExecuteTx
contexts.
Sourcefn runtime_id(&self) -> &Namespace
fn runtime_id(&self) -> &Namespace
Runtime ID.
Sourcefn is_confidential(&self) -> bool
fn is_confidential(&self) -> bool
Whether the context has a key manager available (e.g. the runtime is confidential).
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.