Skip to content

Back-port EVM Pectra hard-fork to soft finality#816

Merged
j1010001 merged 10 commits into
mpeter/poc-index-finalized-block-resultsfrom
feature/pectra-upgrade-soft-finality-backport
May 8, 2025
Merged

Back-port EVM Pectra hard-fork to soft finality#816
j1010001 merged 10 commits into
mpeter/poc-index-finalized-block-resultsfrom
feature/pectra-upgrade-soft-finality-backport

Conversation

@m-Peter
Copy link
Copy Markdown
Collaborator

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

Work towards: onflow/flow-go#7152

Description

Back-port #805 to soft finality branch.


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

    • Added support for new Ethereum transaction types, including Blob and SetCode transactions, and expanded transaction argument fields.
    • Introduced new test suites for EIP-7702 transaction flows, Pectra upgrade scenarios, and contract interactions using viem and web3.js.
    • Added a new Solidity contract and supporting configuration for viem-based tests.
  • Improvements

    • Unified and improved handling of special block numbers and block tags.
    • Enhanced accuracy of logs bloom filter computation at both transaction and block levels.
    • Streamlined transaction argument processing for contract calls and gas estimation.
    • Expanded and updated test coverage for contract deployment, gas estimates, and debug tracing.
  • Bug Fixes

    • Corrected block override field naming and handling in debug trace tests and logic.
  • Dependency Updates

    • Upgraded Go toolchain version and refreshed multiple dependencies for stability and compatibility.
    • Added new dependencies for enhanced Ethereum and Flow EVM support.
  • Documentation

    • Updated documentation for supported block tags and transaction types in public APIs.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update centralizes and refines block number handling, enhances transaction argument processing to support new Ethereum transaction types, and improves logs bloom filter computation. It introduces new constants for special block numbers, updates API and internal method signatures, and adds comprehensive tests for EIP-7702 and pre-Pectra upgrade scenarios. Several dependencies are also upgraded.

Changes

File(s) Change Summary
api/api.go, api/utils.go, models/block.go Unified and refactored block number resolution logic, added new special block number constants, and updated documentation and handling for these values.
api/api.go, api/debug.go, services/requester/requester.go Updated transaction handling to use a new ToTransaction method, removed encodeTxFromArgs, and improved type usage (map[string]any).
api/stream.go, models/receipt.go, models/transaction.go, services/logs/filter_test.go Changed logs bloom filter computation to operate on receipts rather than logs, added receipt conversion methods, and updated bloom creation calls.
eth/types/types.go Added support for Blob and SetCode transaction types, new fields in TransactionArgs, and a method to convert arguments to transactions.
api/debug.go, services/replayer/blocks_provider_test.go, services/replayer/call_tracer_collector.go, bootstrap/bootstrap.go Propagated EVM chain configuration to tracer creation and collection, updated constructors and method signatures accordingly.
tests/e2e_web3js_test.go, tests/web3js/eth_eip_7702_contract_write_test.js, tests/web3js/eth_eip_7702_sending_transactions_test.js, tests/web3js/eth_pectra_upgrade_test.js, tests/web3js/viem/Delegation.sol, tests/web3js/viem/config.js, tests/web3js/viem/contract.js Added and updated end-to-end and integration tests for EIP-7702, Pectra upgrade, and Viem client, including new Solidity contract and configuration files.
tests/web3js/build_evm_state_test.js, tests/web3js/contract_call_overrides_test.js, tests/web3js/debug_traces_test.js, tests/web3js/eth_batch_tx_logs_test.js, tests/web3js/eth_deploy_contract_and_interact_test.js Adjusted test assertions and expected values to reflect changes in gas estimation, bloom filters, and trace outputs.
go.mod, tests/go.mod, tests/web3js/package.json Upgraded Go version, toolchain, and multiple dependencies; added new packages for EVM features and Viem support.
models/transaction_test.go Updated tests to include new transaction types and consensus rules, adjusted gas limits and header fields.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Utils
    participant DB
    participant EVM
    participant Tracer

    Client->>API: Call method with blockNumber/tag
    API->>Utils: resolveBlockNumber(blockNumber)
    Utils->>DB: Get latest executed block height
    DB-->>Utils: Return block height
    Utils-->>API: Return resolved block number
    API->>EVM: ToTransaction(args, defaultType, gasLimit)
    EVM-->>API: Transaction object
    API->>Tracer: (if tracing) Create tracer with chain config
    Tracer-->>API: Tracer instance
    API-->>Client: Return result (block, tx, trace, etc.)
Loading

Possibly related PRs

  • Update to flow-go with go-ethereum@v1.14.8 #786: Both PRs modify api/debug.go and involve changes to transaction encoding and block override handling in debug tracing, including the use of resolveBlockNumber and passing chain configuration to tracer creation.
  • Update flow-go #673: Both PRs update api/api.go and related API method signatures, focusing on block number resolution and transaction handling, with overlapping changes to API logic.

Suggested labels

Bugfix, Improvement

Suggested reviewers

  • peterargue
  • zhangchiqing

Poem

In the warren of code, where the block numbers hop,
We’ve tidied the fields so the bugs couldn’t stop.
New types for the blobs, and the bloom filters bloom,
EIP-7702 tests now light up the room.
With chain configs in tracers and receipts that convert,
This patch makes our EVM as spry as a rabbit in a shirt!
🐇✨


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.

@m-Peter m-Peter changed the base branch from main to mpeter/poc-index-finalized-block-results May 8, 2025 08:31
coderabbitai[bot]

This comment was marked as resolved.

@j1010001 j1010001 merged commit 2fa4139 into mpeter/poc-index-finalized-block-results May 8, 2025
2 checks passed
@j1010001 j1010001 deleted the feature/pectra-upgrade-soft-finality-backport branch May 8, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants