Skip to content

[Anvil] Merge master into feature/forking branch#547

Open
re-gius wants to merge 108 commits into
feature/forkingfrom
re-gius/forking-merge-master
Open

[Anvil] Merge master into feature/forking branch#547
re-gius wants to merge 108 commits into
feature/forkingfrom
re-gius/forking-merge-master

Conversation

@re-gius

@re-gius re-gius commented Mar 10, 2026

Copy link
Copy Markdown

This is the first step towards merging the forking branch into master.

This PR merges the latest changes from origin/master and improves feature gating to avoid breaking anvil-polkadot tests. All changes have been reviewed previously, so you can just focus on the last two commits: the first merges origin/master and solves conflicts, the second fixes a few conflict errors, then improves docs and feature gating.

The only files for which manual conflict resolution or improved feature gating was applied are:

  1. crates/anvil-polkadot/src/api_server/server.rs: forking fields + timestamp logic
  2. crates/anvil-polkadot/src/cmd.rs: fork CLI args
  3. crates/anvil-polkadot/src/substrate_node/service/executor.rs: feature gating
  4. crates/anvil-polkadot/src/substrate_node/service/mod.rs: forking setup
  5. crates/anvil-polkadot/tests/it/utils.rs: feature gating forking test utilities

Also added forking documentation to README.md and set relay_parent_offset = 1 to support Westend Asset Hub's elastic scaling.

Notice that we see so many commits because this is the first direct merge from master. Previously, master was first merged in an external fork of foundry-polkadot and then merged into this branch. However, you can see from the file diff (and diff with master) that we are only merging the latest changes from origin/master.

re-gius and others added 30 commits November 5, 2025 16:08
* Add test for `genesis.json` config file

* fix comments

* use utils methods in genesis tests

* Take expected values from json file

* clippy
* add vm.prank/startPrank/stopPrank support

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add prank testsuite

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* mocked functions working something

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add support for mocks

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add mock

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* remove unneeded changes

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* remove unneeded file

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* compile against latest branch

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* rebased on master

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add cheatcode testsuite

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* prank latest

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup migration

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix build

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add more tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* switch to master

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make cargo fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make clippy happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make forge fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix prank calls

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* replace with template

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup typo

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix extra

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make tests consume less resources

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup more externalities checkpoints

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* run all mocks

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make cargo fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* Add tests for gas metering cheatcodes

* fmt

* Fix test

* Change tests so they run on pallet-revive

* Added check in create and call to check if gas metering is paused

* Fix test to show proper gas usage when gas metering is paused

* Move tests to cheatcodes path

* fmt
* add vm.prank/startPrank/stopPrank support

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add prank testsuite

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* mocked functions working something

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add support for mocks

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add mock

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* remove unneeded changes

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* remove unneeded file

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* etch support

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* compile against latest branch

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* rebased on master

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add cheatcode testsuite

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add etch test suite

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add runner

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* prank latest

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup migration

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix build

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* add more tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* etch with evm code

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make etch work with evm as well

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* switch to master

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* commit cargo lock

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make cargo fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make clippy happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make forge fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make clippy happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make forge fmt happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix touched files on merge

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* Implementation

* Revert cheatcodes module to private

* Removed unnecessary overwrite and added tests for txGasPrice

* fmt

* Set effective_gas_price in ExecConfig for PVM CREATE/CALL
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* fix timestamp and block number genesis customisation
 test: remove sleep after mining with automining disabled

Used the block_notifier from revive to wait to be notified
after a best block is received and cached.
Tests no longer take unnecessary coffee breaks after mining.

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
* anvil-polkadot: add set base fee RPC

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): wip setting base fee test

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): wip tests work

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): fix next fee multiplier test

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): use just effective_gas_price

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): fix base_fee_per_gas test

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): test next fee multiplier minimum

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: update initial base fee

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: address leftovers after merge

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Update crates/anvil-polkadot/Cargo.toml

* Update crates/anvil-polkadot/Cargo.toml

* Cargo.toml: revert polkadot-sdk commit

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): fix fee history & base_fee setting at genesis

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Apply suggestion from @re-gius

Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>

* anvil-polkadot(tests): update comments

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): refactor snapshot test

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: address G comments

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Update crates/anvil-polkadot/src/config.rs

* Update crates/anvil-polkadot/substrate-runtime/src/lib.rs

* Update crates/anvil-polkadot/tests/it/snapshot.rs

* Update crates/anvil-polkadot/tests/it/snapshot.rs

* anvil-polkadot: refactor constants

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): comment on decreasing sequence of base_fee

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: refactor base_fee_per_gas genesis setup

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: log base fee in 1e12 denomination

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Apply suggestions from code review

* Update crates/anvil-polkadot/tests/it/standard_rpc.rs

* anvil-polkadot(tests): fix fmt

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: refactor genesis base fee getter

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: remove unused imports

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: fix clippy

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: customize next fee multiplier at genesis

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
* Don't derenference SubstrateBlock on revert

update_latest took ownership of the Substrateblock and wrapped it
in Arc::new. During the rollback/revert operations a caller might
try to update the latest block to a block obtained by block_by_number.
If one of the "Best" or "Finalized" subscription is lagging this could
make block_by_number to return an strong reference. This prevents
the caller to update the best block since it will not be able to
unwrap the strong reference.

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
* anvil-polkadot: add anvil_reset RPC

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: refect the reset logic in revert manager

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): assert on being able to build blocks after reset

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: remove unused imports

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): fixup after merge

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: fix clippy

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: fix some more clippy

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
* fix eth transact errors

