Skip to content

Commit

Permalink
Add prdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dastansam committed Apr 18, 2024
1 parent 39863fa commit c7fad3f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions prdoc/pr_4204.prdoc
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

0 comments on commit c7fad3f

Please sign in to comment.