Uh oh!
There was an error while loading. Please reload this page.
refactor(rpc): make RpcMethod DESCRIPTION mandatory - #7280
Conversation
Change the `RpcMethod::DESCRIPTION` associated constant from `Option<&'static str>` (defaulting to `None`) to a required `&'static str`. Every method already provides a description, so the compiler now guarantees that future methods do too, keeping the OpenRPC documentation eternally up to date. Existing `Some(...)` values are converted to the bare string literals, and the OpenRPC reflection now wraps the description in `Some(...)` at the single consumption site. The generated spec is unchanged. ClosesChainSafe#7210
WalkthroughThe RpcMethod trait's DESCRIPTION associated constant is changed from ChangesRPC DESCRIPTION constant type change
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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 2295-2297: The DESCRIPTION string in the storage-at-position RPC
method is unintentionally embedding a newline and indentation, which will be
included in the OpenRPC output. Update the DESCRIPTION constant in the eth.rs
method definition to use a single-line literal or explicit
concatenation/continuation so the value is clean and does not contain hidden
whitespace.
🪄 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: e5aec9f2-f023-40b3-9db7-71873d889e1b
📒 Files selected for processing (18)
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/gas.rssrc/rpc/methods/market.rssrc/rpc/methods/miner.rssrc/rpc/methods/misc.rssrc/rpc/methods/mpool.rssrc/rpc/methods/msig.rssrc/rpc/methods/net.rssrc/rpc/methods/node.rssrc/rpc/methods/state.rssrc/rpc/methods/sync.rssrc/rpc/methods/wallet.rssrc/rpc/reflect/mod.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
filecoin-project/lotus(manual)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary of changes
Now that all RPC methods provide a
DESCRIPTION(#6460 / #7209), this makes the constant mandatory so the documentation stays up to date going forward.Changes introduced in this pull request:
RpcMethod::DESCRIPTIONfromOption<&'static str>(defaulting toNone) to a requiredconst DESCRIPTION: &'static str. Any new method that forgets a description now fails to compile.Some("...")values across all method impls to the bare string literals.Some(...). The generated spec is unchanged.Reference issue to close (if applicable)
Closes#7210
Other information and links
Every method already set a description, so this is a mechanical change plus the trait tweak. The OpenRPC snapshot tests (
openrpc_v0/v1/v2) pass unchanged, confirming the generated spec is identical.Change checklist
Outside contributions
Summary by CodeRabbit