mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:44:38 +00:00
rpc: Use self.Arg<_>(name) helper over manual and duplicate parsing #36384
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36384
Loading…
Reference in a new issue
No description provided.
Delete branch "2609-rpc-arg-defaults-duplicate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
Arg()helper has many benefits:isNullchecksSo use it more broadly.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
-Wunusedby fanquake)CAmounta class by hodlinator)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🔵 Suggestion · The new generatetoaddress maxtries range lacks regression coverage
The existing tests would not detect reverting generatetoaddress from unsigned 64-bit maxtries parsing to the old signed-int parser.
Location:
src/rpc/mining.cpp:317(head).🔵 Suggestion · Keep the direct
<iterator>includesrc/rpc/util.cpp:778 (std::distance) and :1376 (std::back_inserter) still use symbols after this PR swapped the include for . C++20 guarantees this compiles, but developer-notes.md:1099 asks for direct includes. IWYU outcome unverified.
Location:
src/rpc/util.cpp:772(head).🔵 Suggestion · The helper unit test misses the two new Arg specializations
src/rpc/util.cpp:738/740 add Arg and Arg<int64_t> for estimaterawfee's threshold and setban's bantime. rpc_arg_helper never calls either and only uses MaybeArg. The callers are covered only indirectly by functional tests.
Location:
src/rpc/util.cpp:735(head).Review coverage was incomplete.
Reviewed:
fa7b2d05387e· Full review report · Previous reportspermalink
🚧 At least one of the CI tasks failed.
Task
iwyu: https://github.com/bitcoin/bitcoin/actions/runs/36623882963/job/109595800670LLM reason (✨ experimental): CI failed because IWYU detected incorrect/missing includes and triggered a “Failure generated from IWYU” (returned exit code 1).
Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
Concept ACK
Forgot to say that everything here is a refactor, except for the cleanup commit that changes the schema of one RPC:
rebased and replied to ralph
@RalphLLM removing this is correct when ranges is included, see https://eel.is/c++draft/ranges.syn
Concept ACK
ACK
fa005e85e9Increased
self.Argusage makes RPC code easier and more robust, and this PR is easy to review.nit: helper variables often seem to bring more noise than clarity after this clean up, so i think they could be removed fully in many cases?
git diff on
fa005e85e9nit: would be useful to document this in the interface too:
git diff on
fada6e1dcbnit: people might be tempted to "upgrade" this to accept aliases too (I spent a few cycles thinking about it), so perhaps worth briefly documenting why we only accept first name here?
git diff on
fada6e1dcbnit: commit message states "The test is modified to show the second legacy alias is ignored." but that's not true, unless we do something like
BOOST_CHECK_THROW(self.Arg<bool>("legacy_def_bool"), NonFatalCheckError);- which I think we should if only allowing the first name is intentional (cfr this comment)Hmm, this may change the parsing order, so I think I'll leave this as-is for now to keep it a "refactor" that is easy to review.
re-ACK
fa7b2d0538No changes except for addressing doc and test change suggestions.
ACK
fa7b2d0538We can do more similar cleanups in future. i.e:
Nice!