Skip to content

Add support for the Filecoin.EthTraceFilter V2#6522

Draft
sudo-shashank wants to merge 8 commits intomainfrom
shashank/EthTraceFilterV2
Draft

Add support for the Filecoin.EthTraceFilter V2#6522
sudo-shashank wants to merge 8 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.

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 EthTraceFilter RPC method.
  • Tests

    • Added test coverage validating the new v2 EthTraceFilter behavior.
  • Changelog

    • Added a 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

Important

Review skipped

Draft detected.

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.

  • 🔍 Trigger a full review

Walkthrough

Adds a v2 RPC endpoint Filecoin.EthTraceFilter (EthTraceFilterV2) that mirrors v1 behavior but resolves block identifiers via the v2 tipset 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
Introduces pub enum EthTraceFilterV2, RpcMethod<1> implementation for v2 (NAME=Filecoin.EthTraceFilter, alias trace_filter), a get_eth_block_number_from_string_v2 helper using tipset_by_block_number_or_hash_v2, and v2-aligned handle that delegates to existing trace logic.
RPC Registration
src/rpc/mod.rs
Registers EthTraceFilterV2 in the RPC method enumeration (eth vertical) so the v2 path is exposed.
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 with shifted block range and appends the new snapshot filecoin_ethtracefilter_1770191732520294.rpcsnap.json.zst to snapshots list.

Sequence Diagram(s)

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

    Client->>RPC: RPC call (EthTraceFilter criteria)
    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: epoch numbers (from/to)
    RPC->>Trace: invoke trace_filter with resolved epochs
    Trace-->>RPC: traces (sorted)
    RPC-->>Client: return Vec<EthBlockTrace>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • hanabi1224
  • akaladarshi
🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding V2 support for the Filecoin.EthTraceFilter RPC method.
Linked Issues check ✅ Passed The PR implements Filecoin.EthTraceFilter V2 as required by issue #6307, with complete public API additions, helper functions, test cases, and documentation updates.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing EthTraceFilterV2: RPC method definitions, block resolution helpers, tests, test snapshots, and changelog entries are all in scope.

✏️ 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
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

1 participant