Include `try-runtime` in your project
Learn how to integrate try-runtime in your chain.
#
GoalInclude try-runtime
to use it in a Substrate node.
#
Use casesUse try-runtime
to test a storage migration.
#
OverviewThe try-runtime
tool is useful for running tests before launching a runtime to production. This is a simple guide
which steps through which dependencies to include and where to include them in order to use it inside a runtime.
warning
Be sure to use the latest monthly-*
tag when adding your dependencies.
#
Stepsruntime
dependencies#
1. Adding runtime/Cargo.toml
#
In Add the FRAME dependency:
runtime/Cargo.toml
, for every pallet in your runtime:#
In runtime/src/lib.rs
, implement it for your runtime:#
In node
dependencies#
2. Adding node/Cargo.toml
(always check for the latest version):#
In node/src/cli.rs
add the subcommands:#
In node/src/commands.rs
, add:#
In note
If you're using custom pallets in your workspace, make sure you included
try-runtime
in the dependencies inside the pallets/pallet_name/Cargo.toml
file of your workspace.
try-runtime
#
3. Using Just like writing unit tests, to use try-runtime
create an externalities instance and call execute_with
on it.
Refer to this guide to learn more on how to do this.