Skip to content

cannon: Implement dclo|dclz#14454

Merged
clabby merged 14 commits intoethereum-optimism:developfrom
pcw109550:pcw109550/cannon-dclz-dclo
Apr 11, 2025
Merged

cannon: Implement dclo|dclz#14454
clabby merged 14 commits intoethereum-optimism:developfrom
pcw109550:pcw109550/cannon-dclz-dclo

Conversation

@pcw109550
Copy link
Member

Description

Implements dclo and dclz instruction for offchain/onchain cannon implementation. We need these instructions because for executing kona compiled down to mips64r1. There were attempts(#14405) to support kona to be executed as mips64r2, but this causes more diff for cannon. The point here is to introduce as small diff as possible, while making cannon capable of executing kona in mips64, so mips64r1 is enough.

There are contract diffs, so I decided to bump patch version to 1.0.1, but not sure this is the right version to update. For example at #13429 single instruction was added to onchain FPVM, and the version was bumped to 1.0.0-beta.8 from 1.0.0-beta.7. Anyway ran semver lock to update codehashes.

Tests

Added unit tests for testing both offchain/onchain implementation and comparing them.

Validated that kona at commit op-rs/kona@161547c compiled to mips64r1 calculates expected state hash using preimage https://github.com/op-rs/kona/blob/main/bin/client/testdata/holocene-op-sepolia-22012816-witness.tar.zst with cannon with this PR applied.

Metadata

@pcw109550 pcw109550 requested review from a team as code owners February 20, 2025 11:00
@pcw109550 pcw109550 requested review from ajsutton and tynes February 20, 2025 11:00
@Inphi
Copy link
Contributor

Inphi commented Feb 20, 2025

/ci authorize a162409

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Mar 7, 2025
@opgitgovernance
Copy link
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@tynes tynes added S-exempt-stale Status: Do not mark stale and removed S-stale Status: Will be closed unless there is activity labels Mar 12, 2025
@pauldowman
Copy link
Contributor

What's still needed here? Just reviews?

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

MIPS64 semver needs updating. But lgtm.

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

I later realized that this change warrants an update to the StateVersion.
All breaking changes to the FPVM STF, even if they do not update the state format, must be paired with a StateVersion bump. This should be done for both 32-bit and 64-bit cannon. So:

  • VersionMultiThreaded_v3
  • VersionMultiThreaded64_v4

The absolute prestate encodes the StateVersion, tying a particular VM STF to a program. This ensures we don't accidentally execute a program on a VM that doesn't support it.

clabby added a commit to op-rs/kona that referenced this pull request Apr 8, 2025
## Overview

Adds a dockerfile for reproducible builds of the `cannon` prestate with `kona-client`.

Note that `cannon` does not yet support `kona`. ethereum-optimism/optimism#14454 must be merged before this can be used. This PR just adds the route to build the artifacts, but we will need to follow up with <issue_num> once the new instructions are supported and a new `cannon` tag has been released.
@pcw109550 pcw109550 force-pushed the pcw109550/cannon-dclz-dclo branch from a162409 to c022c67 Compare April 11, 2025 15:53
@pcw109550
Copy link
Member Author

/ci authorize c022c67

@pcw109550
Copy link
Member Author

/ci authorize be5a38e

@pcw109550
Copy link
Member Author

/ci authorize 4ebf22b

@pcw109550
Copy link
Member Author

/ci authorize 8b137a7

@pcw109550
Copy link
Member Author

Yay finally CI is green, but I got few questions @Inphi
Q1) dclo|dclz is only for 64 bit, but why do VersionMultiThreaded_v3 is needed?
Q2) If I search original multithreaded64-3 in our monorepo codebase, I see multiple occurrences including the prestate reproducing Dockerfile etc. Is it okay to not update them?

@pcw109550 pcw109550 requested review from Inphi and clabby April 11, 2025 16:48
@Inphi
Copy link
Contributor

Inphi commented Apr 11, 2025

Yay finally CI is green, but I got few questions @Inphi Q1) dclo|dclz is only for 64 bit, but why do VersionMultiThreaded_v3 is needed?

Good callout on the 32-bit state version. We don't need to introduce a VersionMultiThreaded_v3 version. The 64-bit state version bump suffices. So let's remove the VersionMultiThreaded_v3 version bump.

Q2) If I search original multithreaded64-3 in our monorepo codebase, I see multiple occurrences including the prestate reproducing Dockerfile etc. Is it okay to not update them?

We're currently cutting new prestates to be governance-approved for the existing VM. So we don't want to alter the prestate versions used until after we're done cutting releases.

@pcw109550
Copy link
Member Author

/ci authorize 8d65092

@pcw109550
Copy link
Member Author

/ci authorize 1bd10c7

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@pcw109550 pcw109550 added this pull request to the merge queue Apr 11, 2025
@pcw109550 pcw109550 removed this pull request from the merge queue due to a manual request Apr 11, 2025
@clabby clabby added this pull request to the merge queue Apr 11, 2025
Merged via the queue into ethereum-optimism:develop with commit d38b80e Apr 11, 2025
51 checks passed
sigma added a commit that referenced this pull request Apr 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Apr 11, 2025
Inphi added a commit that referenced this pull request Apr 29, 2025
Inphi added a commit that referenced this pull request Apr 29, 2025
Inphi added a commit that referenced this pull request Apr 29, 2025
ClaytonNorthey92 pushed a commit to hemilabs/optimism that referenced this pull request May 13, 2025
* cannon: Implement dclo|dclz in the offchain mipsevm

* cannon: Implement dclo|dclz in the onchain MIPS64 FPVM

* cannon: dclo|dclz tests

* cannon: dclo|dclz README

* cannon: Update MIPS64 contract version

* cannon: Run semver-lock

* cannon: dclo|dclz test style

* cannon: bump StateVersion for dclz|dclo

* cannon: Run semver-lock after rebase

* cannon: ci update for dclo|dclz

* cannon: Makefile for dclo|dclz

* cannon: test states for dclz|dclo

* cannon: remove VersionMultiThreaded_v3

* cannon: test states for dclz|dclo
ClaytonNorthey92 pushed a commit to hemilabs/optimism that referenced this pull request May 13, 2025
iquidus pushed a commit to Layr-Labs/optimism that referenced this pull request Jul 24, 2025
* cannon: Implement dclo|dclz in the offchain mipsevm

* cannon: Implement dclo|dclz in the onchain MIPS64 FPVM

* cannon: dclo|dclz tests

* cannon: dclo|dclz README

* cannon: Update MIPS64 contract version

* cannon: Run semver-lock

* cannon: dclo|dclz test style

* cannon: bump StateVersion for dclz|dclo

* cannon: Run semver-lock after rebase

* cannon: ci update for dclo|dclz

* cannon: Makefile for dclo|dclz

* cannon: test states for dclz|dclo

* cannon: remove VersionMultiThreaded_v3

* cannon: test states for dclz|dclo
iquidus pushed a commit to Layr-Labs/optimism that referenced this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-exempt-stale Status: Do not mark stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants