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

EIP4844: Add single minimal e2e test. #8115

Merged
merged 9 commits into from
Dec 4, 2023
Merged

Conversation

EvanJRichard
Copy link
Contributor

@EvanJRichard EvanJRichard commented Nov 9, 2023

Description

As an intermediate step to #8104 and therefore #7349, this PR aims to add a minimal system test that starts a Cancun-compatible L1, sends a blob-containing transaction on that L1, and ensures the L2 can finalize against that L1.

Tests

The test is called TestSystemE2EDencunAtGenesisWithBlobs in system_test.go.

Metadata
Builds on top of #8131

@EvanJRichard EvanJRichard self-assigned this Nov 9, 2023
@trianglesphere trianglesphere self-requested a review November 9, 2023 19:31
@EvanJRichard EvanJRichard mentioned this pull request Nov 9, 2023
3 tasks
op-e2e/system_test.go Outdated Show resolved Hide resolved
@EvanJRichard
Copy link
Contributor Author

op-e2e/system_test.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
@EvanJRichard EvanJRichard marked this pull request as ready for review November 15, 2023 23:24
@EvanJRichard EvanJRichard requested a review from a team as a code owner November 15, 2023 23:24
@EvanJRichard
Copy link
Contributor Author

Rebased off of develop per conversation with @clabby.

@EvanJRichard EvanJRichard requested review from trianglesphere and removed request for trianglesphere November 16, 2023 15:58
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.

Core of the test looks good. Two questions about making it slightly nicer.

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

semgrep-app bot commented Nov 21, 2023

Semgrep found 1 sol-style-notice-over-dev-natspec finding:

  • packages/contracts-bedrock/src/L1/SystemConfig.sol: L252

Prefer @dev over @notice in natspec comments

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

Semgrep found 1 sol-style-input-arg-fmt finding:

  • packages/contracts-bedrock/scripts/ChainAssertions.sol: L75

Inputs to functions must be prepended with an underscore (_)

Ignore this finding from sol-style-input-arg-fmt.

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

Code looks ok, but would squash (and rebase) the commits before merging, it's a lot for what are pretty isolated changes.

@sebastianst
Copy link
Member

Code looks ok, but would squash (and rebase) the commits before merging, it's a lot for what are pretty isolated changes.

The diff also shows merged changes from other PRs like #8196, squash+rebase should help!

@EvanJRichard
Copy link
Contributor Author

@protolambda @sebastianst Got it - squashed commit history into a single commit based off current develop HEAD.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2023

Walkthrough

Walkthrough

The changes involve updates to Ethereum end-to-end testing utilities and the fake proof-of-stake (PoS) implementation. A new version of payload and fork choice update methods (GetPayloadV3 and ForkchoiceUpdatedV3) have been introduced in the fake PoS. Additionally, a new package for creating Ethereum transactions with blob data has been added, which includes cryptographic operations from the kzg4844 package. A new system test function has been added to verify L2 finalization with the presence of blobs on L1.

Changes

File Path Change Summary
op-e2e/e2eutils/geth/fakepos.go Updated methods from GetPayloadV2 to GetPayloadV3 and from ForkchoiceUpdatedV2 to ForkchoiceUpdatedV3.
op-e2e/e2eutils/transactions/blobs.go Added new transactions package with CreateEmptyBlobTx function and global variables for cryptographic operations.
op-e2e/system_test.go Added imports for gethutils and transactions. Added new test function TestSystemE2EDencunAtGenesisWithBlobs.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

Copy link
Contributor

semgrep-app bot commented Nov 27, 2023

Semgrep found 7 sol-style-input-arg-fmt findings:

Inputs to functions must be prepended with an underscore (_)

Ignore this finding from sol-style-input-arg-fmt.

Semgrep found 1 writable-filesystem-service finding:

  • ops-bedrock/docker-compose.yml: L14

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

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.

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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c9eb360 and 01528a3.
Files selected for processing (3)
  • op-e2e/e2eutils/geth/fakepos.go (2 hunks)
  • op-e2e/e2eutils/transactions/blobs.go (1 hunks)
  • op-e2e/system_test.go (2 hunks)
Additional comments: 6
op-e2e/e2eutils/geth/fakepos.go (3)
  • 138-144: The GetPayloadV3 method is used to retrieve the payload for the new block. Ensure that the rest of the system is compatible with the V3 payload structure and that any necessary migrations or updates have been made.

  • 178-184: The ForkchoiceUpdatedV3 method is called without attributes, which is different from the previous call to ForkchoiceUpdatedV2 that included attrs. Ensure that this change is intentional and that the system's logic is correctly updated to reflect the absence of attributes in the V3 method call.

  • 181-184: The ForkchoiceUpdatedV3 method is used to update the fork choice state. Ensure that the new block hash, safe block hash, and finalized block hash are correctly calculated and that the rest of the system is compatible with these changes.

