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-node: Add dedicated PlasmaConfig struct to rollup.Config #10499

Merged
merged 3 commits into from May 16, 2024

Conversation

trianglesphere
Copy link
Contributor

@trianglesphere trianglesphere commented May 10, 2024

Description

This commit adds a dedicated PlasmaConfig section to the rollup config. This collects all Plasma Mode configuration to the same place and enables future expansion of Plasma Mode configuration to be confined to a single location.

In the interim, the op-node can read from both the legacy fields and the dedicated struct. If both are set, they must be consistent. The genesis creation tooling currently only writes with the new config.

This also updates to a new version of the superchain registry to enable Plasma Mode chains in the superchain registry to properly set the rollup config when configured by the superchain flag name.

Tests

Tested locally & the output JSON looks good. Unfortunately omitempty does not work on the address type.

Metadata

Copy link
Contributor

coderabbitai bot commented May 10, 2024

Walkthrough

Walkthrough

The recent code changes focus on restructuring the handling of Plasma configurations by introducing a new PlasmaConfig struct to streamline all Plasma-related settings. This restructuring enhances modularity and clarity in managing Plasma configurations across various files in the codebase.

Changes

File Path Change Summary
op-chain-ops/genesis/config.go, op-e2e/e2eutils/setup.go Updated to initialize and assign PlasmaConfig struct based on conditions.
op-e2e/actions/plasma_test.go, op-node/node/node.go Method and field access modified to use new PlasmaConfig methods and structure.
op-node/rollup/types.go Introduced PlasmaConfig struct, migrated related fields, added validation and accessor methods.
op-e2e/e2eutils/setup.go, op-node/rollup/derive/data_source.go, op-node/rollup/derive/engine_queue.go, op-node/rollup/derive/engine_queue_test.go Updated to utilize PlasmaEnabled() method for Plasma activation logic and configuration parameter access.
op-node/rollup/chain_spec_test.go, op-node/rollup/derive/plasma_data_source_test.go Replaced UsePlasma field with PlasmaConfig struct for handling DAChallengeWindow and DAResolveWindow.
op-node/rollup/derive/pipeline.go Updated finalization condition based on Plasma activation status.
op-node/rollup/derive/plasma_data_source_test.go Replaced UsePlasma with PlasmaConfig and LegacyUsePlasma in test cases.
op-node/rollup/superchain.go Added code to initialize a PlasmaConfig struct based on certain conditions.

Assessment against linked issues

Objective Addressed Explanation
Modify rollup.Config to have a dedicated Plasma sub-config (#10472) The introduction of the PlasmaConfig struct and its integration into rollup.Config aligns directly with the objective, centralizing Plasma-related settings into a dedicated sub-configuration.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 71dbd38 and b093a52.
Files ignored due to path filters (4)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum
  • op-ufm/go.mod is excluded by !**/*.mod
  • op-ufm/go.sum is excluded by !**/*.sum
Files selected for processing (12)
  • op-chain-ops/genesis/config.go (2 hunks)
  • op-e2e/actions/plasma_test.go (3 hunks)
  • op-e2e/e2eutils/setup.go (2 hunks)
  • op-node/node/node.go (1 hunks)
  • op-node/rollup/chain_spec_test.go (1 hunks)
  • op-node/rollup/derive/data_source.go (1 hunks)
  • op-node/rollup/derive/engine_queue.go (1 hunks)
  • op-node/rollup/derive/engine_queue_test.go (1 hunks)
  • op-node/rollup/derive/pipeline.go (1 hunks)
  • op-node/rollup/derive/plasma_data_source_test.go (3 hunks)
  • op-node/rollup/superchain.go (2 hunks)
  • op-node/rollup/types.go (5 hunks)
Files skipped from review as they are similar to previous changes (12)
  • op-chain-ops/genesis/config.go
  • op-e2e/actions/plasma_test.go
  • op-e2e/e2eutils/setup.go
  • op-node/node/node.go
  • op-node/rollup/chain_spec_test.go
  • op-node/rollup/derive/data_source.go
  • op-node/rollup/derive/engine_queue.go
  • op-node/rollup/derive/engine_queue_test.go
  • op-node/rollup/derive/pipeline.go
  • op-node/rollup/derive/plasma_data_source_test.go
  • op-node/rollup/superchain.go
  • op-node/rollup/types.go

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

Out of diff range and nitpick comments (2)
op-node/rollup/derive/engine_queue.go (1)

144-145: Ensure the calculation logic in calcFinalityLookback is well-documented for maintainability.

Consider adding a comment explaining how the finality lookback is calculated when Plasma mode is enabled, as this could help future developers understand the logic more quickly.

op-node/rollup/derive/engine_queue_test.go (1)

1253-1255: Ensure consistent naming for configuration fields.

The naming convention for configuration fields should be consistent. Consider renaming BlockTime and SeqWindowSize to follow a similar pattern as DAChallengeWindow and DAResolveWindow, such as BlockTimeWindow and SequenceWindowSize.

op-node/node/node.go Show resolved Hide resolved
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

CI apparently said no:

testing.tRunner.func1.2({0x1dfd2a0, 0x40b1d60})
        /usr/local/go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1548 +0x397
panic({0x1dfd2a0?, 0x40b1d60?})
        /usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/ethereum-optimism/optimism/op-node/rollup.(*Config).GetOPPlasmaConfig(0xc0034b6050)
        /root/project/op-node/rollup/types.go:452 +0x3c
github.com/ethereum-optimism/optimism/op-node/node.(*OpNode).initL2(0xc000324ea0, {0x306d560, 0x45f7280}, 0xc0034b6000, {0x30812b0, 0xc002206190})
        /root/project/op-node/node/node.go:390 +0x33f
github.com/ethereum-optimism/optimism/op-node/node.(*OpNode).init(0xc000324ea0, {0x306d560, 0x45f7280}, 0xc0034b6000, {0x30812b0, 0xc002206190})
        /root/project/op-node/node/node.go:131 +0x1de
github.com/ethereum-optimism/optimism/op-node/node.New({0x306d560, 0x45f7280}, 0xc0034b6000, {0x3081418, 0xc001e08630}, {0x30812b0, 0xc002206190}, {0x0, 0x0}, 0xc00340ef00)

@trianglesphere trianglesphere force-pushed the jg/plasma_config branch 2 times, most recently from d4ceb3b to 226aeef Compare May 13, 2024 15:54
@trianglesphere
Copy link
Contributor Author

I should have fixed CI. This also now sets the local plasma config from the superchain plasma config

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.92%. Comparing base (fa88d9c) to head (b093a52).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10499       +/-   ##
============================================
+ 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

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

LGTM.

op-node/rollup/types.go Show resolved Hide resolved
@trianglesphere trianglesphere added this pull request to the merge queue May 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2024
@trianglesphere trianglesphere added this pull request to the merge queue May 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2024
This commit adds a dedicated PlasmaConfig section to the rollup
config. This collects all Plasma Mode configuration to the same place
and enables future expansion of Plasma Mode configuration to be confined
to a single location.

In the interim, the op-node can read from both the legacy fields and the
dedicated struct. If both are set, they must be consistent. The genesis
creation tooling currently only writes with the new config.
@trianglesphere trianglesphere added this pull request to the merge queue May 16, 2024
Merged via the queue into develop with commit fc0f425 May 16, 2024
72 checks passed
@trianglesphere trianglesphere deleted the jg/plasma_config branch May 16, 2024 09:44
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.

Modify rollup.Config to have a dedicated Plasma sub-config
3 participants