pub trait Runtime {
    type Core: API;
    type Accounts: API;
    type Modules: TransactionHandler + MigrationHandler + MethodHandler + BlockHandler + InvariantHandler + ModuleInfoHandler;
    type FeeProxy: FeeProxyHandler = ();

    const VERSION: Version;
    const STATE_VERSION: u32 = 0u32;
    const PREFETCH_LIMIT: u16 = 0u16;
    const SCHEDULE_CONTROL: ScheduleControl = _;

    // Required method
    fn genesis_state() -> <Self::Modules as MigrationHandler>::Genesis;

    // Provided methods
    fn trusted_signers() -> Option<TrustedSigners> { ... }
    fn consensus_trust_root() -> Option<TrustRoot> { ... }
    fn migrate_state<C: Context>(_ctx: &C) { ... }
    fn is_allowed_query(_method: &str) -> bool { ... }
    fn is_allowed_private_km_query(_method: &str) -> bool { ... }
    fn is_allowed_interactive_call(_method: &str) -> bool { ... }
    fn migrate<C: Context>(ctx: &C) { ... }
    fn start()
       where Self: Sized + Send + Sync + 'static { ... }
}
Expand description

A runtime.

Required Associated Types§

source

type Core: API

Module that provides the core API.

source

type Accounts: API

Module that provides the accounts API.

source

type Modules: TransactionHandler + MigrationHandler + MethodHandler + BlockHandler + InvariantHandler + ModuleInfoHandler

Supported modules.

Provided Associated Types§

source

type FeeProxy: FeeProxyHandler = ()

Handler for proxy fee payments.

Required Associated Constants§

source

const VERSION: Version

Runtime version.

Provided Associated Constants§

source

const STATE_VERSION: u32 = 0u32

State version.

source

const PREFETCH_LIMIT: u16 = 0u16

Prefetch limit. To enable prefetch set it to a non-zero value.

source

const SCHEDULE_CONTROL: ScheduleControl = _

Runtime schedule control configuration.

Required Methods§

source

fn genesis_state() -> <Self::Modules as MigrationHandler>::Genesis

Genesis state for the runtime.

Provided Methods§

source

fn trusted_signers() -> Option<TrustedSigners>

Return the trusted signers for this runtime; if None, a key manager connection will not be established on startup.

source

fn consensus_trust_root() -> Option<TrustRoot>

Return the consensus layer trust root for this runtime; if None, consensus layer integrity verification will not be performed.

source

fn migrate_state<C: Context>(_ctx: &C)

Perform runtime-specific state migration. This method is only called when the recorded state version does not match STATE_VERSION.

source

fn is_allowed_query(_method: &str) -> bool

Whether a given query method is allowed to be invoked.

source

fn is_allowed_private_km_query(_method: &str) -> bool

Whether a given query method is allowed to access private key manager state.

Note that even if this returns true for a method, the method also needs to be tagged as being allowed to access private key manager state (e.g. with allow_private_km).

source

fn is_allowed_interactive_call(_method: &str) -> bool

Whether a given call is allowed to be invoked interactively.

Note that even if this returns true for a method, the method also needs to be tagged as being allowed to be executed interactively (e.g. with allow_interactive)

source

fn migrate<C: Context>(ctx: &C)

Perform state migrations if required.

source

fn start()
where Self: Sized + Send + Sync + 'static,

Start the runtime.

Object Safety§

This trait is not object safe.

Implementors§