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§

source

type Runtime: Runtime

Runtime that the context is being invoked in.

Required Methods§

source

fn clone(&self) -> Self

Clone this context.

source

fn get_logger(&self, module: &'static str) -> Logger

Returns a logger.

source

fn host_info(&self) -> &HostInfo

Information about the host environment.

source

fn key_manager(&self) -> Option<&dyn KeyManager>

The key manager, if the runtime is confidential.

source

fn runtime_header(&self) -> &Header

Last runtime block header.

source

fn runtime_round_results(&self) -> &RoundResults

Results of executing the last successful runtime round.

source

fn consensus_state(&self) -> &ConsensusState

Consensus state.

source

fn history(&self) -> &dyn HistoryHost

Historical state.

source

fn epoch(&self) -> EpochTime

Current epoch.

source

fn max_messages(&self) -> u32

Maximum number of consensus messages that the runtime can emit in this block.

Provided Methods§

source

fn should_execute_contracts(&self) -> bool

Whether smart contracts should be executed in this context.

source

fn is_allowed_query<R: Runtime>(&self, method: &str) -> bool

Whether method is an allowed query per policy in the local config.

source

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.

source

fn runtime_id(&self) -> &Namespace

Runtime ID.

source

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.

Implementors§

source§

impl<'a, R: Runtime> Context for RuntimeBatchContext<'a, R>

§

type Runtime = R