Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Commit 725833d

Browse files
author
Jimmy Chu
authored
Fix 1111 (#1113)
1 parent 45118f4 commit 725833d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

docs/knowledgebase/integrate/try-runtime.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,35 @@ In order to query state, `try-runtime` makes use of Substrate's RPCs, namely [`S
4040

4141
The most common use case for `try-runtime` is with storage migrations and runtime upgrades.
4242

43-
> **Tip:** Combine `try-runtime` with `fork-off-substrate` to test your chain before production. Use `try-runtime` to test your
44-
> chain's migration and its pre and post states. Then, use [`fork-off-substrate`][fork-off-gh] if you want to check that block
45-
> production continues fine after the migration, and do some other arbitrary testing.
43+
> **Tip:** Combine `try-runtime` with [`fork-off-substrate`][fork-off-gh] to test your chain before
44+
> production. Use `try-runtime` to test your chain's migration and its pre and post states. Then,
45+
> use `fork-off-substrate` if you want to check that block production continues fine after the
46+
> migration, and do some other arbitrary testing.
4647
4748
### Calling into hooks from `OnRuntimeUpgrade`
49+
4850
By default, there are two ways of defining a runtime upgrade in the runtime. The `OnRuntimeUpgrade` trait provides the [different methods][onruntimeupgrade-method-rustdocs] to achieve this.
4951

5052
- **From inside a runtime**. For example:
5153
```rust
5254
struct Custom;
5355
impl OnRuntimeUpgrade for Custom {
54-
fn on_runtime_upgrade() -> Weight { }
56+
fn on_runtime_upgrade() -> Weight {
57+
// -- snip --
58+
}
5559
}
5660
```
5761

5862
- **From inside a pallet**. For example:
5963
```rust
6064
#[pallet::hooks]
61-
fn on_runtime_upgrade() -> Weight { }
65+
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
66+
fn on_runtime_upgrade() -> Weight {
67+
// -- snip --
68+
}
69+
}
6270
```
6371

64-
6572
These hooks will specify _what should happen upon a runtime upgrade_. For testing purposes, we prefer having hooks that allow us to inspect the state _before_ and _after_ a runtime upgrade as well.
6673

6774
These hooks are not available by default, and are only available under a specific feature flag, named `try-runtime`.

0 commit comments

Comments
 (0)