Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: op stack fault proofs #1994

Merged
merged 22 commits into from
Mar 24, 2024
Merged

feat: op stack fault proofs #1994

merged 22 commits into from
Mar 24, 2024

Conversation

jxom
Copy link
Member

@jxom jxom commented Mar 21, 2024

PR-Codex overview

This PR focuses on adding support for Fault Proofs on OP Stack.

Detailed summary

  • Added support for Fault Proofs on OP Stack
  • Introduced new actions: getGame, getGames, getTimeToNextGame, waitForNextGame
  • Deprecated existing actions related to L2 output
  • Updated configurations and tests for the new actions

The following files were skipped due to too many changes: src/chains/opStack/index.ts, test/globalSetup.ts, src/chains/opStack/actions/getTimeToProve.test.ts, src/chains/opStack/actions/getGame.test.ts, src/chains/opStack/actions/waitForNextL2Output.test.ts, src/chains/opStack/actions/getTimeToNextGame.test.ts, src/chains/opStack/actions/waitToProve.test.ts, src/chains/opStack/actions/buildProveWithdrawal.ts, test/src/constants.ts, src/chains/opStack/actions/getGames.test.ts, src/chains/opStack/actions/getL2Output.ts, site/pages/op-stack/actions/getGame.md, src/chains/opStack/actions/getTimeToProve.ts, src/chains/opStack/actions/getPortalVersion.ts, test/src/opStack.ts, src/chains/opStack/actions/getGame.ts, src/chains/opStack/decorators/publicL1.test.ts, site/pages/op-stack/actions/getGames.md, src/chains/opStack/actions/waitToProve.ts, src/chains/opStack/actions/waitForNextGame.ts, site/pages/op-stack/actions/waitForNextGame.md, src/chains/opStack/actions/getTimeToFinalize.test.ts, src/chains/opStack/actions/getGames.ts, site/pages/op-stack/actions/getTimeToNextGame.md, src/chains/opStack/actions/getTimeToFinalize.ts, src/chains/opStack/actions/getTimeToNextGame.ts, src/chains/opStack/actions/initiateWithdrawal.test.ts, src/chains/opStack/actions/buildProveWithdrawal.test.ts, src/chains/opStack/actions/getWithdrawalStatus.ts, src/chains/opStack/decorators/publicL1.ts, src/chains/opStack/actions/getWithdrawalStatus.test.ts, src/chains/opStack/abis.ts, src/chains/opStack/actions/proveWithdrawal.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Mar 21, 2024

🦋 Changeset detected

Latest commit: bd36515

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

This PR includes changesets to release 1 package
Name Type
viem Minor

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

Copy link

vercel bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview Mar 24, 2024 8:07pm

Copy link
Contributor

github-actions bot commented Mar 21, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
viem (esm) 66.34 KB (0%) 1.4 s (0%) 1.2 s (-24.64% 🔽) 2.5 s
viem (cjs) 86.18 KB (0%) 1.8 s (0%) 3.6 s (-21.49% 🔽) 5.4 s
viem (minimal surface - tree-shaking) 3.72 KB (0%) 75 ms (0%) 58 ms (-8.12% 🔽) 132 ms
viem/accounts 91.47 KB (0%) 1.9 s (0%) 1.4 s (-8.38% 🔽) 3.2 s
viem/accounts (tree-shaking) 21.09 KB (0%) 422 ms (0%) 977 ms (+82.24% 🔺) 1.4 s
viem/actions 46.67 KB (0%) 934 ms (0%) 1.1 s (+143.77% 🔺) 2.1 s
viem/actions (tree-shaking) 340 B (0%) 10 ms (0%) 52 ms (+111.95% 🔺) 62 ms
viem/chains 30.18 KB (+0.17% 🔺) 604 ms (+0.17% 🔺) 979 ms (+75.53% 🔺) 1.6 s
viem/chains (tree-shaking) 367 B (0%) 10 ms (0%) 39 ms (+78.83% 🔺) 49 ms
viem/chains/utils 1.16 KB (0%) 24 ms (0%) 47 ms (-38.46% 🔽) 70 ms
viem/ens 46.67 KB (0%) 934 ms (0%) 706 ms (+46.71% 🔺) 1.7 s
viem/ens (tree-shaking) 20.68 KB (0%) 414 ms (0%) 376 ms (-30.58% 🔽) 790 ms

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

Attention: Patch coverage is 96.49438% with 78 lines in your changes are missing coverage. Please review.

Project coverage is 97.39%. Comparing base (5a01527) to head (bd36515).

Files Patch % Lines
src/chains/opStack/actions/getTimeToFinalize.ts 67.18% 21 Missing ⚠️
src/chains/opStack/actions/getWithdrawalStatus.ts 86.92% 13 Missing and 4 partials ⚠️
src/chains/opStack/actions/waitToProve.ts 76.92% 15 Missing ⚠️
src/chains/opStack/actions/waitForNextGame.ts 94.26% 7 Missing ⚠️
src/chains/opStack/actions/getL2Output.ts 86.36% 6 Missing ⚠️
src/chains/opStack/actions/buildProveWithdrawal.ts 42.85% 4 Missing ⚠️
src/chains/opStack/actions/getGames.ts 96.99% 4 Missing ⚠️
src/chains/opStack/actions/getPortalVersion.ts 97.70% 2 Missing ⚠️
src/chains/opStack/actions/getTimeToNextGame.ts 98.60% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1994      +/-   ##
==========================================
- Coverage   99.77%   97.39%   -2.39%     
==========================================
  Files         580      580              
  Lines       50921    52743    +1822     
  Branches     2530     2325     -205     
==========================================
+ Hits        50808    51369     +561     
- Misses        100     1347    +1247     
- Partials       13       27      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@roninjin10 roninjin10 left a comment

Choose a reason for hiding this comment

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

Looking great!

test('default', async () => {
await reset(sepoliaClient, {
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL reset this is useful

* Strategy for extracting a dispute game.
*
* - `latest` - Returns the latest dispute game.
* - `random` - Returns a random dispute game.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* - `random` - Returns a random dispute game.
* - `random` - Returns a random dispute game. This helps prevent DDOS from someone submitting invalid games

Not obvious to most people "why"?

*/
limit?: number | undefined
/**
* Strategy for extracting a dispute game.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Strategy for extracting a dispute game.
* Strategy for extracting a dispute game.
* @default latest

nit

| ErrorType

/**
* Retrieves a valid dispute game on an L2 that occurred after a provided L2 block number.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Retrieves a valid dispute game on an L2 that occurred after a provided L2 block number.
* Retrieves a valid [dispute game](https://specs.optimism.io/experimental/fault-proof/stage-one/dispute-game-interface.html) on an L2 that occurred after a provided L2 block number.

Comment on lines +91 to +95
const game = (() => {
if (strategy === 'random')
return games[Math.floor(Math.random() * games.length)]
return games[0]
})()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a big middle finger to ternaries lol

Will Cory and others added 18 commits March 23, 2024 18:40
author Will Cory <willcory@Wills-MacBook-Pro.local> 1709088652 -0800
committer Will Cory <willcory@Wills-MacBook-Pro.local> 1710517178 -0700

Add portalVersion action to viem/opstack

add test client for tevm matching anvil client

pnpm i @tevm/server

upgrade to versions of @tevm/opstack that don't have deps related bugs

REVERTME temporary hack to make foundry work on my machine

add the test and portal version action

update based on comments

add test client, rename createL1Client, and move to opstack test utils

bun i @tevm/opstack

add test client for tevm matching anvil client

pnpm i @tevm/server

upgrade to versions of @tevm/opstack that don't have deps related bugs

REVERTME temporary hack to make foundry work on my machine

add the test and portal version action

feat: Add forwards compatability to getWithdrawalStatus

first version of things

feat: Update waitForNextL2Output

fix broken lint

update getTimeToFinalize

add a comment

complete and squash
@jxom jxom merged commit 119aea6 into main Mar 24, 2024
26 of 30 checks passed
@jxom jxom deleted the fault-proofs branch March 24, 2024 20:07
@github-actions github-actions bot mentioned this pull request Mar 24, 2024
@tmm tmm mentioned this pull request Mar 30, 2024
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