Skip to content

Comments

cannon: Add feature toggling to MIPS VM contracts#15487

Merged
mbaxter merged 15 commits intodevelopfrom
mbax/cannon-solidity-feature-toggles
Apr 23, 2025
Merged

cannon: Add feature toggling to MIPS VM contracts#15487
mbaxter merged 15 commits intodevelopfrom
mbax/cannon-solidity-feature-toggles

Conversation

@mbaxter
Copy link
Contributor

@mbaxter mbaxter commented Apr 21, 2025

Description

Based on PR #15425.

Add feature toggling to MIPS2 and MIPS64 contracts. Feature toggling is enabled by injecting the target StateVersion into the MIPS contracts. The VM's behavior can then be changed conditionally based on the StateVersion value. For example:

} else if (STATE_VERSION >=6 && syscall_no == sys.SYS_EVENTFD2) {
  // ignored
} else ....

With feature toggling, we can maintain multiple VM versions in develop: the current VM as well as future iterations of the VM that are still in development. This allows us to continue to release the current VM if necessary, while developing the next version(s) in parallel.

Other changes:

  • Update op-deployer and other deployment scripts to use the mipsVersion parameter as follows:
    • 1 is for the legacy 32-bit MIPS.sol contract
    • 6 is for the latest 64-bit MISP64.sol contract. This value corresponds to the latest StateVersion for the 64-bit VM.
  • Unfreeze MIPS* contracts

Tests

  • Update tests to inject the StateVersion parameter into contracts where required.
  • Update tests to use the appropriate MipsVersion parameter.

Metadata

Part of: #13447

@codecov
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Project coverage is 46.55%. Comparing base (c342f1f) to head (5e0967c).
Report is 16 commits behind head on develop.

Files with missing lines Patch % Lines
...deployer/pkg/deployer/bootstrap/implementations.go 0.00% 1 Missing and 1 partial ⚠️
op-deployer/pkg/deployer/pipeline/dispute_games.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #15487      +/-   ##
===========================================
- Coverage    46.67%   46.55%   -0.12%     
===========================================
  Files         1271     1271              
  Lines       105156   105166      +10     
===========================================
- Hits         49080    48962     -118     
- Misses       52609    52746     +137     
+ Partials      3467     3458       -9     
Flag Coverage Δ
cannon-go-tests-32 62.26% <100.00%> (-1.98%) ⬇️
cannon-go-tests-64 57.41% <64.70%> (-1.71%) ⬇️
contracts-bedrock-tests 94.30% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cannon/mipsevm/tests/helpers.go 83.50% <100.00%> (-13.41%) ⬇️
cannon/mipsevm/testutil/evm.go 70.58% <100.00%> (+2.33%) ⬆️
op-chain-ops/interopgen/recipe.go 76.04% <100.00%> (ø)
op-deployer/pkg/deployer/standard/standard.go 59.01% <ø> (ø)
packages/contracts-bedrock/src/cannon/MIPS2.sol 84.90% <100.00%> (ø)
op-deployer/pkg/deployer/pipeline/dispute_games.go 0.00% <0.00%> (ø)
...deployer/pkg/deployer/bootstrap/implementations.go 34.43% <0.00%> (ø)

... and 17 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.

@mbaxter mbaxter force-pushed the mbax/cannon-solidity-feature-toggles branch from 94b31f4 to adb3d55 Compare April 22, 2025 15:31
@mbaxter mbaxter marked this pull request as ready for review April 22, 2025 19:25
@mbaxter mbaxter requested review from a team as code owners April 22, 2025 19:25
@mbaxter mbaxter requested review from ajsutton, blmalone, protolambda and stevennevins and removed request for blmalone, protolambda and stevennevins April 22, 2025 19:25
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mbaxter mbaxter added this pull request to the merge queue Apr 23, 2025
@mbaxter mbaxter removed this pull request from the merge queue due to a manual request Apr 23, 2025
@mbaxter mbaxter added this pull request to the merge queue Apr 23, 2025
Merged via the queue into develop with commit 718a5da Apr 23, 2025
53 checks passed
@mbaxter mbaxter deleted the mbax/cannon-solidity-feature-toggles branch April 23, 2025 17:09
iquidus pushed a commit to Layr-Labs/optimism that referenced this pull request Jul 24, 2025
…15487)

* cannon: Add state version to MIPS contract.

* Formatting.

* cannon: Update EVM tests to init contract correctly.

* Fix contracts checks.

* op-deployer: Fix test

* Formatting

* Fix interfaces.

* Update MIPS2 version.

* cleanup: Cut println

* Remove MIPS contracts from code freeze

* Drop legacy MipsVersion 2

* Run semver-lock

* Drop -beta suffix from version

* Run semver-lock

* cleanup: Reorganize MIPS64 imports

---------

Co-authored-by: Adrian Sutton <adrian@oplabs.co>
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.

2 participants