edr icon indicating copy to clipboard operation
edr copied to clipboard

chore: merge main and upgrade foundry crates to multichain revm

Open agostbiro opened this issue 8 months ago • 2 comments

Merge main with the multichain changes to feat/solidity-tests and upgrade Foundry crates to (multichain) REVM 21 using generics for block, tx, REVM config and chain config.

The changes that are not related to generics, but caused by other REVM/Alloy interface changes are based on https://github.com/foundry-rs/foundry/pull/10183.

After this PR is merged, Solidity tests will still only support mainnet, but OP chain type and merging feat/solidity-tests into main is unblocked.

Follow ups to allow running Solidity tests with OP chain type:

  1. Merge feat/solidity tests into main (TODOs related to JS build and CI: https://github.com/NomicFoundation/edr/issues/685)
  2. Make halt reason generic in Foundry crates
  3. Make precompiles generic in Foundry crates
  4. Allow setting predeploys for soltest runner and pass in OP predeploys
  5. Expose chain type setting in Solidity test runner with two choices: OP or mainnet
  6. Release EDR with Solidity tests from release/optimism

agostbiro avatar May 06 '25 17:05 agostbiro

🦋 Changeset detected

Latest commit: 10437b24202f5f40a823505b59539dc95cee5abe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nomicfoundation/edr Patch
@nomicfoundation/edr-helpers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 06 '25 17:05 changeset-bot[bot]

Note to self: need to make halt reason generic as well

agostbiro avatar May 07 '25 14:05 agostbiro

What merge strategy do you plan to use? Do you want to maintain history?

I tried cleaning up the merge history, but failed. I tried several things:

  • combine multiple merge commits into one without squashing (as squashing would result in future merge conflicts)
  • rebase onto feat/solidity-tests to avoid having a mix of merges from main/feat/multichain and feat/solidity-tests

I was not able to achieve either of these. I tried:

  • Instructing Cline to do it for me
  • git rebase -i --rebase-merges
  • cherry-pick commits on top of feat/solidity-tests

The primary issue was that the original merge conflict resolutions could not be preserved.

Wodann avatar Jun 06 '25 15:06 Wodann

This is how we can squash this PR down to one commit while preserving merge history (so as to avoid merge conflicts in the future):

cd ~/edr # repo root
git checkout -b merge-multichain-revm-21-squash "$(git merge-base merge-multichain-revm-21 feat/solidity-tests)"
git merge "$(git merge-base merge-multichain-revm-21 main)"
# This will show a lot of merge conflicts. We resolve them by copying everything from the PR branch:
git restore -WSs merge-multichain-revm-21 .
git commit -m 'chore: merge main and upgrade foundry crates to multichain revm'
# Reset PR branch to squashed merge commit:
git branch -M merge-multichain-revm-21
git push -f

The resulting commit should have exactly the same contents as the PR, and should have two parent commits (the first from feat/solidity-tests and the second from main).

This would need to be merged via normal merge rather than squash merge. It could be a fast-forward but I don't know if GitHub allows that via the UI.

frangio avatar Jun 06 '25 18:06 frangio

There are a couple of test failures left:

  • Test EDR:: integration::rpc::transaction_and_receipt_pre_bedrock
    • This is fixed in main. I'd merge with this failure to avoid having to merge main into this branch again and complicate git history.
  • Test EDR TS bindings: Failed to set global tracing subscriber with error: a global default trace dispatcher has already been set Please only initialize EdrContext once per process to avoid this error.
    • I can't repro this locally, so I suspect that it only happens after merging this branch. Should be fixed by fixing git history.
  • Run Hardhat tests: Should not return the field reward if no percentiles were given:
    • The Rust error is: failed to parse with expected type 'edr_rpc_client::jsonrpc::Response<edr_eth::fee_history::FeeHistoryResult>', due to error: 'data did not match any variant of untagged enum ResponseData.
    • Related PR: https://github.com/NomicFoundation/edr/pull/484
    • It's probably related to a change from main overwriting something in feat/solidity-tests. I'm looking into this.

agostbiro avatar Jun 12 '25 13:06 agostbiro

This is fixed in main. I'd merge with this failure to avoid having to merge main into this branch again and complicate git history.

The idea is to squash everything based on @frangio's proposed method to ensure a clean git history. Doing one more merge shouldn't matter.

The danger with ignoring Rust test failures is that they can hide other test errors that happen in later files & crates, as the test runner exits early.

Wodann avatar Jun 12 '25 16:06 Wodann

The idea is to squash everything based on @frangio's proposed method to ensure a clean git history. Doing one more merge shouldn't matter.

The danger with ignoring Rust test failures is that they can hide other test errors that happen in later files & crates, as the test runner exits early.

Ok are we cool with cherry picking that fix from main? There are conflicts in 58 files when merging main into this branch so I'd really like to avoid that 😅

agostbiro avatar Jun 12 '25 16:06 agostbiro

superseded by https://github.com/NomicFoundation/edr/pull/940

agostbiro avatar Jun 16 '25 14:06 agostbiro