feat: add DESCRIPTION to all missing RPC methods#7070
Conversation
|
|
WalkthroughThis PR adds ChangesRPC Method Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/rpc/methods/eth.rs`:
- Around line 2743-2745: The RpcMethod descriptions for EthUnsubscribe and
EthSubscribe are misleading because their PARAM_NAMES arrays are empty; either
change the DESCRIPTION constants to match the no-parameter metadata (e.g., for
EthUnsubscribe use a neutral phrase like "Cancels a subscription." and for
EthSubscribe use "Creates a subscription.") or add the actual parameter names to
the PARAM_NAMES arrays and update the method implementations to accept those
params. Locate the DESCRIPTION and PARAM_NAMES constants for EthUnsubscribe and
EthSubscribe and make the descriptions and parameter metadata consistent (update
DESCRIPTION text if you want zero-param docs, or populate PARAM_NAMES and
signatures if these methods should accept params).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e53e6856-9b9f-41a0-bbb7-320eea2d8da2
📒 Files selected for processing (13)
src/rpc/methods/auth.rssrc/rpc/methods/beacon.rssrc/rpc/methods/chain.rssrc/rpc/methods/common.rssrc/rpc/methods/eth.rssrc/rpc/methods/f3.rssrc/rpc/methods/market.rssrc/rpc/methods/msig.rssrc/rpc/methods/net.rssrc/rpc/methods/node.rssrc/rpc/methods/state.rssrc/rpc/methods/sync.rssrc/rpc/methods/wallet.rs
| const DESCRIPTION: Option<&'static str> = | ||
| Some("Cancels the subscription with the given ID."); | ||
| const PARAM_NAMES: [&'static str; 0] = []; |
There was a problem hiding this comment.
Description text is inconsistent with the exposed subscription method metadata.
On Line 2744, EthUnsubscribe says it cancels a subscription “with the given ID”, but this RpcMethod exposes zero params.
On Line 2772, EthSubscribe says “specified events”, but it also exposes zero params.
Because these descriptions are now surfaced in OpenRPC, this creates misleading API docs. Please align wording with the placeholder/no-param metadata (or expose actual params if these methods should document them here).
Suggested wording-only fix
- const DESCRIPTION: Option<&'static str> =
- Some("Cancels the subscription with the given ID.");
+ const DESCRIPTION: Option<&'static str> =
+ Some("Cancels an active subscription.");
- const DESCRIPTION: Option<&'static str> =
- Some("Creates a subscription to specified events.");
+ const DESCRIPTION: Option<&'static str> =
+ Some("Creates an event subscription.");Also applies to: 2771-2773
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/rpc/methods/eth.rs` around lines 2743 - 2745, The RpcMethod descriptions
for EthUnsubscribe and EthSubscribe are misleading because their PARAM_NAMES
arrays are empty; either change the DESCRIPTION constants to match the
no-parameter metadata (e.g., for EthUnsubscribe use a neutral phrase like
"Cancels a subscription." and for EthSubscribe use "Creates a subscription.") or
add the actual parameter names to the PARAM_NAMES arrays and update the method
implementations to accept those params. Locate the DESCRIPTION and PARAM_NAMES
constants for EthUnsubscribe and EthSubscribe and make the descriptions and
parameter metadata consistent (update DESCRIPTION text if you want zero-param
docs, or populate PARAM_NAMES and signatures if these methods should accept
params).
Summary
const DESCRIPTIONto all 96RpcMethodimplementations that were missing itSelf::DESCRIPTIONinreflect/mod.rsCloses #6460
Test plan
cargo checkpasses (pre-existing local env issue with spaces in path is unrelated)Self::DESCRIPTIONmaps to thedescriptionfield in the OpenRPC method descriptor (src/rpc/reflect/mod.rs:242) — same wiring used by the 133 already-described methodsSummary by CodeRabbit