feat(pallet-tfgrid): check storage state #817
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The goal of this PR is to provide a mechanism to be able to check if storage is consistent in
pallet-tfgrid
.1. try-runtime
For this, we use the try-runtime tool that allows to run tests on storage from simulated environment.
Here is how such tool can be executed against devnet:
2. CheckStorageState
Ideally it should be part of some CI flow (TBD) to validate a given storage version.
For each storage version, we should implement a
CheckStorageState
struct with the associated checks.This implementation should be included in the migration module that corresponds to the storage version at the end of the migration.
Example for
V17Struct
version ofpallet-tfgrid
, implementation is included inv17
module:It also should be added in runtime the migration type to be triggered by the
try-runtime
command above.Make sure you take into account the ordering of the migration stack according to the simulated environment and its current storage version (i.e if current version is
V16Struct
, you should have migration fromV16Struct
toV17Struct
just beforeCheckStorageState
ofV17Struct
).3. check_pallet_tfgrid()
The code related to a specific storage version should be included in the following function:
To avoid code redundancy we will try as much as possible to take advantage of check functions from previous storage versions.
Related Issues:
Checklist: