-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
||
title: "`try-runtime`: Add `StateDiffGuard` to record state difference and guard against unexpected storage changes" | ||
|
||
doc: | ||
- audience: Runtime Dev | ||
description: | | ||
This PR adds a `StateDiffGuard` to the `try-runtime` crate. The `StateDiffGuard` is a helper struct | ||
that records the state difference between its initialization and drop. It can be used to guard | ||
against unexpected storage changes and also for recording the state difference for testing, | ||
debugging, and other purposes. | ||
|
||
Example: | ||
```rust | ||
let _guard = StateDiffGuardBuilder::default() | ||
.must_change(StoragePrefix{ | ||
pallet_name: b"Balances", | ||
storage_name: b"TotalIssuance", | ||
}) | ||
.build(); | ||
|
||
// do something that may change the storage | ||
|
||
// the guard will panic if the storage is changed unexpectedly at the end of the scope | ||
``` | ||
|
||
crates: | ||
- name: frame-support | ||
bump: minor |