-
Notifications
You must be signed in to change notification settings - Fork 182
fix(rpc): register RPC methods for different versions into different modules #6219
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
Conversation
WalkthroughRefactors RPC to support per-API-version modules and per-request method lookup; restricts existing Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RPC_Server
participant Modules_Map
participant Module
participant Handler
rect rgb(240,248,255)
Note over RPC_Server,Modules_Map: Startup builds per-version RpcModule map
Client->>RPC_Server: JSON-RPC request (method, api_path)
RPC_Server->>Modules_Map: lookup RpcModule for api_path
Modules_Map-->>RPC_Server: selected RpcModule
end
rect rgb(240,248,255)
RPC_Server->>Module: resolve method in module
Module->>Handler: invoke handler
end
rect rgb(255,240,240)
alt api_path == V2 and method == Filecoin.ChainGetTipSet
Handler-->>Client: error "ChainGetTipSet V2 not yet implemented"
else
Handler-->>Client: normal Tipset response
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ 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). (7)
Comment |
| const PERMISSION: Permission = Permission::Read; | ||
| const DESCRIPTION: Option<&'static str> = Some("Returns the tipset with the specified CID."); | ||
|
|
||
| type Params = (ApiTipsetKey,); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be TipsetSelector. The method will be implemented in a subsequent PR.
type TipSetSelector struct {
Key *TipSetKey `json:"key,omitempty"`
Height *TipSetHeight `json:"height,omitempty"`
Tag *TipSetTag `json:"tag,omitempty"`
}
src/rpc/methods/chain.rs
Outdated
| type Ok = Tipset; | ||
|
|
||
| async fn handle(_: Ctx<impl Blockstore>, _: Self::Params) -> Result<Self::Ok, ServerError> { | ||
| Err(anyhow::anyhow!("Filecoin.ChainGetTipSet for V2 is not yet implemented").into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rather return
Lines 76 to 82 in a8e0dbc
| pub fn unsupported_method() -> Self { | |
| Self::new( | |
| implementation_defined_errors::UNSUPPORTED_METHOD, | |
| "unsupported method", | |
| Some("This method is not supported by the current version of the Forest node".into()), | |
| ) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/rpc/methods/chain.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-11T14:00:47.060Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: src/daemon/db_util.rs:236-259
Timestamp: 2025-08-11T14:00:47.060Z
Learning: In Forest's snapshot import (`src/daemon/db_util.rs`), when F3 CID is present in snapshot metadata but the actual F3 data is missing, this should cause a hard error as it indicates snapshot corruption. Only errors during the F3 import process itself (after data is successfully retrieved) should be non-fatal and logged.
Applied to files:
src/rpc/methods/chain.rs
📚 Learning: 2025-08-28T12:52:46.927Z
Learnt from: LesnyRumcajs
Repo: ChainSafe/forest PR: 6011
File: src/cli/main.rs:18-25
Timestamp: 2025-08-28T12:52:46.927Z
Learning: In Forest CLI (src/cli/main.rs), the early RPC network check before Cli::parse_from() does not block help/version commands because clap processes these internally before reaching the RPC call. LesnyRumcajs confirmed this implementation works correctly and that RPC call failures are acceptable in this context.
Applied to files:
src/rpc/methods/chain.rs
📚 Learning: 2025-08-08T12:11:55.266Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:461-487
Timestamp: 2025-08-08T12:11:55.266Z
Learning: Forest (src/ipld/util.rs, Rust): In UnorderedChainStream::poll_next, dropping `extract_sender` (when no more tipsets and the extract queue is empty) is the intended shutdown signal for workers. Any subsequent attempt to enqueue work after this drop is a logic error and should be treated as an error; do not change `send()` to ignore a missing sender.
Applied to files:
src/rpc/methods/chain.rs
📚 Learning: 2025-10-17T09:36:15.757Z
Learnt from: elmattic
Repo: ChainSafe/forest PR: 6128
File: src/ipld/util.rs:23-30
Timestamp: 2025-10-17T09:36:15.757Z
Learning: Always run `cargo check` or `cargo build` to verify actual compilation errors in the Forest codebase before flagging them as issues. Do not rely solely on documentation or assumptions about trait implementations.
Applied to files:
src/rpc/methods/chain.rs
🧬 Code graph analysis (1)
src/rpc/methods/chain.rs (2)
src/rpc/methods/state.rs (16)
handle(109-114)handle(132-138)handle(151-157)handle(172-178)handle(196-205)handle(223-231)handle(248-255)handle(272-282)handle(298-305)handle(335-465)handle(484-492)handle(508-538)handle(555-561)handle(577-597)handle(615-624)handle(641-663)src/rpc/error.rs (1)
unsupported_method(76-82)
⏰ 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). (7)
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: cargo-publish-dry-run
- GitHub Check: Build MacOS
- GitHub Check: Build Ubuntu
- GitHub Check: tests-release
- GitHub Check: tests
- GitHub Check: All lint checks
🔇 Additional comments (2)
src/rpc/methods/chain.rs (2)
970-970: LGTM! Proper API version segregation.Restricting the existing
ChainGetTipSetto V0 and V1 paths is correct, as V2 will be handled by the separateChainGetTipSetV2implementation.
999-1001: LGTM! Correct use of unsupported_method error.The
handleimplementation correctly returnsServerError::unsupported_method()to indicate the V2 endpoint is not yet implemented, which aligns with the PR's goal of demonstrating proper version-based routing.Based on past review comments.
| const PARAM_NAMES: [&'static str; 1] = ["tipsetSelector"]; | ||
| const API_PATHS: BitFlags<ApiPaths> = make_bitflags!(ApiPaths::{ V2 }); | ||
| const PERMISSION: Permission = Permission::Read; | ||
| const DESCRIPTION: Option<&'static str> = Some("Returns the tipset with the specified CID."); | ||
|
|
||
| type Params = (ApiTipsetKey,); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Clarify parameter type vs. parameter name inconsistency.
The parameter name "tipsetSelector" (line 991) suggests a different type than V0/V1, but Params is still (ApiTipsetKey,) (line 996)—the same type used in the V0/V1 implementation. According to the PR objectives and past review comments, V2 should accept a TipSetSelector type.
Is the intention to:
- Add the
TipSetSelectortype now and update line 996 to use it, or - Keep the same type temporarily and change the parameter name to
"tipsetKey"to avoid confusion?
The current mismatch creates a misleading API surface.
Based on past review comments indicating the parameter should be TipSetSelector with fields for Key, Height, and Tag.
---
🏁 Script executed:
```shell
#!/bin/bash
# Search for ApiTipsetKey type definition
rg -n "type\s+ApiTipsetKey" --type=rs -A 3
Length of output: 26
🏁 Script executed:
#!/bin/bash
# Search for TipSetSelector type definition
rg -n "type\s+TipSetSelector|struct\s+TipSetSelector" --type=rs -A 5Length of output: 26
🏁 Script executed:
#!/bin/bash
# Examine ChainGetTipSetV2 full implementation (lines 988-1010)
sed -n '988,1010p' src/rpc/methods/chain.rsLength of output: 913
🏁 Script executed:
#!/bin/bash
# Search for V0/V1 ChainGetTipSet implementations for comparison
rg -n "struct.*ChainGetTipSet" --type=rs -A 12 | head -50Length of output: 26
🏁 Script executed:
#!/bin/bash
# Check for TipsetSelector mentions in comments or code
rg -n -i "tipset.*selector|tipsetselector" --type=rs -B 2 -A 2Length of output: 26
---
🏁 Script executed:
```shell
#!/bin/bash
# Search for ApiTipsetKey type definition without type flag
rg -n "ApiTipsetKey" -A 3 src/rpc/methods/chain.rs | head -20
Length of output: 651
🏁 Script executed:
#!/bin/bash
# Search for TipSetSelector type definition anywhere
rg -n "TipSetSelector" -B 1 -A 5Length of output: 0
🏁 Script executed:
#!/bin/bash
# Find V0 ChainGetTipSet implementation
rg -n "pub enum ChainGetTipSet" -A 12 src/rpc/methods/chain.rs | head -30Length of output: 1350
🏁 Script executed:
#!/bin/bash
# Find all ChainGetTipSet enum variants to compare parameter names
rg -n "ChainGetTipSet" -B 2 -A 8 src/rpc/methods/chain.rs | grep -E "(pub enum|PARAM_NAMES|type Params)"Length of output: 545
🏁 Script executed:
#!/bin/bash
# Search for what other methods use in PARAM_NAMES to understand naming convention
rg -n 'PARAM_NAMES.*=.*\[' -A 0 src/rpc/methods/chain.rs | head -15Length of output: 881
Update PARAM_NAMES to match the actual Params type.
The parameter name "tipsetSelector" (line 991) is misleading. It suggests a different type, but Params is (ApiTipsetKey,) (line 996)—the same type used in ChainGetTipSet V0/V1, which uses the parameter name "tipsetKey" (line 969).
The codebase naming convention consistently matches parameter names to their types (e.g., "messageCid" for CID, "blockCid" for CID). Since TipSetSelector does not exist in the codebase and the actual type is ApiTipsetKey, change line 991 to:
const PARAM_NAMES: [&'static str; 1] = ["tipsetKey"];
This maintains consistency with V0/V1 and accurately reflects the actual parameter type.
🤖 Prompt for AI Agents
In src/rpc/methods/chain.rs around lines 991 to 996, PARAM_NAMES currently uses
"tipsetSelector" which does not match the actual Params type (ApiTipsetKey);
update PARAM_NAMES to use "tipsetKey" so the parameter name matches the type and
aligns with V0/V1 naming conventions (i.e., change the string literal to
"tipsetKey").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intended as noted in #6219 (comment) . Will be fixed in a subsequent PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Fetch the referenced discussion comment to understand the context
gh api /repos/ChainSafe/forest/pulls/6219/comments -q '.[] | select(.id == 2486104046) | .body'
Length of output: 261
@hanabi1224, understood! Thanks for the clarification. The forward-looking parameter name "tipsetSelector" makes sense as a placeholder indicating the future TipsetSelector type that will be implemented in the subsequent PR. This phased approach—establishing the routing infrastructure now and adding the proper type implementation later—is reasonable for unblocking issue #6182.
🧬 Code Graph Analysis Results
[relevant_snippets]
src/rpc/methods/chain.rs
-
ForestChainExport
- Summary:
- RPC: Forest.ChainExport
- Params: ForestChainExportParams
- Returns: ApiExportResult
- Behavior: Manages a chain export operation with a global lock CHAIN_EXPORT_LOCK. Supports dry-run, multiple versions (V1/V2), and cancellation via a CancellationToken. Handles streaming export results and cleans up token on completion or cancellation. Delegates to chain export logic (export:: or export_v2::<Sha256, _> depending on version). Ensures proper error propagation and cleanup of export state.
- Summary:
-
ForestChainExportStatus
- Summary:
- RPC: Forest.ChainExportStatus
- Params: none
- Returns: ApiExportStatus
- Behavior: Reports current export progress, whether exporting, cancelled, and start_time. Reads from CHAIN_EXPORT_STATUS.
- Summary:
-
ForestChainExportCancel
- Summary:
- RPC: Forest.ChainExportCancel
- Params: none
- Returns: bool
- Behavior: Cancels an in-progress chain export if a token exists in CHAIN_EXPORT_LOCK.
- Summary:
-
ForestChainExportDiff
- Summary:
- RPC: Forest.ChainExportDiff
- Params: ForestChainExportDiffParams
- Returns: ()
- Behavior: Validates and starts an export-diff operation, ensuring no concurrent export is active, and that depth satisfies chain_finality. Initiates an archival export for the diff.
- Summary:
-
ChainExport
- Summary:
- RPC: Filecoin.ChainExport
- Params: ChainExportParams
- Returns: ApiExportResult
- Behavior: Delegates to ForestChainExport with version V1, mapping ChainExportParams to ForestChainExportParams.
- Summary:
-
ChainReadObj
- Summary:
- RPC: Filecoin.ChainReadObj
- Params: cid
- Returns: Vec
- Behavior: Reads IPLD node bytes by CID from the chain blockstore and returns raw bytes.
- Summary:
-
ChainHasObj
- Summary:
- RPC: Filecoin.ChainHasObj
- Params: cid
- Returns: bool
- Behavior: Checks existence of a CID in the chain blockstore.
- Summary:
-
ChainStatObj
- Summary:
- RPC: Filecoin.ChainStatObj
- Params: obj_cid, base_cid
- Returns: ObjStat
- Behavior: Computes statistics for the graph reachable from obj_cid, optionally as a diff against base_cid. Traverses IPLD links and accumulates size/links.
- Summary:
-
ChainGetBlockMessages
- Summary:
- RPC: Filecoin.ChainGetBlockMessages
- Params: blockCid
- Returns: BlockMessages
- Behavior: Loads block header from blockstore, resolves message CIDs, reconstructs and returns all messages in the block (BLS and SECP, plus CIDs).
- Summary:
-
ChainGetMessagesInTipset
- Summary:
- RPC: Filecoin.ChainGetMessagesInTipset
- Params: tipsetKey
- Returns: Vec
- Behavior: Loads tipset from store, aggregates all messages in the tipset, including duplicates deduplicated by CID.
- Summary:
-
ChainGetPath
- Summary:
- RPC: Filecoin.ChainGetPath
- Params: from, to (TipsetKey)
- Returns: Vec
- Behavior: Computes the sequence of changes to go from one tipset to another (reverts/applies). Uses load_required_tipset_or_heaviest and backtracks via parents to determine changes. Errors on absent common ancestor.
- Summary:
-
ChainGetTipSetByHeight
- Summary:
- RPC: Filecoin.ChainGetTipSetByHeight
- Params: height, tipsetKey
- Returns: Tipset
- Behavior: Returns the tipset at a specified height, searching from a given head tipset, respecting null-tipset behavior and head limitations.
- Summary:
-
ChainGetTipSet (V0/V1)
- Summary:
- RPC: Filecoin.ChainGetTipSet
- Params: tipsetKey
- Returns: Tipset
- Behavior: Loads and returns the tipset for the provided key, for V0/V1 paths.
- Summary:
-
ChainGetTipSet (V2)
- Summary:
- RPC: Filecoin.ChainGetTipSet
- Params: tipsetKey (ApiTipsetKey)
- Returns: Tipset
- Behavior: Placeholder/unsupported in this version; returns unsupported_method error.
- Summary:
-
ChainHead
- Summary:
- RPC: Filecoin.ChainHead
- Params: none
- Returns: Tipset
- Behavior: Returns the heaviest (head) tipset.
- Summary:
-
ChainGetGenesis
- Summary:
- RPC: Filecoin.ChainGetGenesis
- Params: none
- Returns: Option
- Behavior: Returns the genesis tipset if available.
- Summary:
-
ChainGetBlock
- Summary:
- RPC: Filecoin.ChainGetBlock
- Params: blockCid
- Returns: CachingBlockHeader
- Behavior: Returns the block header for a given block CID.
- Summary:
-
ChainNotify
- Summary:
- RPC: Filecoin.ChainNotify
- Params: none
- Returns: Subscriber<Vec>
- Behavior: Streams head changes to subscribers, starting with the current tipset.
- Summary:
-
chain_notify (helper)
- Summary:
- Context: Helper function returning a Subscriber<Vec>
- Behavior: Seeds the subscriber with the current tipset then streams subsequent changes.
- Summary:
-
load_api_messages_from_tipset (helper)
- Summary:
- Inputs: store, tipset
- Returns: Vec
- Behavior: Loads a full tipset from blockstore, iterates blocks, and collects unique messages (by CID) from both BLS and SECP message lists.
- Summary:
-
ChainGetParentMessages
- Summary:
- RPC: Filecoin.ChainGetParentMessages
- Params: blockCid
- Returns: Vec
- Behavior: Returns messages included in the parent tipset of the given block CID.
- Summary:
-
ChainGetParentReceipts
- Summary:
- RPC: Filecoin.ChainGetParentReceipts
- Params: blockCid
- Returns: Vec
- Behavior: Returns receipts included in the parent tipset of the given block CID.
- Summary:
-
ChainGetMessagesInTipset (already described)
-
ChainGetBlockMessages (already described)
Notes
- File sections above reference the code paths in Forest’s chain RPC implementation that interact with tipsets, blocks, and chain state. They provide context for understanding how chain.rs supports RPC methods like chain export, tipset queries, and message/block access, which aligns with and complements the behavior noted in the user comment about a PR discussion related to chain finality/export semantics.
🧠 Learnings used
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
LesnyRumcajs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
17de43e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/rpc/reflect/mod.rs (1)
259-276: Consider iterating only overSelf::API_PATHSinstead of all variants.The current implementation iterates through all
ApiPaths::value_variants()and checksSelf::API_PATHS.contains(*api_version)for each. For methods that only support V0|V1, this unnecessarily checks V2 (and future versions).While the performance impact is negligible, iterating directly over
Self::API_PATHS.iter()would be more efficient and clearer in intent.Apply this diff to optimize the iteration:
- for api_version in ApiPaths::value_variants() { - if Self::API_PATHS.contains(*api_version) - && let Some(module) = modules.get_mut(api_version) + for api_version in Self::API_PATHS.iter() { + if let Some(module) = modules.get_mut(&api_version) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/rpc/reflect/mod.rs(3 hunks)src/tool/subcommands/api_cmd.rs(1 hunks)src/tool/subcommands/api_cmd/test_snapshot.rs(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-25T14:17:09.129Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5978
File: .github/workflows/unit-tests.yml:0-0
Timestamp: 2025-08-25T14:17:09.129Z
Learning: hanabi1224's download_file_with_cache function in src/utils/net/download_file.rs preserves URL path structure in local cache directories by using cache_dir.join(url.path().strip_prefix('/').unwrap_or_else(|| url.path())), so snapshots from https://forest-snapshots.fra1.cdn.digitaloceanspaces.com/rpc_test/ are cached locally at ~/.cache/forest/test/rpc-snapshots/rpc_test/ (including the rpc_test subdirectory from the URL path).
Applied to files:
src/tool/subcommands/api_cmd/test_snapshot.rs
⏰ 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). (7)
- GitHub Check: All lint checks
- GitHub Check: Build Ubuntu
- GitHub Check: cargo-publish-dry-run
- GitHub Check: Build MacOS
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: tests-release
- GitHub Check: tests
🔇 Additional comments (7)
src/rpc/reflect/mod.rs (2)
28-28: LGTM!The
ahash::HashMapimport is appropriate for the new per-version module registration.
119-132: LGTM!The addition of
Deserialize,Serialize, andValueEnumderives enables per-version test snapshot handling and the new registration loop.src/tool/subcommands/api_cmd/test_snapshot.rs (4)
19-19: LGTM!The
ApiPathsimport is required for the new version-aware test filtering.
51-52: LGTM!The optional
api_pathfield withskip_serializing_ifmaintains backward compatibility with existing test snapshots.
90-95: LGTM!Defaulting
api_pathtoApiPaths::V1whenNonemaintains backward compatibility with existing test snapshots that lack this field. This aligns withApiPaths::all()which currently returns V0|V1.
108-108: LGTM!The
API_PATHS.contains(api_path)check correctly filters test execution to only run against methods that support the snapshot's API version, preventing false failures and enabling targeted version testing.src/tool/subcommands/api_cmd.rs (1)
369-370: Verify that issue #6220 exists and confirm a plan to populateapi_pathduring snapshot generation.The technical concern is valid:
api_pathis set toNoneat line 370, which causes all generated snapshots to default toApiPaths::V1at line 95 in test_snapshot.rs. This prevents generating snapshots for V0 or V2 endpoints and loses critical metadata about which API version each snapshot targets.The issue reference exists in the code (line 369), but verify that GitHub issue #6220 tracks this problem and includes a concrete plan to capture the correct
api_pathduring snapshot generation.
| @@ -1,4 +1,4 @@ | |||
| filecoin_beacongetentry_1741270283524366.rpcsnap.json.zst | |||
| filecoin_beacongetentry_1741270283524367.rpcsnap.json.zst | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "api_path": "V0", to these 2 snapshot JSON files since they don't support V1 or V2
Summary of changes
To unblock #6182
V2 version of
ChainGetTipSetuses a different parameter, this PR allows implementing and registering the V2 implementation separately.This PR also adds an unimplemented
Filecoin.ChainGetTipSetfor V2 to prove the correctnessChanges introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Changes