Skip to content

fix(contracts): improve DelayedWETH loading for fork tests#19206

Merged
ajsutton merged 6 commits intodevelopfrom
aj/fix-upgrade-tests
Feb 17, 2026
Merged

fix(contracts): improve DelayedWETH loading for fork tests#19206
ajsutton merged 6 commits intodevelopfrom
aj/fix-upgrade-tests

Conversation

@ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Feb 16, 2026

This PR fixes several issues with how DelayedWETH addresses are loaded during fork-based upgrade tests.

Changes

Load pre-upgrade state from on-chain queries

  • Changed upgrade tests to fetch DelayedWETH addresses directly from on-chain state using DisputeGames.getGameImplDelayedWeth() instead of relying on artifacts
  • This makes the tests more robust and ensures they work correctly regardless of whether artifacts were properly populated

Fix v1/v2 OPCM structure handling

  • Improved fallback logic in ForkLive._readSuperchainRegistry() to properly handle both v1 and v2 OPCM structures:
    • V1 structure: DelayedWETH accessed via gameImpl.weth()
    • V2 structure: DelayedWETH accessed via gameArgs().weth
  • The code now attempts v2 first, then falls back to v1 if gameArgs don't exist or return empty bytes
  • Ensures proper error propagation when gameArgs data is invalid

Fix copy-paste bug in ForkLive

  • Fixed bug where permissionless DelayedWETH was being fetched using GameTypes.PERMISSIONED_CANNON instead of GameTypes.CANNON
  • This caused incorrect artifact addresses to be saved

Improve test error messages

  • Added descriptive error messages to WETH assertions to make test failures easier to diagnose

Testing

  • All upgrade tests now pass with these changes
  • Tests work correctly across all feature variants including CUSTOM_GAS_TOKEN

… artifacts

Upgrade tests were failing because ForkLive assumed v1 structure (DelayedWETH
on game impl) but after OPCM v2 upgrades it's stored in gameArgs. This caused
artifact loading to fail when tests ran past upgrades without useUpgradedFork.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ajsutton ajsutton requested a review from a team as a code owner February 16, 2026 23:40
@ajsutton ajsutton requested a review from Ethnical February 16, 2026 23:40
Fixes semgrep rule sol-style-return-arg-fmt which requires named return
arguments to have an underscore suffix.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.5%. Comparing base (e0340d6) to head (47fd02a).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #19206      +/-   ##
===========================================
+ Coverage     66.4%    81.5%   +15.1%     
===========================================
  Files           55      134      +79     
  Lines         4030     6930    +2900     
===========================================
+ Hits          2677     5651    +2974     
- Misses        1209     1279      +70     
+ Partials       144        0     -144     
Flag Coverage Δ
cannon-go-tests-64 ?
contracts-bedrock-tests 81.5% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 189 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Simplify the fallback logic so that:
- If gameArgs returns data (length > 0), it must decode successfully
- Only fall back to v1 (game impl .weth()) if gameArgs doesn't exist
  or returns empty bytes

This ensures proper error propagation when gameArgs data is invalid.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ajsutton ajsutton force-pushed the aj/fix-upgrade-tests branch from 0987651 to 9650f98 Compare February 17, 2026 01:06
@ajsutton ajsutton force-pushed the aj/fix-upgrade-tests branch from 9650f98 to fcc6528 Compare February 17, 2026 01:08
@ajsutton ajsutton changed the title fix(contracts): handle v1/v2 OPCM structures when loading DelayedWETH artifacts fix(contracts): improve DelayedWETH loading for fork tests Feb 17, 2026
@ajsutton ajsutton enabled auto-merge February 17, 2026 02:21
@ajsutton ajsutton added this pull request to the merge queue Feb 17, 2026
Merged via the queue into develop with commit 84f0470 Feb 17, 2026
208 checks passed
@ajsutton ajsutton deleted the aj/fix-upgrade-tests branch February 17, 2026 14:58
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.

3 participants