Skip to content

Conversation

jimjbrettj
Copy link

@jimjbrettj jimjbrettj commented Oct 20, 2025

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:

  • CLI arguments for forking related flags, specifically fork_url and fork_block_has
  • Use ParachainHostFunctions instead of SubstrateHostFunctions to be assethub compatible
  • Logic to retrieve the state from the specified block hash and create a genesis chain spec with the retrieved state as the new genesis state. NOTE: This will be replaced with a lazy loading solution and is currently only here for testing purposes.
  • WIP Configure ManualSealParams to enable proper block production post-fork. Specifically, we are altering the fields consensus_data_provider and create_inherent_data_providers

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Run the proof of concept

Current PoC debug setup is supposed to be run with a westend AssetHub using zombinets:

  1. Install zombinets:
    https://github.com/paritytech/zombienet

  2. install polkadot-parachain executable zombienet setup polkadot polkadot-parachain. (u can leave them localy or move to PATH)

  3. 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

  4. Replace executable cmd for polkadot and polkadot-parachain in asset-hub_westend_zombient.toml file to much yuur PATH

  5. Run zombienet zombienet spawn --provider native asset-hub_westend_zombient.toml

  6. 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 information https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:54439#/explorer

  7. Run forking cargo run -p anvil-polkadot -- --fork-url http://127.0.0.1:54439 --blockTime 6

@jimjbrettj jimjbrettj changed the title wip/postForkBlockProduction Draft: Forking MVP Oct 20, 2025
@jimjbrettj jimjbrettj changed the title Draft: Forking MVP Draft: Forking Support Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant