optimism icon indicating copy to clipboard operation
optimism copied to clipboard

op-node: Add dedicated PlasmaConfig struct to rollup.Config

Open trianglesphere opened this issue 1 year ago • 1 comments

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.

Tests

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

Metadata

  • Fixes https://github.com/ethereum-optimism/optimism/issues/10472

trianglesphere avatar May 10 '24 22:05 trianglesphere

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 71dbd3843d58d81190c894b7f960de738aef9b1e and b093a5234a80bda70c6466021b0ca7759448b9fe.
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.

coderabbitai[bot] avatar May 10 '24 22:05 coderabbitai[bot]

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

trianglesphere avatar May 13 '24 16:05 trianglesphere

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

codecov[bot] avatar May 13 '24 16:05 codecov[bot]