Skip to content

Comments

fix(rpc): pass http::Extensions to RpcMethod::handle#6646

Open
hanabi1224 wants to merge 2 commits intomainfrom
hm/pass-extensions
Open

fix(rpc): pass http::Extensions to RpcMethod::handle#6646
hanabi1224 wants to merge 2 commits intomainfrom
hm/pass-extensions

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Feb 24, 2026

Summary of changes

With this change, we could resolve ApiPaths in RPC methods and merge a few Eth v2 RPC methods with v1

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

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

  • Refactor
    • RPC handlers across the API now accept and forward HTTP extensions so request-specific metadata can flow through RPC call paths; existing behavior and responses are unchanged.
    • Test and tooling paths updated to supply this HTTP context during RPC-driven snapshots and test runs, enabling future features that rely on per-request metadata.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a5f196 and 1ff947a.

📒 Files selected for processing (1)
  • src/rpc/methods/f3.rs

Walkthrough

Adds a third parameter &http::Extensions to RpcMethod::handle and threads this extensions reference through most RPC handler implementations and related call sites, adjusting signatures and forwarding extensions into downstream RPC/internal calls.

Changes

Cohort / File(s) Summary
Core RPC infra
src/rpc/reflect/mod.rs
Changed RpcMethod::handle trait signature to accept ext: &Extensions and updated registration closures to forward extensions.
Chain & Export
src/rpc/methods/chain.rs
Added _: &http::Extensions to many chain handlers; ForestChainExport and ChainExport now accept/forward ext; F3 finality lookups updated (some calls use &Default::default() or new F3GetLatestCertificate::get()).
Ethereum (eth)
src/rpc/methods/eth.rs
Threaded ext into numerous eth handlers and helpers (e.g., eth_trace_block, trace_filter) and propagated it to nested RPC calls used by tracing/filtering logic.
F3 / Finality
src/rpc/methods/f3.rs
Added _: &http::Extensions across F3 handlers; introduced F3GetLatestCertificate::get() and propagated ext to downstream calls (signing/export paths).
State
src/rpc/methods/state.rs
Added _: &http::Extensions to many state handlers; propagated ext through multi-step flows (e.g., StateGetAllocationForPendingDeal and inner calls).
Mempool & Market
src/rpc/methods/mpool.rs, src/rpc/methods/market.rs
Added _: &http::Extensions to mpool handlers; MpoolBatchPushUntrusted now forwards ext to MpoolBatchPush; MarketAddBalance forwards ext to MpoolPushMessage::handle.
Wallet, Auth, Gas, Miner, Msig, Net, Node, Misc, Common, Sync
src/rpc/methods/*.rs
Added _: &http::Extensions parameter to many handler signatures; updated a few call sites and tests to pass &Default::default() or constructed http::Extensions.
Tools / Tests
src/tool/subcommands/api_cmd/...
Test/tool flows now build an http::Extensions (inserting path) and pass it to handlers (e.g., generate_test_snapshot, test_snapshot).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Reflect as "Rpc Reflect/Registry"
    participant Handler as "RpcMethod::handle"
    participant Downstream as "Downstream RPC / Helpers"
    participant Store as "Blockstore/DB"

    Client->>Reflect: send RPC request (method, params, http extensions)
    Reflect->>Handler: invoke handle(ctx, params, &extensions)
    Handler->>Downstream: call nested RPCs / helpers with &extensions
    Downstream->>Store: read/write using ctx
    Downstream-->>Handler: return results
    Handler-->>Reflect: return response
    Reflect-->>Client: send RPC response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • akaladarshi
  • LesnyRumcajs
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.40% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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 http::Extensions parameter passing to RpcMethod::handle across all RPC method implementations. It is concise and directly related to the primary objective of the changeset.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/pass-extensions

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

@hanabi1224
Copy link
Contributor Author

@coderabbitai create a PR against this branch to fill _: http::Extensions in all RpcMethod::handle trait method

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@hanabi1224, I'll help you create a PR to update all RpcMethod::handle implementations. Let me first gather information about the trait and its implementations.


🏁 Script executed:

#!/bin/bash
# Find the RpcMethod trait definition
ast-grep --pattern 'trait RpcMethod {
  $$$
}'

# Also search for the trait definition with rg for context
rg -n -C5 'trait RpcMethod'

Length of output: 1604


🏁 Script executed:

#!/bin/bash
# Find all implementations of RpcMethod::handle
rg -n -C3 'impl.*RpcMethod' --type rust

# Also search for handle method implementations
rg -n -A10 'fn handle' --type rust | rg -B2 -A8 'RpcMethod'

Length of output: 138201


🏁 Script executed:

#!/bin/bash
# Find all files that implement RpcMethod
rg -l 'impl.*RpcMethod' --type rust

Length of output: 437


@hanabi1224, I'll create a PR to add the _: http::Extensions parameter to all RpcMethod::handle implementations. Let me first examine the trait definition to understand the expected signature.


🏁 Script executed:

#!/bin/bash
# Find the RpcMethod trait definition and the handle method signature
rg -A30 'pub trait RpcMethod' src/rpc/reflect/mod.rs

Length of output: 2456


🏁 Script executed:

#!/bin/bash
# Search for handle method signatures to see the pattern
rg -n 'async fn handle' --type rust -A2 src/rpc/methods/ | head -100

Length of output: 5364


🏁 Script executed:

#!/bin/bash
# Count total handle method implementations
rg -c 'async fn handle' --type rust src/rpc/methods/

Length of output: 486


🏁 Script executed:

#!/bin/bash
# Get all handle method signatures with full context
rg -n 'async fn handle' --type rust src/rpc/methods/ -A3 | wc -l

Length of output: 4


🏁 Script executed:

#!/bin/bash
# Check if Extensions is imported anywhere
rg 'use.*Extensions' --type rust src/rpc/

Length of output: 51


@hanabi1224, I'll create a PR to add the _: http::Extensions parameter to all RpcMethod::handle implementations. Based on my analysis, there are approximately 241 handle methods across 18 files that need to be updated.

Task: Add _: http::Extensions parameter to all RpcMethod::handle implementations

This change updates all RpcMethod trait implementations to include the new ext: Extensions parameter as defined in the trait signature. Since these implementations don't currently use this parameter, it will be named with a leading underscore _ to indicate it's intentionally unused.

Files to modify:

  1. src/rpc/methods/auth.rs (2 methods)
  2. src/rpc/methods/beacon.rs (1 method)
  3. src/rpc/methods/chain.rs (28 methods)
  4. src/rpc/methods/common.rs (4 methods)
  5. src/rpc/methods/eth.rs (61 methods)
  6. src/rpc/methods/eth/pubsub.rs (3 methods)
  7. src/rpc/methods/f3.rs (22 methods)
  8. src/rpc/methods/gas.rs (4 methods)
  9. src/rpc/methods/market.rs (1 method)
  10. src/rpc/methods/miner.rs (2 methods)
  11. src/rpc/methods/misc.rs (1 method)
  12. src/rpc/methods/mpool.rs (8 methods)
  13. src/rpc/methods/msig.rs (4 methods)
  14. src/rpc/methods/net.rs (13 methods)
  15. src/rpc/methods/node.rs (1 method)
  16. src/rpc/methods/state.rs (69 methods)
  17. src/rpc/methods/sync.rs (5 methods)
  18. src/rpc/methods/wallet.rs (13 methods)

🏁 Script executed:

#!/bin/bash
# Generate a comprehensive list of all handle methods that need updating
echo "=== Files and their handle method counts ==="
rg -c 'async fn handle' --type rust src/rpc/methods/

echo ""
echo "=== Sample of handle method signatures to verify the pattern ==="
rg -n 'async fn handle' --type rust src/rpc/methods/auth.rs -A3
rg -n 'async fn handle' --type rust src/rpc/methods/beacon.rs -A3
rg -n 'async fn handle' --type rust src/rpc/methods/market.rs -A3
rg -n 'async fn handle' --type rust src/rpc/methods/misc.rs -A3
rg -n 'async fn handle' --type rust src/rpc/methods/node.rs -A3

Length of output: 1626


Perfect! I can now see the pattern clearly. Let me finalize the plan to update all 241 handle methods across the 18 files.

Task: Add _: http::Extensions parameter to all RpcMethod::handle implementations

Update all RpcMethod trait implementations to match the trait signature by adding the ext: Extensions parameter. Since the implementations don't currently use this parameter, it will be named with a leading underscore.

Pattern to apply:

// FROM:
async fn handle(
    ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
    params: Self::Params,
) -> Result<Self::Ok, ServerError>

// TO:
async fn handle(
    ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
    params: Self::Params,
    _: http::Extensions,
) -> Result<Self::Ok, ServerError>

This PR will systematically update all 241 handle method implementations across 18 files to match the RpcMethod trait signature by adding the _: http::Extensions parameter.


🧠 Learnings used
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.

💡 Use @coderabbitai plan to create a plan for code changes

@hanabi1224
Copy link
Contributor Author

@coderabbitai generate a patch to fill _: http::Extensions in all RpcMethod::handle trait method

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@hanabi1224, I'll generate a comprehensive patch file to add _: http::Extensions to all RpcMethod::handle implementations. Let me create this for you.


🏁 Script executed:

#!/bin/bash

# List of all files that need updating
files=(
  "src/rpc/methods/auth.rs"
  "src/rpc/methods/beacon.rs"
  "src/rpc/methods/chain.rs"
  "src/rpc/methods/common.rs"
  "src/rpc/methods/eth.rs"
  "src/rpc/methods/eth/pubsub.rs"
  "src/rpc/methods/f3.rs"
  "src/rpc/methods/gas.rs"
  "src/rpc/methods/market.rs"
  "src/rpc/methods/miner.rs"
  "src/rpc/methods/misc.rs"
  "src/rpc/methods/mpool.rs"
  "src/rpc/methods/msig.rs"
  "src/rpc/methods/net.rs"
  "src/rpc/methods/node.rs"
  "src/rpc/methods/state.rs"
  "src/rpc/methods/sync.rs"
  "src/rpc/methods/wallet.rs"
)

# Create a unified patch
echo "Creating patch file..."

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    # Create a backup
    cp "$file" "$file.bak"
    
    # Add the parameter to all handle method signatures
    # This looks for lines with "params: Self::Params," and adds the Extensions parameter on the next line
    sed -i '/params: Self::Params,$/a\        _: http::Extensions,' "$file"
    
    # Generate diff for this file
    diff -u "$file.bak" "$file" || true
    
    # Restore original
    mv "$file.bak" "$file"
  fi
done

Length of output: 22


Let me examine the actual format of the handle methods first:


🏁 Script executed:

#!/bin/bash

# Check the actual format of handle methods
echo "=== Sample from auth.rs ==="
rg -A5 'async fn handle' src/rpc/methods/auth.rs | head -20

echo ""
echo "=== Sample from beacon.rs ==="
rg -A5 'async fn handle' src/rpc/methods/beacon.rs | head -20

echo ""
echo "=== Sample from chain.rs ==="
rg -A5 'async fn handle' src/rpc/methods/chain.rs | head -40

Length of output: 2241


@hanabi1224 Got it — the earlier attempt didn’t match the real signatures because they use tuple patterns like (first,): Self::Params, rather than params: Self::Params,. I’ll generate a robust patch now by parsing each async fn handle signature and inserting _: http::Extensions, immediately after the Self::Params, line, skipping any that already include the Extensions param.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find all Rust files under src/rpc/methods that define `async fn handle`
mapfile -t FILES < <(rg -l --type rust 'async\s+fn\s+handle\s*\(' src/rpc/methods)

PATCH_FILE="rpc-extensions-param.patch"
: > "$PATCH_FILE"

gen_patched() {
python - "$1" << 'PYCODE'
import sys, re, io, os
path = sys.argv[1]
with open(path, 'r', encoding='utf-8') as f:
    lines = f.readlines()

out = []
in_sig = False
saw_ext = False

params_line_re = re.compile(r'^\s*\([^)]*\)\s*:\s*Self::Params,\s*(?://.*)?$')
end_sig_re = re.compile(r'^\s*\)\s*->')

changed = False

for line in lines:
    if not in_sig:
        out.append(line)
        if re.search(r'\basync\s+fn\s+handle\s*\(', line):
            in_sig = True
            saw_ext = False
        continue

    # in signature
    if 'http::Extensions' in line:
        saw_ext = True

    if params_line_re.match(line) and not saw_ext:
        out.append(line)
        indent = re.match(r'^(\s*)', line).group(1)
        out.append(f'{indent}_: http::Extensions,\\n')
        saw_ext = True
        changed = True
        continue

    out.append(line)

    if end_sig_re.match(line):
        in_sig = False
        saw_ext = False

text_new = ''.join(out)
sys.stdout.write(text_new)
PYCODE
}

had_diff=0
for f in "${FILES[@]}"; do
  # Generate a tentative patched version to compare
  NEW_CONTENT="$(gen_patched "$f")"
  # Write to a temp file for diffing
  tmp="$(mktemp)"
  printf "%s" "$NEW_CONTENT" > "$tmp"

  if ! diff -u "$f" "$tmp" >/dev/null 2>&1; then
    # append unified diff to patch file
    diff -u "$f" "$tmp" >> "$PATCH_FILE" || true
    had_diff=1
  fi
  rm -f "$tmp"
done

if [ "$had_diff" -eq 1 ]; then
  echo "=== BEGIN UNIFIED DIFF ==="
  cat "$PATCH_FILE"
  echo "=== END UNIFIED DIFF ==="
else
  echo "No changes needed. All handle() signatures already include http::Extensions."
fi

Length of output: 56


Let me fix the script to avoid the process substitution issue:


🏁 Script executed:

#!/bin/bash

# Find all files with async fn handle
rg -l --type rust 'async\s+fn\s+handle\s*\(' src/rpc/methods > /tmp/handle_files.txt

echo "=== Generating patch for RpcMethod::handle implementations ==="
echo ""

# Python script to patch a single file
cat > /tmp/patch_handle.py << 'PYEOF'
import sys
import re

def patch_file(path):
    with open(path, 'r', encoding='utf-8') as f:
        lines = f.readlines()
    
    out = []
    in_sig = False
    saw_ext = False
    
    params_line_re = re.compile(r'^\s*\([^)]*\)\s*:\s*Self::Params,\s*(?://.*)?$')
    end_sig_re = re.compile(r'^\s*\)\s*->')
    
    for line in lines:
        if not in_sig:
            out.append(line)
            if re.search(r'\basync\s+fn\s+handle\s*\(', line):
                in_sig = True
                saw_ext = False
            continue
        
        # Check if Extensions already present
        if 'http::Extensions' in line:
            saw_ext = True
        
        # If this is the Self::Params line and we haven't seen Extensions
        if params_line_re.match(line) and not saw_ext:
            out.append(line)
            indent = re.match(r'^(\s*)', line).group(1)
            out.append(f'{indent}_: http::Extensions,\n')
            saw_ext = True
            continue
        
        out.append(line)
        
        if end_sig_re.match(line):
            in_sig = False
            saw_ext = False
    
    return ''.join(out)

if __name__ == '__main__':
    result = patch_file(sys.argv[1])
    sys.stdout.write(result)
PYEOF

# Process each file
total_changes=0
while IFS= read -r filepath; do
    # Generate patched version
    patched=$(python /tmp/patch_handle.py "$filepath")
    
    # Write to temp file
    echo "$patched" > /tmp/patched_file.tmp
    
    # Generate diff
    if diff -u "$filepath" /tmp/patched_file.tmp > /tmp/current.diff 2>&1; then
        : # No diff
    else
        # Print the diff
        cat /tmp/current.diff
        echo ""
        total_changes=$((total_changes + 1))
    fi
done < /tmp/handle_files.txt

echo "=== Summary ==="
echo "Files with changes: $total_changes"

Length of output: 43283


@hanabi1224, here's the complete unified patch to add _: http::Extensions to all RpcMethod::handle implementations:

Details The patch updates **132 handle methods** across **15 files**:

Files modified:

  • src/rpc/methods/auth.rs (2 methods)
  • src/rpc/methods/beacon.rs (1 method)
  • src/rpc/methods/chain.rs (16 methods)
  • src/rpc/methods/common.rs (1 method - note: 1 method already has the param)
  • src/rpc/methods/eth.rs (58 methods)
  • src/rpc/methods/f3.rs (13 methods)
  • src/rpc/methods/gas.rs (4 methods)
  • src/rpc/methods/market.rs (1 method)
  • src/rpc/methods/miner.rs (1 method)
  • src/rpc/methods/misc.rs (1 method)
  • src/rpc/methods/mpool.rs (6 methods)
  • src/rpc/methods/net.rs (6 methods)
  • src/rpc/methods/state.rs (10 methods)
  • src/rpc/methods/sync.rs (3 methods)
  • src/rpc/methods/wallet.rs (10 methods)

Note: In src/rpc/methods/common.rs, the Session UUID method already has the http::Extensions parameter, so the patch would add a duplicate. You can manually edit that section of the patch to remove the duplicate addition before applying, or just ignore that hunk when applying the patch.

To apply the patch:

Save the patch content to a file (e.g., rpc-extensions.patch) and apply it with:

patch -p0 < rpc-extensions.patch

Or apply it with git:

git apply rpc-extensions.patch

The complete patch is shown in the script output above. Would you like me to generate a cleaned-up version that excludes the duplicate in common.rs?


🧠 Learnings used
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.

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.

@hanabi1224
Copy link
Contributor Author

@coderabbitai go ahead with the plan and create a PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Tip

For best results, initiate chat on the files or code changes.

@hanabi1224, I'll create a PR to add the _: http::Extensions parameter to all RpcMethod::handle implementations.

Task: Add _: http::Extensions parameter to all RpcMethod::handle implementations

This mechanical transformation updates 132 handle methods across 15 files to match the RpcMethod trait signature by adding the unused Extensions parameter.

Pattern:

// Add after Self::Params line:
_: http::Extensions,

🧠 Learnings used
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.

💡 Use @coderabbitai plan to create a plan for code changes

@hanabi1224 hanabi1224 marked this pull request as ready for review February 24, 2026 17:23
@hanabi1224 hanabi1224 requested a review from a team as a code owner February 24, 2026 17:23
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team February 24, 2026 17:23
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/rpc/methods/state.rs (1)

108-115: ⚠️ Potential issue | 🔴 Critical

Add missing http import to resolve compilation error.

The code uses http::Extensions throughout the method signatures without importing http. Add use http::Extensions; to the imports at the top of the file, or use use http; if the full path is preferred. Without this import, the code will not compile.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/state.rs` around lines 108 - 115, The compiler error is
caused by missing import for the http::Extensions type used in the handle
signature; add an import for http::Extensions at the top of the file (e.g., `use
http::Extensions;`) or `use http;` so the handle function declaration (async fn
handle(ctx: Ctx<impl Blockstore + Send + Sync + 'static>, (message,
ApiTipsetKey(tsk)): Self::Params, _: &http::Extensions) -> Result<Self::Ok,
ServerError>)` can resolve the http symbol.
🧹 Nitpick comments (1)
src/rpc/methods/chain.rs (1)

205-208: Consider threading the caller’s Extensions instead of Default::default().
If extensions start carrying request context, these internal F3 calls will drop it. Passing through the same Extensions would preserve consistency.

Also applies to: 1112-1114

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/chain.rs` around lines 205 - 208, The call to
crate::rpc::f3::F3GetLatestCertificate::handle uses Default::default() for
Extensions which drops caller request context; replace Default::default() with
the caller's Extensions taken from ctx (e.g., use
ctx.extensions()/ctx.extensions.clone() or the appropriate accessor) so the same
Extensions are threaded through, and apply the same change for the other
internal F3 handle call sites (the other F3GetLatestCertificate::handle usages
around the later block).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/rpc/methods/eth.rs`:
- Around line 4234-4238: Eth_trace replay handlers are dropping per-request
extensions by using `_` and passing &Default::default() into
EthGetTransactionHashByCid::handle; change the parameter name `_` to `ext` in
EthTraceReplayBlockTransactions::handle and
EthTraceReplayBlockTransactionsV2::handle, update the trace replay helper
signature to accept ext: &http::Extensions, and forward that ext through to the
inner call to EthGetTransactionHashByCid::handle so the real request extensions
are preserved.

---

Outside diff comments:
In `@src/rpc/methods/state.rs`:
- Around line 108-115: The compiler error is caused by missing import for the
http::Extensions type used in the handle signature; add an import for
http::Extensions at the top of the file (e.g., `use http::Extensions;`) or `use
http;` so the handle function declaration (async fn handle(ctx: Ctx<impl
Blockstore + Send + Sync + 'static>, (message, ApiTipsetKey(tsk)): Self::Params,
_: &http::Extensions) -> Result<Self::Ok, ServerError>)` can resolve the http
symbol.

---

Nitpick comments:
In `@src/rpc/methods/chain.rs`:
- Around line 205-208: The call to
crate::rpc::f3::F3GetLatestCertificate::handle uses Default::default() for
Extensions which drops caller request context; replace Default::default() with
the caller's Extensions taken from ctx (e.g., use
ctx.extensions()/ctx.extensions.clone() or the appropriate accessor) so the same
Extensions are threaded through, and apply the same change for the other
internal F3 handle call sites (the other F3GetLatestCertificate::handle usages
around the later block).

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 442e716 and 8bd5d45.

📒 Files selected for processing (20)
  • src/rpc/methods/auth.rs
  • src/rpc/methods/beacon.rs
  • src/rpc/methods/chain.rs
  • src/rpc/methods/common.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/f3.rs
  • src/rpc/methods/gas.rs
  • src/rpc/methods/market.rs
  • src/rpc/methods/miner.rs
  • src/rpc/methods/misc.rs
  • src/rpc/methods/mpool.rs
  • src/rpc/methods/msig.rs
  • src/rpc/methods/net.rs
  • src/rpc/methods/node.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/sync.rs
  • src/rpc/methods/wallet.rs
  • src/rpc/reflect/mod.rs
  • src/tool/subcommands/api_cmd/generate_test_snapshot.rs
  • src/tool/subcommands/api_cmd/test_snapshot.rs

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: 1

♻️ Duplicate comments (1)
src/rpc/methods/eth.rs (1)

4234-4334: Covered in prior review.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/eth.rs` around lines 4234 - 4334, The two RpcMethod::handle
implementations for EthTraceReplayBlockTransactions and
EthTraceReplayBlockTransactionsV2 duplicate the same validation and replay
logic; consolidate by extracting the common logic (trace_types check, tipset
resolution, and call to eth_trace_replay_block_transactions) into a single
helper or have V2 call the same shared helper used by V1. Specifically, keep
eth_trace_replay_block_transactions as the replay worker, and in
EthTraceReplayBlockTransactions::handle and
EthTraceReplayBlockTransactionsV2::handle only perform the trace_types
validation then call a shared function that resolves the tipset (use
tipset_by_ext_block_number_or_hash or tipset_by_block_number_or_hash_v2 as
appropriate) and then invokes eth_trace_replay_block_transactions(ctx, &ts,
ext). Ensure you remove the duplicated loop/logic from the handles so both impls
reuse the same helper and fix any incorrect arguments passed to the tipset
resolution functions (match the expected signatures for
tipset_by_ext_block_number_or_hash and tipset_by_block_number_or_hash_v2).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/rpc/methods/f3.rs`:
- Around line 665-673: Add a doc comment to the public async helper
F3GetLatestCertificate::get describing its purpose (fetches the latest
FinalityCertificate via the RPC client), the return value
(anyhow::Result<FinalityCertificate>), and failure modes (propagates RPC or
client creation errors); place the doc comment immediately above the impl or the
get method and reference that it uses get_rpc_http_client() and the RPC method
name via RpcMethod::NAME so readers understand it performs an RPC request and
can fail with an anyhow error.

---

Duplicate comments:
In `@src/rpc/methods/eth.rs`:
- Around line 4234-4334: The two RpcMethod::handle implementations for
EthTraceReplayBlockTransactions and EthTraceReplayBlockTransactionsV2 duplicate
the same validation and replay logic; consolidate by extracting the common logic
(trace_types check, tipset resolution, and call to
eth_trace_replay_block_transactions) into a single helper or have V2 call the
same shared helper used by V1. Specifically, keep
eth_trace_replay_block_transactions as the replay worker, and in
EthTraceReplayBlockTransactions::handle and
EthTraceReplayBlockTransactionsV2::handle only perform the trace_types
validation then call a shared function that resolves the tipset (use
tipset_by_ext_block_number_or_hash or tipset_by_block_number_or_hash_v2 as
appropriate) and then invokes eth_trace_replay_block_transactions(ctx, &ts,
ext). Ensure you remove the duplicated loop/logic from the handles so both impls
reuse the same helper and fix any incorrect arguments passed to the tipset
resolution functions (match the expected signatures for
tipset_by_ext_block_number_or_hash and tipset_by_block_number_or_hash_v2).

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bd5d45 and 7a5f196.

📒 Files selected for processing (20)
  • src/rpc/methods/auth.rs
  • src/rpc/methods/beacon.rs
  • src/rpc/methods/chain.rs
  • src/rpc/methods/common.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/f3.rs
  • src/rpc/methods/gas.rs
  • src/rpc/methods/market.rs
  • src/rpc/methods/miner.rs
  • src/rpc/methods/misc.rs
  • src/rpc/methods/mpool.rs
  • src/rpc/methods/msig.rs
  • src/rpc/methods/net.rs
  • src/rpc/methods/node.rs
  • src/rpc/methods/state.rs
  • src/rpc/methods/sync.rs
  • src/rpc/methods/wallet.rs
  • src/rpc/reflect/mod.rs
  • src/tool/subcommands/api_cmd/generate_test_snapshot.rs
  • src/tool/subcommands/api_cmd/test_snapshot.rs
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/tool/subcommands/api_cmd/test_snapshot.rs
  • src/rpc/methods/miner.rs
  • src/rpc/methods/auth.rs
  • src/rpc/methods/sync.rs
  • src/rpc/methods/mpool.rs
  • src/rpc/methods/node.rs
  • src/rpc/methods/beacon.rs

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 52.30024% with 197 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.50%. Comparing base (442e716) to head (1ff947a).

Files with missing lines Patch % Lines
src/rpc/methods/f3.rs 6.66% 54 Missing and 2 partials ⚠️
src/rpc/methods/net.rs 0.00% 41 Missing ⚠️
src/rpc/methods/chain.rs 57.44% 18 Missing and 2 partials ⚠️
src/rpc/methods/wallet.rs 28.00% 18 Missing ⚠️
src/rpc/methods/eth.rs 82.05% 12 Missing and 2 partials ⚠️
src/rpc/methods/common.rs 50.00% 10 Missing ⚠️
src/rpc/methods/state.rs 87.17% 9 Missing and 1 partial ⚠️
src/rpc/methods/mpool.rs 11.11% 8 Missing ⚠️
src/rpc/methods/sync.rs 78.57% 6 Missing ⚠️
src/rpc/methods/node.rs 0.00% 5 Missing ⚠️
... and 6 more
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/methods/beacon.rs 81.81% <100.00%> (+1.81%) ⬆️
src/rpc/methods/misc.rs 89.28% <100.00%> (+0.39%) ⬆️
src/rpc/methods/msig.rs 72.22% <100.00%> (+1.63%) ⬆️
src/tool/subcommands/api_cmd/test_snapshot.rs 85.31% <100.00%> (+0.20%) ⬆️
src/rpc/methods/auth.rs 33.33% <50.00%> (+0.77%) ⬆️
src/rpc/methods/miner.rs 7.91% <50.00%> (+0.61%) ⬆️
src/rpc/reflect/mod.rs 68.65% <50.00%> (ø)
src/rpc/methods/gas.rs 86.49% <50.00%> (-0.39%) ⬇️
src/rpc/methods/market.rs 0.00% <0.00%> (ø)
...tool/subcommands/api_cmd/generate_test_snapshot.rs 0.00% <0.00%> (ø)
... and 10 more

... and 3 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 442e716...1ff947a. 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 added the RPC requires calibnet RPC checks to run on CI label Feb 24, 2026
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.

1 participant