A cli tool to easily fork live networks (e.g kusama/polkadot).
Currently this tool is focused in the AH migration project and isn't ready to use as general purpouse tool without customization.
zombie-bite
is a simple cli tool that allow you to spawn a new network based on a live one (e.g kusama/polkadot). Under the hood we orchestrate the sync
prior to bite and spawn a new network with the live state.
Currently there are two different bite methods doppelganger
(based on paritytech/polkadot-sdk#4230) and fork-off
that is inspired in the different fork-off scripts (https://hack-ink.github.io/subalfred/user/cli/state.html / https://github.com/maxsam4/fork-off-substrate).
In order to use this tool you will need this binaries available in your PATH
- polkadot
- polkadot-parachain (in order to spawn system parachains)
- Doppelganger binaries (doppelganger, doppelganger-parachain, workers)
Make polkadot binaries (polkadot, polkadot-parachain) and (doppelganger, doppelganger-parachain, workers) available in your PATH, then you need to go back to this repo and run this command to spawn polkadot and asset-hub from the live chains:
RUST_LOG=zombienet=debug cargo run -- polkadot asset-hub
This will:
- Run doppelganger-parachain to sync (warp) asset-hub to a temp dir with the defaults overrides (2 nodes network)
- Run doppelganger to sync (warp) polkadot to a temp dir with the defaults overrides (2 nodes network)
- Generate the chain-spec without bootnodes
- Create a new snapshot to use with the new network in zombienet
- Spawn the new network and keep it running (note: you need to wait a couple of minutes to bootstrap)
If you need to override the runtime of the releaychain or any parachain to be spawned, you need to use the cli syntax chain:path_to_wasm and zombie-bite will read the wasm from the path and update the state of the chain to use the new one in the spawned network.
e.g:
cargo run -- polkadot:./runtime_wasm/polkadot_runtime.compact.compressed.wasm asset-hub:./runtime_wasm/asset_hub_polkadot_runtime.compact.compressed.wasm
By default the relaychain nodes are spawned with this log levesl:
babe=trace,grandpa=trace,runtime=debug,consensus::common=trace,parachain=debug,sync=debug
but you can override those by setting the RUST_LOG
env, since the script will inject that env into the spawning logic.
And the parachain collators with this log levels:
aura=debug,runtime=debug,cumulus-consensus=trace,consensus::common=trace,parachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug,xcm=trace
but you can override those by setting the RUST_LOG_COL
env, since the script will inject that env into the spawning logic.
Zombie-bite create a json file including two maps (overrides
and injects
), these two are simple key/values json that zombie-bite pass to the doppelganger nodes to override/inject those keys in the block import process. Those nodes override
the key IFF the key exist in the state being imported and inject
the ones sets at the end of the import process, so will be present in the resulting state even if there wasen't there originally.
You can check the keys we override/inject by default (for both relaychain / parachain) and at the moment if you want to include other key (or customize one) yo need to modify this file and rebuild the tool. Note: a process to dynamically set the overrides/injects map is planned.
⚠️ ⚠️ This methods isn't fully workable yet⚠️ ⚠️
You can easily for kusama
/ polkadot
running the following command:
cargo run -- kusama fork-off
- NOTE: pass
polkadot
as argument to fork it.
This will first sync a temporarly node (using warp
strategy) and then export all the state and create a new chain-spec to spawn a new network. By default this network will contains four validators (Alice, Bob, Charlie and Dave).
NOTE on Governance
: Since we are dumping all the state to a new chain-spec, the governance
tab can/will display show a big offset since we are starting from block 0
.
You can include system parachains
by passing them as argument in the command:
cargo run -- kusama asset-hub fork-off