* ensure that eth_accounts returns deterministic results

* fix tests and add one more
* anvil-polkadot(tests): we can assert on block's base_fee_per_gas

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Cargo.tomls: change polkadot-sdk to master branch

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Update Cargo.lock

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): little improvment for gas tests

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot(tests): some more comments removal

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* anvil-polkadot: fix compilation and failing test

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Cargo.lock: update polkadot-sdk to latest master

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* Update crates/anvil-polkadot/tests/it/standard_rpc.rs

* Cargo.lock: update to latest polkadot-sdk

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

* substrate-runtime: handle missing authorities

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
* filters: Implement block filters

Implement filter manager that could be reused by all three
filters: Blocks, Pending transactions and Logs.
Implement polling logic for new blocks
Add tests

---------

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io>
* fix etch in test contract constructor

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix etch test

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* fix tx origin

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix trace_counter

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* use master branch

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make mock handler happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fixup tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
By default configured to None, matching anvil's functionality and fixing a bunch of scc tests
* Implemenet EthSendTransactionSync and EthSendRawTransactionSync

Signed-off-by: Alexandru Cihodaru <alexandru.cihodaru@parity.io
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* fixup failures reporting

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make clippy happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* disable immutables migration

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* add support vm::chain_id

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* make clippy happy

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* caching fix
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* fixup immutable migration tests

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* fix immutable migration

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
* Add cli test to show blobtoolarge error

* Add fix for blobtoolarge

* fmt

* clean up code

* test

* Readded check to match ecx config

* Revert "test"

This reverts commit aeccb2b.
smiasojed and others added 24 commits January 24, 2026 23:29
… behavior (#509)

* Default eth_estimateGas to pending block to match Anvil/EDR
* upd compilers once again
* upd polkadot-sdk

* chore: bump forge-std version used for tests
…537)

* fix eth timestamp management in anvil-polkadot

* fmt

* import nit

* Fix comments

* Fix comments on `MinimumPeriod`
* Optimize CI with sccache, mold linker, consolidated test matrix, and tighter timeouts

* Fix LintCotext typos and unset RUSTC_WRAPPER for cargo deny job

* Move docs and doctest jobs to ubuntu-latest to free parity-large-new runners

* Split nextest into build and test jobs to compile once per platform

* Revert docs and doctest back to parity-large-new runner

* Revert build/test split and runner changes, keep simple single-job approach

* Restore original test matrix to preserve required check names

* Restore original timeouts

* Trigger CI to test warm sccache

* Run all CI tests in release mode and separate anvil-polkadot into its own job

* Run anvil-polkadot tests on all platforms for PRs

* Remove sccache from all CI workflows

* Only use --release for anvil-polkadot, restore sccache, use ubuntu-latest runners

* Revert to parity-large-new, remove sccache, drop --release flag

* Add workflow to delete caches for merged/closed PRs

* Make anvil-polkadot tests Linux-only and compile in release mode

* Stop saving rust cache on PR runs

* Stop saving rust cache in crate-checks

* Merge issue-repros into integration and drop to 1 partition

* Remove cache-cleanup workflow, no longer needed since PRs don't save caches

* Split issue-repros back out from integration, keep both at 1 partition

* Revert default nextest slow-timeout period to 5m

* Use profiling cargo profile for anvil-polkadot CI tests
* make block production mutually exclusive with rpcs

* always log block details

* fix test comments

* comment nit

* fix stale pool notifications counter

* fmt

* add test on mining mode switch stability

* comment fmt

* fix block hash retrieval

* add biased branches in select! loop

* Remove inline mining for async RPCs

* fmt
@re-gius re-gius marked this pull request as ready for review March 10, 2026 15:48
@re-gius

re-gius commented Mar 10, 2026

Copy link
Copy Markdown
Author

Forking tests are now failing, probably because of the latest Westend Asset Hub upgrade. This will be fixed in a separate PR before merging into origin/master

Non-forking tests are all passing instead

@alindima

Copy link
Copy Markdown

Forking tests are now failing, probably because of the latest Westend Asset Hub upgrade. This will be fixed in a separate PR before merging into origin/master

Non-forking tests are all passing instead

we should add the forking tests to a separate CI pipeline so that we avoid breaking the support once the feature branch is merged into master

@re-gius

re-gius commented Mar 11, 2026

Copy link
Copy Markdown
Author

Forking tests are now failing, probably because of the latest Westend Asset Hub upgrade. This will be fixed in a separate PR before merging into origin/master
Non-forking tests are all passing instead

we should add the forking tests to a separate CI pipeline so that we avoid breaking the support once the feature branch is merged into master

I agree with you, I'll do this in next PR to make this review easier. Also, it's probably better to prevent forking issues to affect docs/clippy CI since they are using --all-features right now

@alindima

Copy link
Copy Markdown

Forking tests are now failing, probably because of the latest Westend Asset Hub upgrade. This will be fixed in a separate PR before merging into origin/master
Non-forking tests are all passing instead

we should add the forking tests to a separate CI pipeline so that we avoid breaking the support once the feature branch is merged into master

I agree with you, I'll do this in next PR to make this review easier. Also, it's probably better to prevent forking issues to affect docs/clippy CI since they are using --all-features right now

sounds good. and I assume a next step after we merge this branch into master would be to remove the compile-time feature and make it configurable at runtime (via CLI and Rpc)?

@alindima alindima self-requested a review March 24, 2026 10:51
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.