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(ctb): Allow for checkpointing in claim resolution #10248

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

clabby
Copy link
Member

@clabby clabby commented Apr 22, 2024

Overview

Introduces checkpointing to the resolveClaim function in the FaultDisputeGame, allowing for the pagination of subgame resolution.

Updated Semantics

resolveClaim now accepts a second argument, _numToResolve, which specifies how much the caller wants to advance the cursor. Providing 0 as _numToResolve, when no children have been checked yet, will imply that the contract should attempt to loop through the entire list of child subgames in a single callframe.

The off-chain actor can call getNumToResolve(uint256 _claimIndex) to retrieve the number of remaining children to be checked in order to resolve the subgame rooted at _claimIndex. This can directly be fed into resolveClaim as the _numToResolve parameter, or chopped up based on a heuristic of the maximum number of subgames the agent is willing to check during resolveClaim in one transaction.

Metadata
closes https://github.com/ethereum-optimism/client-pod/issues/756

Copy link
Member Author

clabby commented Apr 22, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @clabby and the rest of your teammates on Graphite Graphite

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.22%. Comparing base (d4b0129) to head (0e1d798).
Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10248       +/-   ##
============================================
- Coverage    42.40%   29.22%   -13.18%     
============================================
  Files           73       31       -42     
  Lines         4830     2898     -1932     
  Branches       766      614      -152     
============================================
- Hits          2048      847     -1201     
+ Misses        2676     1976      -700     
+ Partials       106       75       -31     
Flag Coverage Δ
cannon-go-tests ?
chain-mon-tests 27.14% <ø> (ø)
common-ts-tests ?
contracts-ts-tests 12.25% <ø> (ø)
core-utils-tests ?
sdk-tests 40.27% <ø> (ø)

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

see 42 files with indirect coverage changes

@clabby clabby force-pushed the cl/ctb/paginate-rez branch 2 times, most recently from 6d64318 to 6dfcb34 Compare April 22, 2024 18:16
@clabby clabby self-assigned this Apr 22, 2024
@clabby clabby marked this pull request as ready for review April 22, 2024 18:28
@clabby clabby requested a review from a team as a code owner April 22, 2024 18:28
@clabby clabby requested a review from maurelian April 22, 2024 18:28
Copy link
Contributor

coderabbitai bot commented Apr 22, 2024

Walkthrough

Walkthrough

The changes across the FaultDisputeGame contract and its related tests focus on enhancing claim resolution processes by introducing a new parameter _numToResolve and a ResolutionCheckpoint structure. These updates aim to improve the efficiency of handling multiple resolutions, with adjustments made to function calls and logic. Testing frameworks have also been updated to accommodate these changes.

Changes

File Path Summary of Changes
.../src/dispute/FaultDisputeGame.sol Updated version to "0.18.0", added resolutionCheckpoints, and revised resolveClaim to include _numToResolve. Added getNumToResolve function.
.../src/dispute/interfaces/IFaultDisputeGame.sol Added ResolutionCheckpoint struct. Modified resolveClaim to include _numToResolve.
.../test/L1/OptimismPortal2.t.sol Updated resolveClaim function calls to include an additional argument 0.
.../test/Specs.t.sol Replaced resolveClaim(uint256) with getNumToResolve(uint256) and resolveClaim(uint256,uint256).
.../test/dispute/FaultDisputeGame.t.sol Added tests for multi-part resolution, adjusted resolution processes, and enhanced testing under different conditions.
.../test/invariants/... Adjusted function call parameters to include new arguments, affecting claim resolution processes.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 55a83d5 and 0e1d798.
Files selected for processing (6)
  • op-challenger/game/fault/contracts/faultdisputegame.go (2 hunks)
  • op-challenger/game/fault/contracts/faultdisputegame_test.go (1 hunks)
  • op-e2e/actions/user.go (1 hunks)
  • op-e2e/e2eutils/disputegame/game_helper.go (1 hunks)
  • op-e2e/e2eutils/disputegame/output_game_helper.go (1 hunks)
  • op-e2e/withdrawal_helper.go (1 hunks)
Additional comments not posted (8)
op-e2e/withdrawal_helper.go (1)

208-208: Ensure the additional argument common.Big0 in ResolveClaim aligns with expected functionality.

Please verify that the introduction of common.Big0 as an argument in the ResolveClaim function call is aligned with the intended logic and does not alter the expected behavior of the function.

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

337-337: Ensure the additional argument common.Big0 in ResolveClaim aligns with expected functionality.

Please verify that the introduction of common.Big0 as an argument in the ResolveClaim function call is aligned with the intended logic and does not alter the expected behavior of the function.

op-challenger/game/fault/contracts/faultdisputegame_test.go (2)

253-253: Ensure the additional parameter maxChildChecks in CallResolveClaim aligns with expected functionality.

Please verify that the introduction of maxChildChecks as a parameter in the CallResolveClaim function call is aligned with the intended logic and does not alter the expected behavior of the function.


260-260: Ensure the additional parameter maxChildChecks in ResolveClaimTx aligns with expected functionality.

Please verify that the introduction of maxChildChecks as a parameter in the ResolveClaimTx function call is aligned with the intended logic and does not alter the expected behavior of the function.

op-challenger/game/fault/contracts/faultdisputegame.go (2)

21-22: The addition of the global variable maxChildChecks is correctly implemented.


414-414: The usage of maxChildChecks in the resolveClaimCall method is correctly implemented and aligns with the PR's objectives.

op-e2e/actions/user.go (1)

572-572: The addition of the argument common.Big0 in the ResolveClaim method is correctly implemented and aligns with the PR's objectives.

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

623-623: Ensure the use of common.Big0 aligns with the intended logic for subgame resolution.

Please verify that the use of common.Big0 as the second parameter in the ResolveClaim function call correctly implements the controlled resolution logic as intended by the PR objectives. If this value is meant to represent a default or initial state, consider adding a comment to clarify its purpose for future maintainability.


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: 1

Introduces checkpointing to the `resolveClaim` function in the
`FaultDisputeGame`, allowing for the pagination of subgame resolution.

fix
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: 1

Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

Looks great overall

* feat(challenger): Resolution checkpointing support

Adds support for resolution checkpointing

* op-challenger: Use a simple maximum number of child claims to resolve per call.

---------

Co-authored-by: Adrian Sutton <adrian@oplabs.co>
@clabby clabby requested a review from a team as a code owner April 23, 2024 12:15
@clabby clabby requested a review from geoknee April 23, 2024 12:15
@refcell refcell enabled auto-merge April 23, 2024 12:17
@refcell refcell requested review from ajsutton and removed request for geoknee and maurelian April 23, 2024 12:17
Copy link
Contributor

semgrep-app bot commented Apr 23, 2024

Semgrep found 13 sol-style-notice-over-dev-natspec findings:

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

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