Trait oasis_runtime_sdk::context::Context
source · pub trait Context {
type Runtime: Runtime;
Show 15 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 { ... }
}
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).
Object Safety§
This trait is not object safe.