Skip to content

Return authorization list for SetCodeTx type #821

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

Merged
merged 2 commits into from
May 12, 2025

Conversation

m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented May 9, 2025

Description

As described in the specification: https://eip7702.io/#specification, the new SetCodeTx type, has an authorization list:

authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]

Example:

{
    address: '0x313af46a48eeb56d200fae0edb741628255d379f',
    chainId: 646,
    nonce: 4,
    r: '0xf4bc19cca28390f3628cfcda9076a8744b77cc87fa4f7745efa83b7a06cc3514',
    s: '0x1d736fecc68ee92ab6fd805d91a3e3dbf27097d3578561402d7105eeeee00bb7',
    yParity: 0
}

We need to include this information in the result of eth_getTransactionByHash JSON-RPC endpoint.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • New Features

    • Transactions now include an authorization list for enhanced detail and verification in supported transaction types.
  • Tests

    • Enhanced transaction tests with detailed validation of transaction properties, including authorization lists and cryptographic signatures, before receipt verification.

@m-Peter m-Peter self-assigned this May 9, 2025
@m-Peter m-Peter added Bug Something isn't working EVM Compatibility labels May 9, 2025
Copy link
Contributor

coderabbitai bot commented May 9, 2025

Walkthrough

The changes introduce support for an AuthorizationList in Ethereum transaction structures and interfaces, updating both backend Go code and frontend JavaScript tests. The Go code adds a new field and method for handling code authorizations, while the JavaScript tests are enhanced to fetch and assert detailed transaction data, especially focusing on the new authorization list for EIP-7702 type transactions.

Changes

File(s) Change Summary
eth/types/types.go Added AuthorizationList []types.SetCodeAuthorization field to the Transaction struct and updated the NewTransaction function to populate this field for transaction types beyond blob transactions. Added detailed comments explaining incremental field application based on transaction type.
models/transaction.go Extended the Transaction interface with a new method SetCodeAuthorizations() []gethTypes.SetCodeAuthorization. Implemented this method in the DirectCall struct, returning an empty slice.
tests/web3js/eth_eip_7702_contract_write_test.js
tests/web3js/eth_eip_7702_sending_transactions_test.js
Updated tests to first fetch transactions using publicClient.getTransaction({ hash }), then assert on transaction fields including from, type, input, and detailed authorizationList contents (signature components, nonce, chainId, address). Afterwards, fetched and asserted on transaction receipts. This adds more granular validation of transaction data for EIP-7702 transactions.

Sequence Diagram(s)

sequenceDiagram
    participant TestSuite as JavaScript Test
    participant PublicClient as publicClient
    participant Node as Ethereum Node

    TestSuite->>PublicClient: getTransaction({ hash })
    PublicClient->>Node: eth_getTransactionByHash
    Node-->>PublicClient: Transaction (with AuthorizationList)
    PublicClient-->>TestSuite: Transaction object

    TestSuite->>PublicClient: getTransactionReceipt({ hash })
    PublicClient->>Node: eth_getTransactionReceipt
    Node-->>PublicClient: Receipt
    PublicClient-->>TestSuite: Receipt object

    Note over TestSuite: Assert fields on transaction and receipt, including AuthorizationList
Loading

Suggested labels

Improvement

Suggested reviewers

  • peterargue
  • ramtinms

Poem

In fields of code where rabbits run,
A list of authorizations has begun.
Transactions now with secrets tight,
Are checked in tests, both day and night.
With every hop, a field appears—
Secure and clear, the code now cheers!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 c70035f and 3ceea86.

📒 Files selected for processing (4)
  • eth/types/types.go (4 hunks)
  • models/transaction.go (2 hunks)
  • tests/web3js/eth_eip_7702_contract_write_test.js (4 hunks)
  • tests/web3js/eth_eip_7702_sending_transactions_test.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • models/transaction.go
  • eth/types/types.go
  • tests/web3js/eth_eip_7702_contract_write_test.js
  • tests/web3js/eth_eip_7702_sending_transactions_test.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@@ -381,6 +382,10 @@ func NewTransaction(
result.BlobVersionedHashes = tx.BlobHashes()
}

if tx.Type() > types.BlobTxType {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this check here? And maybe add https://eip7702.io/#specification to the comments for reference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, the checks can be a bit difficult to grasp. Added some helpful comments in 3ceea86 .

@m-Peter m-Peter force-pushed the mpeter/display-set-code-tx-auth-list branch from c70035f to 3ceea86 Compare May 12, 2025 08:34
@@ -361,6 +363,29 @@ func NewTransaction(
size: tx.Size(),
}

// After the Pectra hard-fork, the full list of supported tx types is:
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the comments.

@j1010001 j1010001 merged commit be84e77 into main May 12, 2025
2 checks passed
@j1010001 j1010001 deleted the mpeter/display-set-code-tx-auth-list branch May 12, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Compatibility EVM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants