pub enum Command {
    OnRuntimeUpgrade(OnRuntimeUpgradeCmd),
    ExecuteBlock(ExecuteBlockCmd),
    OffchainWorker(OffchainWorkerCmd),
    FollowChain(FollowChainCmd),
}
Expand description

Possible commands of try-runtime.

Variants§

§

OnRuntimeUpgrade(OnRuntimeUpgradeCmd)

Execute the migrations of the “local runtime”.

This uses a custom runtime api call, namely “TryRuntime_on_runtime_upgrade”.

This always overwrites the wasm code with the local runtime (specified by --chain), to ensure the new migrations are being executed. Re-executing already existing migrations is evidently not very exciting.

§

ExecuteBlock(ExecuteBlockCmd)

Executes the given block against some state.

Unlike Command::OnRuntimeUpgrade, this command needs two inputs: the state, and the block data. Since the state could be cached (see State::Snap), different flags are provided for both. --block-at and --block-uri, if provided, are only used for fetching the block. For convenience, these flags can be both emitted, if the State::Live is being used.

Note that by default, this command does not overwrite the code, so in wasm execution, the live chain’s code is used. This can be disabled if desired, see ExecuteBlockCmd::overwrite_wasm_code.

Note that if you do overwrite the wasm code, or generally use the local runtime for this, you might

  • not be able to decode the block, if the block format has changed.
  • quite possibly will get a signature verification failure, since the spec and transaction version are part of the signature’s payload, and if they differ between your local runtime and the remote counterparts, the signatures cannot be verified.
  • almost certainly will get a state root mismatch, since, well, you are executing a different state transition function.

To make testing slightly more dynamic, you can disable the state root check by enabling ExecuteBlockCmd::no_check. If you get signature verification errors, you should manually tweak your local runtime’s spec version to fix this.

A subtle detail of execute block is that if you want to execute block 100 of a live chain again, you need to scrape the state of block 99. This is already done automatically if you use State::Live, and the parent hash of the target block is used to scrape the state. If State::Snap is being used, then this needs to be manually taken into consideration.

This does not execute the same runtime api as normal block import do, namely Core_execute_block. Instead, it uses TryRuntime_execute_block, which can optionally skip state-root check (useful for trying a unreleased runtime), and can execute runtime sanity checks as well.

§

OffchainWorker(OffchainWorkerCmd)

Executes the offchain worker hooks of a given block against some state.

Similar to Command::ExecuteBlock, this command needs two inputs: the state, and the header data. Likewise, --header-at and --header-uri can be filled, or omitted if State::Live is used.

Similar to Command::ExecuteBlock, this command does not overwrite the code, so in wasm execution, the live chain’s code is used. This can be disabled if desired, see OffchainWorkerCmd::overwrite_wasm_code.

This executes the same runtime api as normal block import, namely OffchainWorkerApi_offchain_worker.

§

FollowChain(FollowChainCmd)

Follow the given chain’s finalized blocks and apply all of its extrinsics.

This is essentially repeated calls to Command::ExecuteBlock, whilst the local runtime is always at use, the state root check is disabled, and the state is persisted between executions.

This allows the behavior of a new runtime to be inspected over a long period of time, with realistic transactions coming as input.

NOTE: this does NOT execute the offchain worker hooks of mirrored blocks. This might be added in the future.

This does not support snapshot states, and can only work with a remote chain. Upon first connections, starts listening for finalized block events. Upon first block notification, it initializes the state from the remote node, and starts applying that block, plus all the blocks that follow, to the same growing state.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Assign values from ArgMatches to self.
Assign values from ArgMatches to self.
Append to Command so it can instantiate Self. Read more
Append to Command so it can update self. Read more
Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert from a value of T into an equivalent instance of Option<Self>. Read more
Consume self to return Some equivalent value of Option<T>. Read more
Converts self into T using Into<T>. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Cast reference.
Cast reference.
Cast mutable reference.
Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Convert from a value of T into an equivalent instance of Self. Read more
Consume self to return an equivalent value of T. Read more
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The counterpart to unchecked_from.
Consume self to return an equivalent value of T.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more