op-e2e/e2eutils/transactions/blobs.go (1)
  • 38-40: The use of the withSidecar flag to conditionally include a sidecar in the transaction is clear and follows good practice.
op-e2e/system_test.go (2)
  • 31-38: The new imports gethutils and transactions are correctly added and used in the new test function TestSystemE2EDencunAtGenesisWithBlobs.

  • 176-218: The test function TestSystemE2EDencunAtGenesisWithBlobs is well-structured and follows best practices for writing tests in Go. It includes proper error handling for external calls, such as sending transactions and waiting for blocks, and does not appear to have any data races or concurrency issues. The test function is maintainable and not overly complex, and there is no dead or unnecessary code present.

op-e2e/e2eutils/transactions/blobs.go Outdated Show resolved Hide resolved
op-e2e/e2eutils/transactions/blobs.go Show resolved Hide resolved
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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 01528a3 and fea5d29.
Files selected for processing (1)
  • op-e2e/e2eutils/transactions/blobs.go (1 hunks)

op-e2e/e2eutils/transactions/blobs.go Show resolved Hide resolved
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 30, 2023
@EvanJRichard
Copy link
Contributor Author

Merge queue status check failed, rebasing....

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d696e95 and f148caf.
Files selected for processing (3)
  • op-e2e/e2eutils/geth/fakepos.go (2 hunks)
  • op-e2e/e2eutils/transactions/blobs.go (1 hunks)
  • op-e2e/system_test.go (2 hunks)
Additional comments: 9
op-e2e/e2eutils/geth/fakepos.go (4)
  • 141-141: The summary states that GetPayloadV2 was changed to GetPayloadV3 at line 138, but the change is actually at line 141. Please update the summary to reflect the correct line number for this change.

  • 181-181: The summary states that ForkchoiceUpdatedV2 was replaced with ForkchoiceUpdatedV3 at line 178, but the change is actually at line 181. Please update the summary to reflect the correct line number for this change.

  • 138-144: The change from GetPayloadV2 to GetPayloadV3 is correctly implemented and aligns with the pull request description.

  • 178-184: The change from ForkchoiceUpdatedV2 to ForkchoiceUpdatedV3 is correctly implemented and aligns with the pull request description.

op-e2e/system_test.go (5)
  • 31-38: The import additions are correctly placed and necessary for the new functionality.

  • 176-210: The new test TestSystemE2EDencunAtGenesisWithBlobs is added to verify L2 block finalization when blob-containing transactions are present on L1.

  • 190-191: Using a hardcoded private key in a test environment is acceptable.

  • 189-210: The test sends a blob-containing transaction and waits for it to be included in a block on L1, then checks for the finalization on L2.

  • 176-210: The test TestSystemE2EDencunAtGenesisWithBlobs does not have any logic issues.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f148caf and 5c43ad0.
Files selected for processing (1)
  • op-e2e/system_test.go (2 hunks)
Additional comments: 2
op-e2e/system_test.go (2)
  • 31-37: The import additions look good and are consistent with the summary.

  • 176-210: The new test function TestSystemE2EDencunAtGenesisWithBlobs is consistent with the summary and appears to be logically correct, testing L2 finalization with blob-containing transactions on L1.

@trianglesphere trianglesphere added this pull request to the merge queue Nov 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 30, 2023
@trianglesphere
Copy link
Contributor

lint failed after the merge in from develop @EvanJRichard

@EvanJRichard EvanJRichard added this pull request to the merge queue Dec 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 1, 2023
@mslipper mslipper added this pull request to the merge queue Dec 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 1, 2023
EvanJRichard and others added 9 commits November 30, 2023 20:14
…show up on L2. Then, wait for that block to be finalized.
Per code rabbit AI.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
per trianglesphere, double var causes miscompilation

Co-authored-by: Joshua Gutow <jgutow@oplabs.co>
per protolambda

Co-authored-by: protolambda <proto@protolambda.com>
@EvanJRichard EvanJRichard added this pull request to the merge queue Dec 4, 2023
Merged via the queue into develop with commit fbfec7e Dec 4, 2023
1 check passed
@EvanJRichard EvanJRichard deleted the eip4844-e2e-minimal branch December 4, 2023 20:24
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.

4 participants