test
Test runtime upgrades
Last updated
Was this helpful?
Test runtime upgrades
Last updated
Was this helpful?
The Pop CLI feature is built on top of the , a programmatic testing framework designed for Substrate. It allows you to test runtime upgrades and state transitions.
on-runtime-upgrade
: Tests migrations.
execute-block
: Executes a specified block against some state.
fast-forward
: Executes a runtime upgrade (optional), then mines a number of blocks while performing try-state checks.
create-snapshot
: Creates a chain state snapshot.
To test , you can use the on-runtime-upgrade
subcommand. This command allows you to test migrations by executing the hooks of a runtime against the state of a live blockchain or a snapshot.
Note: If you choose to run migrations on a local runtime binary, you will be prompted to provide a valid runtime binary path. .
Pop CLI will automatically locate the runtime binary based on the provided
--profile
. If the binary is not found, Pop CLI will build it automatically.
If a runtime is not specified, the migration will be executed on the code currently running on the remote node of a live blockchain or the one stored in the provided snapshot file.
To run migrations against a live blockchain, use the on-runtime-upgrade live
subcommand:
You'll be prompted to provide an RPC URI of a live blockchain. A valid RPC URI must start with ws://
or wss://
. You can also specify an optional block hash to define the state execution point.
To manually provide the URI and block hash, use:
To run migrations against a snapshot, use the on-runtime-upgrade snap
subcommand:
This command saves a copy of the blockchain's current state to a file (a snapshot). You can use this snapshot to run tests quickly instead of downloading the state from a live blockchain each time.
You'll be prompted to enter the RPC URI (the network address of the live blockchain) and the file path where the snapshot should be stored.
To provide these parameters manually:
This command executes a given number of blocks. Currently, execute-block
only supports executing blocks against a live state. You can also specify a block hash to execute from.
You'll be prompted to select state tests to execute, with the following options:
None: No state tests will be executed.
All: Executes all available state tests.
Round Robin: Runs a fixed number of state tests in a round-robin manner.
Only Pallets: Executes only state tests related to specific pallets.
Available pallets on the live network will be listed for selection:
To skip the interactive interface and provide arguments manually:
For round-robin state tests, use:
Executes a runtime upgrade (optional), then mines a number of blocks while performing try-state checks.
You'll be prompted to specify the number of blocks to mine and whether to run pending migrations before fast-forwarding.
Like on-runtime-upgrade
, fast-forward
supports live
and snap
subcommands to define the source of the runtime state.
To skip the interactive interface and specify arguments manually:
Pop CLI will automatically locate the runtime binary based on the provided
--profile
. If the binary is not found, it will be built automatically.
Note: A live blockchain node must be .
Note: If you run migrations on a local runtime binary, you will be prompted to provide a valid runtime binary path. .
Learn more about and .