feat(rpc): add Forest.NetChainExchange for internal debugging#6824
feat(rpc): add Forest.NetChainExchange for internal debugging#6824hanabi1224 merged 2 commits intomainfrom
Forest.NetChainExchange for internal debugging#6824Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds a new internal RPC method for chain exchange, exposes the chain-exchange handler, and makes the chain-exchange concurrency limit configurable via an environment variable; includes documentation and test-snapshot adjustments. Changes
Sequence DiagramsequenceDiagram
participant Client
participant RPC as Forest.NetChainExchange
participant ChainStore
participant SyncCtx as SyncNetworkContext
Client->>RPC: Forest.NetChainExchange(startTipsetKey?, len, options)
RPC->>RPC: Validate len > 0
alt startTipsetKey provided
RPC->>RPC: use provided key
else
RPC->>ChainStore: heaviest_tipset().key()
ChainStore-->>RPC: tipset key
end
RPC->>RPC: start timer
RPC->>SyncCtx: handle_chain_exchange_request(tipset_key, len)
SyncCtx->>SyncCtx: fetch tipsets (respecting concurrency limit)
SyncCtx-->>RPC: fetched tipsets count
RPC->>RPC: compute elapsed time
RPC-->>Client: "fetched N tipsets, took Xms"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/docs/users/reference/env_variables.md (1)
66-66: Minor: Capitalize the description for consistency.Other entries in this table start with a capital letter (e.g., "The passphrase...", "Load CAR files...", "Maximum number of..."). Consider capitalizing for consistency:
-| `FOREST_MAX_CONCURRENT_CHAIN_EXCHANGE_REQUESTS` | positive integer | 3 | 3 | number of max concurrent requests to send over chain exchange protocol | +| `FOREST_MAX_CONCURRENT_CHAIN_EXCHANGE_REQUESTS` | positive integer | 3 | 3 | Maximum number of concurrent requests to send over the chain exchange protocol |🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/docs/users/reference/env_variables.md` at line 66, Update the table entry for the environment variable FOREST_MAX_CONCURRENT_CHAIN_EXCHANGE_REQUESTS by capitalizing the description text; replace "number of max concurrent requests to send over chain exchange protocol" with a capitalized phrase such as "Number of max concurrent requests to send over chain exchange protocol" (or improve to "Maximum number of concurrent requests to send over chain exchange protocol") to match the capitalization style of other entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/docs/users/reference/env_variables.md`:
- Line 66: Update the table entry for the environment variable
FOREST_MAX_CONCURRENT_CHAIN_EXCHANGE_REQUESTS by capitalizing the description
text; replace "number of max concurrent requests to send over chain exchange
protocol" with a capitalized phrase such as "Number of max concurrent requests
to send over chain exchange protocol" (or improve to "Maximum number of
concurrent requests to send over chain exchange protocol") to match the
capitalization style of other entries.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 38a8d526-1ffc-4dda-9199-d456adb1e8bf
📒 Files selected for processing (4)
docs/docs/users/reference/env_variables.mdsrc/chain_sync/network_context.rssrc/rpc/methods/net.rssrc/rpc/mod.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 10 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:
Forest.NetChainExchangefor internal debuggingFOREST_MAX_CONCURRENT_CHAIN_EXCHANGE_REQUESTSConclusion:
Fetching 64 full tipsets is not much slower than fetching 64 tipset headers when max concurrency is updated to 3, not worth changing how the chain follower downloads tipsets.
Fetching full tipset:
{ "jsonrpc": "2.0", "method": "Forest.NetChainExchange", "params": [ [ { "/": "bafy2bzaceccdj25cza7ofkygmqqaesbsuy75hun2durwwngwqduiqz5fcpney" }, { "/": "bafy2bzacecxpe4pfypdx4f6z2hsy5tgvvra3loyprlupw7czrivfxf5adtsia" }, { "/": "bafy2bzacea2z5gachypsuldr7bynvmdnqohzdws7oni5y4uwnfqgxcthqkjqw" } ], 64, 3 ], "id": 123 }{ "jsonrpc": "2.0", "id": 123, "result": "fetched 64 tipsets, took 496ms 544us 847ns" }Fetching tipset headers:
{ "jsonrpc": "2.0", "method": "Forest.NetChainExchange", "params": [ [ { "/": "bafy2bzaceccdj25cza7ofkygmqqaesbsuy75hun2durwwngwqduiqz5fcpney" }, { "/": "bafy2bzacecxpe4pfypdx4f6z2hsy5tgvvra3loyprlupw7czrivfxf5adtsia" }, { "/": "bafy2bzacea2z5gachypsuldr7bynvmdnqohzdws7oni5y4uwnfqgxcthqkjqw" } ], 64, 1 ], "id": 123 }{ "jsonrpc": "2.0", "id": 123, "result": "fetched 64 tipsets, took 295ms 427us 572ns" }Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features
Documentation
Tests