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.
Motivation
Add the ability to run on a forked state in anvil, specifically assethub forks to allow for local testing from a particular state using anvil.
NOTE: This does not encapsulate the full forking MVP, as our full solution will utilize lazy loading. This is being worked on in parallel here
Solution
This PR introduces support for forking in alvil, specifically targeting forks of assethub.
This includes the following features:
fork_url
andfork_block_has
ParachainHostFunctions
instead ofSubstrateHostFunctions
to be assethub compatibleManualSealParams
to enable proper block production post-fork. Specifically, we are altering the fieldsconsensus_data_provider
andcreate_inherent_data_providers
PR Checklist
Run the proof of concept
Current PoC debug setup is supposed to be run with a westend AssetHub using zombinets:
Install zombinets:
https://github.com/paritytech/zombienet
install polkadot-parachain executable
zombienet setup polkadot polkadot-parachain
. (u can leave them localy or move to PATH)Download config:
curl https://raw.githubusercontent.com/paritytech/polkadot-sdk/refs/heads/master/cumulus/zombienet/examples/asset_hub_westend_local_network.toml > asset-hub_westend_zombient.toml
Replace executable cmd for
polkadot
andpolkadot-parachain
inasset-hub_westend_zombient.toml
file to much yuur PATHRun zombienet
zombienet spawn --provider native asset-hub_westend_zombient.toml
Find Asset hub RPC Url in starting logs (useually takes around 5 mints to start) It will be uner the sign
│ Westend Asset Hub Local ⚙ Added Boot Nodes
just take the first one, in my case it was dave-1 and link is provided in the very end of logs in Nodes informationhttps://polkadot.js.org/apps/?rpc=ws://127.0.0.1:54439#/explorer
Run forking
cargo run -p anvil-polkadot -- --fork-url http://127.0.0.1:54439 --blockTime 6