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

feat: add set code tx support #43

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open

Conversation

colinlyguo
Copy link
Member

@colinlyguo colinlyguo commented Feb 20, 2025

Purpose or design rationale of this PR

This PR adds set code tx support in the convertTxDataToRLPEncoding function.
Could change the commit of the l2geth dependency after the l2geth pr is merged.

PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • feat: A new feature

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change

Summary by CodeRabbit

  • New Features
    • Enhanced transaction processing by adding explicit support for a new transaction type related to code setting.
  • Bug Fixes
    • Improved handling for scenarios with empty input data to now produce a validated output rather than an error.
  • Chores
    • Upgraded underlying dependencies for improved performance and stability.

jonastheis and others added 30 commits December 27, 2024 12:14
 Conflicts:
	encoding/da.go
	encoding/interfaces.go
	go.mod
	go.sum
Copy link

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request updates the handling of "no blocks" test cases in CodecV7 by replacing an error expectation with a specific hash verification in two test functions. It also adjusts a comment alignment in the encoding types file, introduces a distinct handling case for the SetCodeTxType in transaction encoding, and updates dependency versions in the go.mod file. These changes collectively alter test expectations, refine comment formatting, extend transaction processing functionality, and update module dependencies.

Changes

File(s) Change Summary
encoding/codecv7_test.go Updated test cases for "no blocks": replaced creationErr: "no blocks" with an expectedBlobVersionedHash field for both compression enabled and disabled scenarios.
encoding/codecv7_types.go Adjusted comment formatting for the prevL1MessageQueueHash field by removing an extra space for alignment consistency.
encoding/da.go Introduced a new case in convertTxDataToRLPEncoding to handle SetCodeTxType. Constructs a new SetCodeTx transaction using types.NewTx with various fields converted as required.
go.mod Updated dependency github.com/scroll-tech/go-ethereum to a newer commit version and modified github.com/holiman/uint256 status from indirect to direct dependency.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Converter
    participant TxFactory

    Client->>Converter: Provide txData with SetCodeTxType
    Converter->>TxFactory: Call types.NewTx with parsed txData fields
    TxFactory-->>Converter: Return constructed SetCodeTx transaction
    Converter-->>Client: Return finalized transaction
Loading

Possibly related PRs

Suggested reviewers

  • jonastheis
  • Thegaram

Poem

I hopped through code with nimble pace,
Fixing tests with a gentle grace.
Comments aligned, new cases in sight,
Transactions born in the morning light.
Dependencies updated for a smoother ride—
Carrots and code, side by side!
🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ace506 and 6ab79d4.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • encoding/codecv7_test.go (2 hunks)
  • encoding/codecv7_types.go (1 hunks)
  • encoding/da.go (2 hunks)
  • go.mod (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • encoding/codecv7_types.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: tests
🔇 Additional comments (5)
encoding/da.go (1)

265-280:

❓ Verification inconclusive

LGTM! The SetCodeTxType implementation looks correct.

The implementation properly handles all required fields and follows the established pattern for transaction type handling. The use of uint256.MustFromBig ensures safe conversion of big integers to uint256.

Run the following script to verify that the SetCodeTxType is properly defined in the go-ethereum dependency:


🏁 Script executed:

#!/bin/bash
# Description: Verify that SetCodeTxType is properly defined in go-ethereum.

# Search for SetCodeTxType definition
ast-grep --pattern 'const SetCodeTxType = $_'

Length of output: 47


Action Required: Manual Verification for SetCodeTxType Definition

The implementation in encoding/da.go for handling the SetCodeTxType appears correct and follows the established pattern. However, the automated search using ast-grep --pattern 'const SetCodeTxType = $_' did not return any output, making it inconclusive whether SetCodeTxType is defined as expected in the go-ethereum dependency.

  • Next Steps: Please manually verify that the SetCodeTxType constant is correctly defined in the go-ethereum dependency. This will ensure that the dependency properly provides the constant required by the implementation.
encoding/codecv7_test.go (2)

412-415: Test case updated to handle empty batches correctly.

The test case for "no blocks" scenario has been updated to expect a specific hash instead of an error, indicating a change in how empty batches are handled in compression-enabled mode.


556-559: Test case updated to handle empty batches correctly.

The test case for "no blocks" scenario has been updated to expect a specific hash instead of an error, indicating a change in how empty batches are handled in compression-disabled mode.

go.mod (2)

21-21: LGTM! Direct dependency on uint256 is appropriate.

The github.com/holiman/uint256 package is now correctly marked as a direct dependency, which aligns with its usage in the SetCodeTxType implementation.


7-7:

❓ Verification inconclusive

Verify the go-ethereum dependency update.

The go-ethereum dependency has been updated to a newer version. This update might be related to the SetCodeTxType support.


🌐 Web query:

What are the changes in go-ethereum version v1.10.14-0.20250220125731-2dde0c79d2a1?

💡 Result:

The specific version v1.10.14-0.20250220125731-2dde0c79d2a1 appears to be a pseudo-version identifier used in Go module dependency management (common for unreleased or intermediate commits). Based on the provided search results:

  1. No direct match exists for this exact pseudo-version in the listed sources.
  2. The format breaks down as:
    • v1.10.14: Base version.
    • 0: Indicates a pre-release or commit count.
    • 20250220125731: Timestamp (likely February 20, 2025, at 12:57:31 UTC).
    • 2dde0c79d2a1: Commit hash prefix.

Key Observations:

  • Go-Ethereum’s release history (from sources [1], [4], [8]) shows newer versions (e.g., v1.14.x to v1.15.x) but does not explicitly list v1.10.x releases beyond general references to older maintenance updates.
  • Pseudo-versions like this typically represent unreleased intermediary commits between tagged releases.

Recommendations:

For context, major changes around later versions (e.g., database schema updates in v1.15.x or security fixes in v1.14.x) are documented in sources [1][4][7], but they do not apply to this specific pseudo-version query¹⁰⁾⁸⁾⁷⁾⁴⁾¹⁾.

Citations:


Confirm Updated go-ethereum Dependency

The go.mod file now references the pseudo-version:

	github.com/scroll-tech/go-ethereum v1.10.14-0.20250220125731-2dde0c79d2a1

This version is derived from a specific commit (hash 2dde0c79d2a1, timestamped February 20, 2025) and does not represent a standard tagged release. It appears that this update might be linked to the SetCodeTxType support. Please verify the following:

  • Confirm that the commit referenced by 2dde0c79d2a1 in the go-ethereum repository indeed introduces the intended SetCodeTxType support and any related changes.
  • Ensure that the dependency update does not introduce any unintended compatibility issues.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

@Thegaram Thegaram left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Let's merge after your 7702 PR was merged.

@colinlyguo
Copy link
Member Author

Looks good, thanks! Let's merge after your 7702 PR was merged.

makes sense.

jonastheis
jonastheis previously approved these changes Feb 20, 2025
Base automatically changed from feat/codec-v6 to main February 21, 2025 09:30
@Thegaram Thegaram dismissed jonastheis’s stale review February 21, 2025 09:30

The base branch was changed.

@Thegaram Thegaram closed this Feb 21, 2025
@Thegaram Thegaram reopened this Feb 21, 2025
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.

5 participants