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-plasma: track challenges when pipeline is stalled #9856

Merged

Conversation

tchardin
Copy link
Contributor

Description

This PR adds tracking of challenge state beyond the derivation pipeline origin. In the case where derivation is stalled due to missing data pending a challenge, we keep indexing challenge events related to future commitments. These challenges however will be ignored and evicted if they are never reattached to valid commitments in the batcher inbox.

Tests

  • Unit test state tracking for detached commitment
  • Add an e2e test reproducing unordered challenge events when the pipeline is stalled
  • Split finalisation test out of the reorg test so it is better tested in isolation
  • Update the sequencer params so they mirror default testing using larger DA challenge and resolve windows

Copy link
Contributor

coderabbitai bot commented Mar 14, 2024

Walkthrough

Walkthrough

The changes encompass enhancements in timing and block number parameters within a plasma test suite, improvements in challenge tracking and expiration logic, and optimizations in managing plasma data sources. Notably, there is a focus on handling sequencer stalls and finalization processes within plasma-based data availability (DA) windows. Logging and comments have been refined for clarity, and new test functions have been introduced to ensure robust challenge expiration and filter invalid block numbers effectively.

Changes

Files Change Summary
op-e2e/actions/plasma_test.go Adjusted timing and block numbers, refactored code, and added new test functions for sequencer scenarios and DA windows.
op-node/.../plasma_data_source.go Added a blank line before a conditional check for improved readability.
op-plasma/damgr.go, op-plasma/damgr_test.go Updated logging statements, revised comments for clarity, and added/modified test functions for challenge tracking and expiration.
op-plasma/dastate.go Introduced a new import, renamed and added fields in Commitment struct, and updated methods for enhanced challenge tracking and expiration logic.

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

op-e2e/actions/plasma_test.go Show resolved Hide resolved
op-e2e/actions/plasma_test.go Outdated Show resolved Hide resolved
op-e2e/actions/plasma_test.go Show resolved Hide resolved
Copy link
Contributor

@trianglesphere trianglesphere left a comment

Choose a reason for hiding this comment

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

Tests look fine, but the logic in the da mgr / da state is kinda complex & I think subtly broken.

I think to make it clearer, we should maintain two queues (that also have a map to check for set membership). One should be for the commitments we see on L1, the other should be for the challenges we see on L1. When we expire a commitment, we can check the challenges to see if one is around & vice-versa.

Or maybe we even need to go up to three queues: unchallenged comms, challenges, & challenged comms. Right now the canonical boolean is tricky & the multiple entrypoints to storing data are hard to reason about.

op-plasma/dastate.go Show resolved Hide resolved
op-plasma/dastate.go Outdated Show resolved Hide resolved
Copy link
Contributor

@trianglesphere trianglesphere left a comment

Choose a reason for hiding this comment

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

This looks like it's properly tracking the challenges to me.

auto-merge was automatically disabled March 15, 2024 19:53

Head branch was pushed to by a user without write access

@axelKingsley axelKingsley enabled auto-merge March 18, 2024 14:04
@axelKingsley axelKingsley requested a review from tynes March 18, 2024 20:22
@axelKingsley axelKingsley added this pull request to the merge queue Mar 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2024
@axelKingsley axelKingsley added this pull request to the merge queue Mar 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 18, 2024
@axelKingsley axelKingsley added this pull request to the merge queue Mar 19, 2024
Merged via the queue into ethereum-optimism:develop with commit f3d0102 Mar 19, 2024
70 checks passed
carterqw2 pushed a commit to celo-org/optimism that referenced this pull request May 29, 2024
…sm#9856)

* fix: track challenges when pipeline is stalled

* cleanup

* fix: remove tx version byte in test

* remove Heap usage

* fix: add pending queue

* remove unused check

* use 2 PQs

* Update comment in op-e2e/actions/plasma_test.go

Co-authored-by: Joshua Gutow <[email protected]>

---------

Co-authored-by: Joshua Gutow <[email protected]>
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.

6 participants