Add support for the Filecoin.EthGetBlockByNumber V2#6404
Conversation
WalkthroughImplements a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RPC as RPC Server
participant Tipset as TipsetResolverV2
participant Builder as BlockBuilder
Client->>RPC: Filecoin.EthGetBlockByNumber (V2) request
RPC->>Tipset: tipset_by_block_number_or_hash_v2(params)
Tipset-->>RPC: Tipset (or not found / error)
RPC->>Builder: block_from_filecoin_tipset(tipset, fullTxInfo)
Builder-->>RPC: Block (Ethereum-style)
RPC-->>Client: JSON-RPC response with Block
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2026-01-05T12:54:40.850ZApplied to files:
📚 Learning: 2026-01-05T12:56:13.802ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (2)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
CHANGELOG.mdsrc/rpc/methods/eth.rssrc/rpc/mod.rssrc/tool/subcommands/api_cmd/api_compare_tests.rssrc/tool/subcommands/api_cmd/test_snapshots.txt
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-02T14:23:53.808Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/tool/subcommands/api_cmd/test_snapshots.txt:206-252
Timestamp: 2025-09-02T14:23:53.808Z
Learning: In the Forest project, .rpcsnap.json.zst snapshot files listed in src/tool/subcommands/api_cmd/test_snapshots.txt are not stored in the repository itself but are downloaded from a DigitalOcean (DO) bucket when needed. The manifest file serves as an index/catalog of available snapshots.
Applied to files:
src/tool/subcommands/api_cmd/test_snapshots.txt
📚 Learning: 2026-01-05T12:54:40.850Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:40.850Z
Learning: In Rust code reviews, do not derive Eq for a struct if any field does not implement Eq (e.g., types from external dependencies). If a type like CronStateLotusJson includes fields wrapping external dependencies that lack Eq, derive PartialEq (or implement PartialEq manually) but avoid deriving Eq. This ensures comparisons compile and reflect actual equivalence semantics. When needed, consider implementing custom PartialEq (and possibly Eq) only after ensuring all fields (or wrappers) implement Eq, or keep PartialEq-only if full equality semantics cannot be expressed.
Applied to files:
src/rpc/mod.rssrc/tool/subcommands/api_cmd/api_compare_tests.rssrc/rpc/methods/eth.rs
📚 Learning: 2026-01-05T12:56:13.802Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/evm_state.rs:41-44
Timestamp: 2026-01-05T12:56:13.802Z
Learning: In Rust codebases (e.g., Forest), do not add #[cfg(test)] to functions already annotated with #[test]. The #[test] attribute ensures the function is compiled only for tests, so a separate #[cfg(test)] is redundant and can be removed if present. Apply this check to all Rust files that contain #[test] functions.
Applied to files:
src/rpc/mod.rssrc/tool/subcommands/api_cmd/api_compare_tests.rssrc/rpc/methods/eth.rs
🧬 Code graph analysis (1)
src/tool/subcommands/api_cmd/api_compare_tests.rs (5)
src/rpc/reflect/mod.rs (1)
request(288-298)src/rpc/client.rs (1)
request(258-271)src/rpc/methods/eth.rs (4)
from_block_number(366-368)from_block_number(426-428)from_predefined(362-364)from_predefined(422-424)src/networks/mod.rs (1)
epoch(509-522)src/blocks/tipset.rs (2)
epoch(310-312)epoch(525-527)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: tests-release
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: Coverage
🔇 Additional comments (4)
CHANGELOG.md (1)
40-41: LGTM!The changelog entry follows the established format and is correctly placed under the "Added" section, consistent with other API v2 implementations.
src/tool/subcommands/api_cmd/test_snapshots.txt (1)
64-64: LGTM!The snapshot entry follows the established naming convention for v2 methods and is correctly placed in alphabetical order after the v1 variant.
src/rpc/mod.rs (1)
115-115: Looks good! The registration ofEthGetBlockByNumberV2follows the established pattern, placing the V2 method immediately after its V1 counterpart. The type is properly defined as a public enum insrc/rpc/methods/eth.rs.src/tool/subcommands/api_cmd/api_compare_tests.rs (1)
1695-1744: Policy choices are consistent with existing V1 tests—no refactoring needed.The added
EthGetBlockByNumberV2cases correctly mirror the V1EthGetBlockByNumbertests, including identical policy choices for Safe/Finalized (usingbasic). V1 tests already use this same pattern without special gating, and there are no open issues or comments suggesting Safe/Finalized is environment-dependent or F3-exclusive. The F3-related gating in the file applies only to F3-specific RPC methods, not to block selection via Safe/Finalized tags. The policy is appropriate and follows established patterns.
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary of changes
Changes introduced in this pull request:
Filecoin.EthGetBlockByNumberV2 and added test.Reference issue to close (if applicable)
Closes #6294
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Tests
Changelog
✏️ Tip: You can customize this high-level summary in your review settings.