# How to run try-runtime's on-runtime-upgrade
Clone the repo:
```
git clone https://github.com/paritytech/substrate
cd substrate
```
Run your existing node without the runtime changes:
```
cargo b -r
cp target/release/node-template .
./node-template --dev
```
Make some changes to your runtime. These are the changes that you want to test using try-runtime i.e. storage migration. Don't forget to bump your runtime's spec version!
Write your tests inside try-runtime's pre-uprade and post-upgrade hooks which allows to test before the runtime upgrade and after the runtime upgrade.
[Here](https://github.com/paritytech/substrate/blob/5a49d2b7adf939e70a22dc690fae7cacf7da02c0/frame/bags-list/src/migrations.rs) is an example of a migration with on-runtime-upgrade hooks.
Compile your node with try-runtime enabled.
```
cargo b -r --features=try-runtime
cp target/release/node-template node-template-try-runtime
```
Copy the runtime's Wasm that has your changes.
```
cp target/release/wbuild/node-template-runtime/node_template_runtime.wasm runtime-try-runtime.wasm
```
Run on-runtime-upgrade!
```
./node-template-try-runtime try-runtime \
--runtime runtime-try-runtime.wasm \
-lruntime=debug on-runtime-upgrade \
--checks=pre-and-post \
live --uri ws://localhost:9944
```
You will get similar output to this:
```
./node-template-try-runtime try-runtime --runtime runtime-try-runtime.wasm -lruntime=debug on-runtime-upgrade --checks=pre-and-post live --uri ws://localhost:9944
2023-04-20 11:10:10.662 INFO main remote-ext: since no at is provided, setting it to latest finalized head, 0x1055c7bb79d0147ea363d1f22d3093d47cf6ec7f3fe743a0710cd4e446407e5f
2023-04-20 11:10:10.663 INFO main remote-ext: since no prefix is filtered, the data for all pallets will be downloaded
2023-04-20 11:10:10.666 INFO main remote-ext: scraping key-pairs from remote at block height 0x1055c7bb79d0147ea363d1f22d3093d47cf6ec7f3fe743a0710cd4e446407e5f
2023-04-20 11:10:10.667 INFO main remote-ext: Querying a total of 132 keys from prefix , splitting among 10 threads, 14 keys per thread
2023-04-20 11:10:10.678 INFO main remote-ext: adding data for hashed prefix: , took 0s
2023-04-20 11:10:10.678 INFO main remote-ext: adding data for hashed key: 3a636f6465
2023-04-20 11:10:10.680 INFO main remote-ext: adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8
2023-04-20 11:10:10.680 INFO main remote-ext: adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac
2023-04-20 11:10:10.681 INFO main remote-ext: initialized state externalities with storage root 0xc8bf2d74af14ed069c401abd0fe938a15af6347a74b3c4a50fde9e2452a9f96a and state_version V1
2023-04-20 11:10:10.692 INFO main try-runtime::cli: original spec: RuntimeString::Owned("node-template")-100, code hash: a29c4800ac2146af40a98fa59acda50100ff6fe02da985fb44e49c18e4a84771
2023-04-20 11:10:10.700 INFO main try-runtime::cli: new spec: RuntimeString::Owned("node-template")-101, code hash: 9864439067de88833ed2180b81ee2132f710344cd191e2fe473d061a1dc308d8
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for System
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for Timestamp
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for Aura
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for Grandpa
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for Balances
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for TransactionPayment
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for Sudo
2023-04-20 11:10:10.814 DEBUG main runtime::frame-support: ✅ no migration for TemplateModule
2023-04-20 11:10:10.814 ERROR main try-runtime::cli: failed to generate compact proof TryRuntime_on_runtime_upgrade: TrieError(InvalidStateRoot(0xd9eba47c0c517c6ccc4394306b0c42d7c80c437e59467d0615ec2fd7c94b338e))
2023-04-20 11:10:10.815 INFO main try-runtime::cli: TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (0 ps, 0 byte), total weight = (2000000000000 ps, 18446744073709551615 byte) (0.00 %, 0.00 %).
```