Skip to content

Add support for the Filecoin.EthTraceFilter V2#6522

Open
sudo-shashank wants to merge 29 commits intomainfrom
shashank/EthTraceFilterV2
Open

Add support for the Filecoin.EthTraceFilter V2#6522
sudo-shashank wants to merge 29 commits intomainfrom
shashank/EthTraceFilterV2

Conversation

@sudo-shashank
Copy link
Contributor

@sudo-shashank sudo-shashank commented Feb 4, 2026

Summary of changes

Changes introduced in this pull request:

  • Impl Filecoin.EthTraceFilter V2 and added test.
  • Filecoin.EthTraceFilter filter options from_block and to_block now default to latest tag when omitted for v1 and v2 API.

Reference issue to close (if applicable)

Closes #6307

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added v2 API support for the Filecoin.EthTraceFilter RPC method.
  • Tests

    • Added a test validating v2 EthTraceFilter behavior and parity with v1 semantics.
  • Changelog

    • Added an unreleased changelog entry documenting the new Filecoin.EthTraceFilter v2 endpoint.
  • Snapshots

    • Added a new test snapshot for the v2 EthTraceFilter case.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a v2 RPC endpoint Filecoin.EthTraceFilter (EthTraceFilterV2) that mirrors v1 semantics but resolves blocks via the v2 tipset/block resolver; registers the new method and adds a corresponding test and snapshot entry.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added unreleased entry documenting the new API v2 method Filecoin.EthTraceFilter.
Core v2 Implementation
src/rpc/methods/eth.rs
Adds pub enum EthTraceFilterV2, RpcMethod<1> impl for v2 (Filecoin.EthTraceFilter, alias trace_filter), new helper get_eth_block_number_from_string_v2 using tipset_by_block_number_or_hash_v2, and a v2 handle flow that delegates to existing trace logic and returns sorted Vec<EthBlockTrace>.
RPC Registration
src/rpc/mod.rs
Registers EthTraceFilterV2 in the RPC methods (eth vertical) to expose the v2 API path.
Tests & Snapshots
src/tool/subcommands/api_cmd/api_compare_tests.rs, src/tool/subcommands/api_cmd/test_snapshots.txt
Adds an identity-style test case for EthTraceFilterV2 (adjusted from/to block range) and appends snapshot filecoin_ethtracefilter_v2_1770740801450325.rpcsnap.json.zst.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RPC as RpcServer / EthTraceFilterV2
    participant Resolver as TipsetResolverV2
    participant DB as Blockstore
    participant Trace as TraceFilterLogic

    Client->>RPC: Call Filecoin.EthTraceFilter (filter)
    RPC->>Resolver: resolve fromBlock/toBlock (tipset_by_block_number_or_hash_v2)
    Resolver->>DB: fetch tipset by number or hash
    DB-->>Resolver: tipset (epoch)
    Resolver-->>RPC: resolved epochs
    RPC->>Trace: invoke trace_filter with resolved epochs
    Trace-->>RPC: traces (sorted by block_number, tx_position, trace_address)
    RPC-->>Client: return Vec<EthBlockTrace>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • akaladarshi
  • hanabi1224
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: adding V2 support for the Filecoin.EthTraceFilter RPC method, which is exactly what the changeset implements.
Linked Issues check ✅ Passed The PR implements Filecoin.EthTraceFilter V2 as required by linked issue #6307, adding the v2 API endpoint with block resolution and comprehensive tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing Filecoin.EthTraceFilter V2: method implementation, RPC registration, test cases, changelog, and snapshots.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shashank/EthTraceFilterV2

Comment @coderabbitai help to get the list of available commands and usage tips.

@sudo-shashank sudo-shashank added the RPC requires calibnet RPC checks to run on CI label Feb 4, 2026
@sudo-shashank sudo-shashank marked this pull request as ready for review February 5, 2026 09:38
@sudo-shashank sudo-shashank requested a review from a team as a code owner February 5, 2026 09:38
@sudo-shashank sudo-shashank requested review from akaladarshi and hanabi1224 and removed request for a team February 5, 2026 09:38
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

🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Line 52: Update the CHANGELOG.md entry that currently references PR `#6522` to
reference issue `#6307` instead; replace the PR link
"[`#6522`](https://github.com/ChainSafe/forest/pull/6522): Implemented
`Filecoin.EthTraceFilter` for API v2." with the issue-style entry
"[`#6307`](https://github.com/ChainSafe/forest/issues/6307): Implemented
`Filecoin.EthTraceFilter` for API v2." so the changelog points to the issue
rather than the PR.

In `@src/rpc/methods/eth.rs`:
- Around line 4144-4189: The public enum EthTraceFilterV2 lacks rustdoc; add a
concise triple-slash doc comment above pub enum EthTraceFilterV2 describing its
purpose (RPC method Filecoin.EthTraceFilter / alias "trace_filter"), expected
parameter (EthTraceFilterCriteria), return type (Vec<EthBlockTrace>), and a
brief note about behavior (returns traces for transactions matching the filter
between from_block and to_block as handled in impl RpcMethod for
EthTraceFilterV2), so readers of the type and generated docs immediately
understand what this RPC endpoint represents and how it is used.

@sudo-shashank sudo-shashank marked this pull request as draft February 6, 2026 05:42
@sudo-shashank sudo-shashank marked this pull request as ready for review February 9, 2026 12:24
Copy link
Contributor

@hanabi1224 hanabi1224 left a comment

Choose a reason for hiding this comment

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

Please move the changelog entry to the new unreleased section

@sudo-shashank sudo-shashank marked this pull request as draft February 10, 2026 15:39
@sudo-shashank sudo-shashank marked this pull request as ready for review February 10, 2026 20:25
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 88.59649% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.27%. Comparing base (2d942c9) to head (c149198).

Files with missing lines Patch % Lines
src/rpc/methods/eth.rs 84.28% 1 Missing and 10 partials ⚠️
src/rpc/methods/eth/filter/mod.rs 95.45% 0 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/mod.rs 88.37% <ø> (ø)
src/rpc/methods/eth/filter/mod.rs 88.25% <95.45%> (+0.52%) ⬆️
src/rpc/methods/eth.rs 70.56% <84.28%> (+0.90%) ⬆️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d942c9...c149198. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hanabi1224 hanabi1224 self-requested a review February 13, 2026 10:58
@sudo-shashank sudo-shashank marked this pull request as draft February 20, 2026 06:19
auto-merge was automatically disabled February 20, 2026 06:19

Pull request was converted to draft

@sudo-shashank sudo-shashank marked this pull request as ready for review February 20, 2026 09:10
@sudo-shashank sudo-shashank marked this pull request as draft February 20, 2026 09:34
@sudo-shashank sudo-shashank marked this pull request as ready for review February 20, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RPC v2] Filecoin.EthTraceFilter

3 participants

Comments