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

op-e2e: Convert most FaultDisputeGame read operations to use custom contract bindings #10533

Merged
merged 4 commits into from
May 20, 2024

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented May 14, 2024

Description

Convert nearly all read usages of the generated FaultDisputeGame bindings in op-e2e to the custom contract bindings.

Creating and sending transactions still uses the generated bindings - we need an op-e2e version of TxManager to handle gas estimation before they can be converted. There's a couple of read calls that aren't currently exposed on the custom bindings which still use the generated ones.

This will conflict with #10520 which is more important, so let's get that one merged first.

Builds on #10532

@ajsutton ajsutton changed the base branch from develop to aj/delete-unused-helpers May 14, 2024 05:41
Base automatically changed from aj/delete-unused-helpers to develop May 14, 2024 14:46
# Conflicts:
#	op-e2e/e2eutils/disputegame/helper.go
#	op-e2e/e2eutils/disputegame/output_cannon_helper.go
#	op-e2e/e2eutils/disputegame/output_game_helper.go
Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.92%. Comparing base (93891de) to head (febd78d).

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10533       +/-   ##
============================================
+ Coverage    42.36%   81.92%   +39.55%     
============================================
  Files           73       10       -63     
  Lines         4836     1079     -3757     
  Branches       766        0      -766     
============================================
- Hits          2049      884     -1165     
+ Misses        2680      163     -2517     
+ Partials       107       32       -75     
Flag Coverage Δ
cannon-go-tests 81.92% <ø> (ø)
chain-mon-tests ?
common-ts-tests ?
contracts-ts-tests ?
core-utils-tests ?
sdk-tests ?

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

see 63 files with indirect coverage changes

@ajsutton ajsutton marked this pull request as ready for review May 20, 2024 09:13
@ajsutton ajsutton requested a review from a team as a code owner May 20, 2024 09:13
@ajsutton ajsutton requested review from bitwiseguy and Inphi and removed request for bitwiseguy May 20, 2024 09:13
Copy link
Contributor

coderabbitai bot commented May 20, 2024

Walkthrough

Walkthrough

The recent updates primarily involve refactoring and type adjustments across various files related to the Fault Dispute Game in the Ethereum Optimism project. Key changes include modifying struct fields, function parameters, and variable assignments to align with new contract structures and types. Additionally, imports have been updated to reflect these changes, and some logic has been refined to enhance error handling and data retrieval mechanisms.

Changes

File Path Change Summary
.../disputegame/claim_helper.go Adjusted ClaimHelper struct fields and function parameters to use updated types and variable names.
.../disputegame/dishonest_helper.go Updated ExhaustDishonestClaims method to use types.Claim and modified logic for depth comparison.
.../disputegame/helper.go Modified imports and function signatures to use new contract structures and updated variable assignments.
.../disputegame/output_alphabet_helper.go Refactored imports and CreateHonestActor function to use g.Game for block range retrieval.
.../disputegame/output_cannon_helper.go Updated contract initialization and method calls within OutputCannonGameHelper struct.
.../disputegame/output_game_helper.go Refactored usage of contracts and bindings, updated types, function calls, and enhanced error handling.
.../faultproofs/output_alphabet_test.go Updated game status constants references from disputegame to types.
.../faultproofs/output_cannon_test.go Added import for gameTypes and changed function calls related to game status constants.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 93891de and febd78d.
Files selected for processing (8)
  • op-e2e/e2eutils/disputegame/claim_helper.go (3 hunks)
  • op-e2e/e2eutils/disputegame/dishonest_helper.go (1 hunks)
  • op-e2e/e2eutils/disputegame/helper.go (5 hunks)
  • op-e2e/e2eutils/disputegame/output_alphabet_helper.go (3 hunks)
  • op-e2e/e2eutils/disputegame/output_cannon_helper.go (7 hunks)
  • op-e2e/e2eutils/disputegame/output_game_helper.go (24 hunks)
  • op-e2e/faultproofs/output_alphabet_test.go (7 hunks)
  • op-e2e/faultproofs/output_cannon_test.go (13 hunks)
Additional comments not posted (5)
op-e2e/e2eutils/disputegame/helper.go (1)

189-190: Verify correct implementation of blockchain interactions in GetL1Head.

The method GetL1Head interacts with the blockchain to retrieve the L1 head. It's important to verify that these interactions are implemented correctly and handle all potential blockchain-related errors to ensure the robustness of the game logic.

op-e2e/e2eutils/disputegame/output_cannon_helper.go (1)

Line range hint 236-248: Verify correct implementation of preimage verification logic in VerifyPreimage.

The method VerifyPreimage involves verifying the loading of a preimage in the game. It's important to ensure that the preimage verification logic is implemented correctly and that all blockchain interactions are handled robustly to maintain the integrity of the game mechanics.

op-e2e/e2eutils/disputegame/output_game_helper.go (1)

88-90: Ensure proper error handling for GetSplitDepth.

The method GetSplitDepth could potentially return an error that isn't handled here. Consider adding error handling to prevent runtime panics.

op-e2e/faultproofs/output_cannon_test.go (2)

11-11: Update import to use gameTypes for game status constants aligns with the refactoring in other parts of the project.


74-74: Ensure that the game status constants are correctly updated across all test functions.

Also applies to: 102-102, 179-179, 217-217, 435-435, 501-501, 550-550, 601-601, 661-661, 721-721, 783-783, 817-817


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Out of diff range and nitpick comments (2)
op-e2e/e2eutils/disputegame/output_alphabet_helper.go (1)

Line range hint 38-47: Ensure proper error handling in CreateHonestActor.

The method CreateHonestActor retrieves block ranges and initializes various components. It's crucial to ensure that all potential errors from blockchain interactions are handled appropriately to prevent runtime panics and ensure robustness.

op-e2e/e2eutils/disputegame/output_game_helper.go (1)

166-167: Validate output root with more comprehensive checks.

While the current validation checks if the output root is correct, consider adding more detailed checks or logs to help debug issues more effectively.

@refcell refcell added this pull request to the merge queue May 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 20, 2024
@ajsutton ajsutton added this pull request to the merge queue May 20, 2024
Merged via the queue into develop with commit 2586a82 May 20, 2024
72 checks passed
@ajsutton ajsutton deleted the aj/convert-e2e-contracts branch May 20, 2024 23:01
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.

None yet

2 participants