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: Implement fjord RLP & Channel Bank Size limit Increases #10357

Merged
merged 2 commits into from
May 7, 2024

Conversation

trianglesphere
Copy link
Contributor

@trianglesphere trianglesphere commented Apr 30, 2024

Description

Implements ethereum-optimism/specs#165 & ethereum-optimism/specs#170 in the op-node.

I made several changes to span batch parsing which I believe to be spec compliant.

  • The span batch size is no longer checked inside the span batch parsing code. The limit is enforced at the RLP reader level.
  • The buffers allocated by bitfields are no longer checked for size. When looking at the code, we always pass in a size limited field as the bitlength (specifically a field which is limited to MAX_SPAN_BATCH_ELEMENT_COUNT). That means that the largest buffer possible to allocate is 1.25 million bytes while the code was checking against a size limit of 10 million bytes.

Tests

I added chain spec tests. No tests inside the channel bank / channel reader; however I made the old constant private so they can only be accessed through these function.

Metadata

op-node/rollup/derive/params.go Outdated Show resolved Hide resolved
op-node/rollup/derive/channel_bank.go Outdated Show resolved Hide resolved
op-node/rollup/derive/channel_in_reader.go Outdated Show resolved Hide resolved
This also creates a ChainSpec object which is responsible for returning protocol
parameters. We use a different object than the rollup.Config because the config
is primarily a disk representation & does not concern itself with protocol constants.
@trianglesphere trianglesphere force-pushed the jg/impl_fjord_increases branch from a919df5 to aa5a062 Compare May 6, 2024 22:57
Copy link
Contributor

semgrep-app bot commented May 6, 2024

Semgrep found 1 writable-filesystem-service finding:

  • ops-bedrock/docker-compose.yml

Service 'op_stack_go_builder' is running with a writable root filesystem. This may allow malicious applications to download and run additional payloads, or modify container files. If an application inside a container has to save something temporarily consider using a tmpfs. Add 'read_only: true' to this service to prevent this.

Ignore this finding from writable-filesystem-service.

Semgrep found 1 no-new-privileges finding:

  • ops-bedrock/docker-compose.yml

Service 'op_stack_go_builder' allows for privilege escalation via setuid or setgid binaries. Add 'no-new-privileges:true' in 'security_opt' to prevent this.

Ignore this finding from no-new-privileges.

@trianglesphere trianglesphere marked this pull request as ready for review May 6, 2024 23:01
@trianglesphere trianglesphere requested review from protolambda, ajsutton and a team as code owners May 6, 2024 23:01
Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

Walkthrough

The changes across multiple files involve transitioning from derive.MaxRLPBytesPerChannel to rollup.SafeMaxRLPBytesPerChannel and integrating rollup.ChainSpec for enhanced safety and updated configurations. These modifications impact channel capacities, batch sizes, and configuration handling within the system, aligning them with current standards.

Changes

File Path Change Summary
.../batcher/channel_builder_test.go Updated MaxFrameSize calculation using rollup.SafeMaxRLPBytesPerChannel.
.../actions/garbage_channel_out.go Changed maximum RLP bytes comparison to use rollup.SafeMaxRLPBytesPerChannel.
.../batchbuilding_test.go, .../chain_spec.go, .../chain_spec_test.go Updated references and added new configurations and tests related to rollup specifications.
.../cmd/batch_decoder/... Adjusted function calls and parameters to include rollupCfg and added necessary imports.
.../rollup/derive/... Numerous updates in handling configurations, batch sizes, and channel operations, transitioning from old constants to new rollup configurations and safety measures.
.../rollup/derive/span_batch... Updated limits and checks for batch sizes and elements, ensuring adherence to new MaxSpanBatchElementCount and MaxSpanBatchBitLength.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 15e8387 and a8e5714.
Files selected for processing (17)
  • op-batcher/batcher/channel_builder_test.go (1 hunks)
  • op-e2e/actions/garbage_channel_out.go (1 hunks)
  • op-node/benchmarks/batchbuilding_test.go (2 hunks)
  • op-node/cmd/batch_decoder/main.go (1 hunks)
  • op-node/cmd/batch_decoder/reassemble/reassemble.go (5 hunks)
  • op-node/rollup/chain_spec.go (1 hunks)
  • op-node/rollup/chain_spec_test.go (1 hunks)
  • op-node/rollup/derive/channel.go (2 hunks)
  • op-node/rollup/derive/channel_bank.go (7 hunks)
  • op-node/rollup/derive/channel_in_reader.go (2 hunks)
  • op-node/rollup/derive/channel_out.go (1 hunks)
  • op-node/rollup/derive/params.go (1 hunks)
  • op-node/rollup/derive/span_batch.go (6 hunks)
  • op-node/rollup/derive/span_batch_test.go (2 hunks)
  • op-node/rollup/derive/span_batch_txs.go (2 hunks)
  • op-node/rollup/derive/span_batch_util.go (2 hunks)
  • op-node/rollup/derive/span_channel_out.go (1 hunks)
Files skipped from review as they are similar to previous changes (16)
  • op-batcher/batcher/channel_builder_test.go
  • op-e2e/actions/garbage_channel_out.go
  • op-node/benchmarks/batchbuilding_test.go
  • op-node/cmd/batch_decoder/main.go
  • op-node/cmd/batch_decoder/reassemble/reassemble.go
  • op-node/rollup/chain_spec.go
  • op-node/rollup/chain_spec_test.go
  • op-node/rollup/derive/channel.go
  • op-node/rollup/derive/channel_bank.go
  • op-node/rollup/derive/channel_in_reader.go
  • op-node/rollup/derive/channel_out.go
  • op-node/rollup/derive/params.go
  • op-node/rollup/derive/span_batch.go
  • op-node/rollup/derive/span_batch_test.go
  • op-node/rollup/derive/span_batch_util.go
  • op-node/rollup/derive/span_channel_out.go
Additional comments not posted (2)
op-node/rollup/derive/span_batch_txs.go (2)

50-52: The implementation correctly checks for batch size limits to prevent processing overly large batches, aligning with the PR's objectives.


69-71: The addition of batch size checks for legacy transactions is a prudent measure to ensure system stability under increased load.


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

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

20-25: Ensure the transition from Config to ChainSpec in ChannelInReader does not affect functionality.

The structural change to use ChainSpec should be carefully tested to ensure that it integrates well with existing functionalities and does not introduce regressions.

op-node/rollup/chain_spec.go Outdated Show resolved Hide resolved
op-node/rollup/chain_spec.go Show resolved Hide resolved
@trianglesphere trianglesphere force-pushed the jg/impl_fjord_increases branch from aa5a062 to 8cb879b Compare May 6, 2024 23:50
@trianglesphere trianglesphere requested a review from sebastianst May 6, 2024 23:53
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: 0

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

Line range hint 9-9: Update the function comment to reflect the actual behavior or constraints.

The comment mentions MaxSpanBatchSize, which is not used in the function. Consider updating the comment to avoid confusion.


Line range hint 25-25: Update the function comment to reflect the actual behavior or constraints.

The comment mentions MaxSpanBatchSize, which is not used in the function. Consider updating the comment to avoid confusion.

@trianglesphere trianglesphere force-pushed the jg/impl_fjord_increases branch from 8cb879b to a8e5714 Compare May 7, 2024 00:03
Copy link
Member

@sebastianst sebastianst left a comment

Choose a reason for hiding this comment

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

LGTM, I like the introduction of a spec.

I have a few open questions that might lead to changes.

If we consume only an interface of the spec (or even only the value getters from the spec that we need), it might become easier in tests to set low values, as the spec can then be mocked.

op-node/rollup/derive/span_batch.go Show resolved Hide resolved
op-node/rollup/derive/span_batch.go Show resolved Hide resolved
op-node/rollup/derive/span_batch_txs.go Show resolved Hide resolved
op-node/rollup/derive/span_batch_util.go Show resolved Hide resolved
@protolambda protolambda added this pull request to the merge queue May 7, 2024
Merged via the queue into develop with commit 4386680 May 7, 2024
68 of 69 checks passed
@protolambda protolambda deleted the jg/impl_fjord_increases branch May 7, 2024 18: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.

3 participants