-
Notifications
You must be signed in to change notification settings - Fork 49
Substrate Chain State Generate Tools
HackFisher edited this page Jun 21, 2021
·
2 revisions
Within Substrate framework, there are several builtin chain state generate tools, and also there are some other tools to fork off and customize the chain state.
- Build Spec cli command, build the genesis state using runtime
GenesisConfig
build-spec --raw
and build-spec --dev --raw
- Export existing chain state using
export-state
command.
- Build Parachain Genesis Header and Validation Code, Here the state root in Genesis Header might require the genesis state(storages), and if we want to do parachain hot-connect solution, we will probably need to export chain state from the solo chain, fork off by replacing some storage keys, and use the spec generated. Refer a. Cumulus b. Parachain Spec Raw Res c. Command for parachain build spec, genesis header and validation code
target/release/crab-redirect-collator build-spec --disable-default-bootnode --raw --chain crab-redirect-genesis > res/crab-redirect.json
target/release/crab-redirect-collator export-genesis-wasm -r > res/crab-redirect.wasm
target/release/crab-redirect-collator export-genesis-state > res/crab-redirect.hex
-
Use the fork-off-substrate tool (https://github.com/maxsam4/fork-off-substrate) to create a new chain spec from your state and use that. Refer: a. HardSpoon Discussions b. Currently the chunk fetch have a bug and does not seem to improve node side performance(current implementation still iterate over all storage keys?), only network bandwith for each rpc call can be split into chunks if enable it.
-
Test runtime upgrade using
try-runtime
https://github.com/paritytech/substrate/tree/master/utils/frame/try-runtime