ChainSafe / ChainSafe/gossamer-parity
Polkadot-Anvil forking functionality
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Based on: https://github.com/paritytech/foundry-polkadot/issues/25
### User stories
- User can fork a network to the local env., providing `-f, --fork-url ` flag
- User also can initialise new network given genesis file using `--init ` flag
- By default user run fork without persistance of changes.
- User can use `--dump-state` flag to dump current state including his changes to provided file.
- User then later can start anvil from his localdump file using `--load-state ` flag
- User can use `-s, --state-interval ` flag to dump state to the disk every N secodns.
- User can fork network up to and including speicifc block height using `--fork-block-number ` flag
- User can fork network up to and including specific transaction using`--fork-transaction-hash ` flag
- As a user, when I produce a fork I need test accounts created so that I can test smart contracts with specific known keys.
___
### Other requirements based on Anvil-eth
- Forking took on a magnitude of less then a minute. State is loaded on demand using laxy-loading feature.
- It is only possible to fork a parachain as a standalone Substrate chain.
- Startd from the latest block of a network. Block production should continue with using `--block-time `
- When Anvil-polkadot starts the block production is turned off of by default.
- When transaction sent, new block is produced. This default behaviour ensure that transactions are in strict order.
- Setting it with `-b N (--block-time)` will produce blocks automatically every N seconds.
- **Optionally**: provide a toolkit to manualy produce a block on demand.
### Config params
`-b, --block-time `
Block time in seconds for interval mining
[aliases: --blockTime]
`--no-mining`
Used by default. Disable auto and interval mining, and mine on demand instead
[aliases: --no-mine]
`--dump-state`
Dump the state and block environment of chain on exit to the given file.
If the value is a directory, the state will be written to `/state.json`.
`--load-state `
Initialize the chain from a previously saved state snapshot
`--init `
Initialize the genesis block with the given `genesis.json` file
`-s, --state-interval `
Interval in seconds at which the state and block environment is to be dumped to disk.
`-f, --fork-url `
Fetch state over a remote endpoint instead of starting from an empty state.
If you want to fetch state from a specific block number, add a block number like `http://localhost:8545@1400000` or use the `--fork-block-number` argument.
[aliases: --rpc-url]
`--fork-block-number `
Fetch state from a specific block number over a remote endpoint.
If negative, the given value is subtracted from the `latest` block number.
See --fork-url.
`--fork-transaction-hash `
Fetch state from a specific transaction hash over a remote endpoint.
`-p, --port `
Port number to listen on
[default: 8545]
`-V, --version`
Print version
`-v, --verbosity`
Verbosity level of the log messages.
Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
Depending on the context the verbosity levels have different meanings.
For example, the verbosity levels of the EVM are:
- 2 (-vv): Print logs for all tests.
- 3 (-vvv): Print execution traces for failing tests.
- 4 (-vvvv): Print execution traces for all tests, and setup traces for failing tests.
- 5 (-vvvvv): Print execution and setup traces for all tests, including storage changes.
`-h, --help`
Print help (see a summary with '-h')
### RPC
`produceBlock(): bool`
interface: api.rpc.produceBlock
jsonrpc: `api_produceBlock`
summary: produces next block executing all transaction from mempool. Returns True if blockproduced correctly.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the referenced foundry-polkadot issue and Anvil-eth requirements, then locate the repository's CLI and RPC entry points. The issue names no files or tests; done would require implementing and validating the listed fork, state snapshot, mining, and produceBlock behaviours.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend-api-design, cli, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100