-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Remove duplicate name and argNames from CRPCCommand #20012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cdf900b
to
4f2ed2f
Compare
Concept ACK |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
4f2ed2f
to
fa6aaef
Compare
fa247fc
to
fafd58e
Compare
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK fafd58e. Nice cleanup which gets rid of some parameter repetition dealing with RPCs. It's also nice to drop some c++ parsing code. The previous asserts and new test updates seem to make this pretty foolproof and ensure there's no change in behavior.
Much tidier! |
fafd58e
to
fab5a77
Compare
fab5a77
to
fa04f9b
Compare
Rebased, should be trivial to re-ACK |
@laanwj As the author of |
ACK fa04f9b |
UniValue ret{UniValue::VARR}; | ||
for (const auto& cmd : mapCommands) { | ||
for (const auto& c : cmd.second) { | ||
const auto help = RpcMethodFnType(c->unique_id)(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "rpc: Use RPCHelpMan for check-rpc-mappings linter" (fa92912)
I missed this in initial review, but this cast from unique_id to function pointer isn't really safe. Or at least it results in segfaults with #10102 (https://cirrus-ci.com/task/5469433013469184?command=ci#L2275). The unique_id field was really only supposed to be used to detect RPC aliases, not be converted to a function pointer and called. #21035 updates this to take a different approach making arg retrieval work more like help retrieval.
Updated auxpow RPCs for bitcoin/bitcoin#20012.
Updated name RPCs for bitcoin/bitcoin#20012. The rpc_help.py regtest now verifies that arguments with a certain name (independent of the underlying method) are either converted or not by the RPC client. This causes a mismatch between the name RPCs' "value" (which is a string and not converted) and the "setwalletflag" RPC (whose value argument is a bool). To fix this and keep compatibility with name clients, we change the name of setwalletflag's argument to "newvalue".
Summary: This is a backport of [[bitcoin/bitcoin#20012 | core#20012]] [1/3] bitcoin/bitcoin@faf8356 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10759
Summary: This is a backport of [[bitcoin/bitcoin#20012 | core#20012]] [2/3] bitcoin/bitcoin@fa92912 Test Plan: Update linters: `sudo arc liberate` Add errors in RPCHelpMan and make sure they are detected: ``` diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 8bb08769ec..770e8272e9 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -170,6 +170,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { {"buildavalancheproof", 0, "sequence"}, {"buildavalancheproof", 1, "expiration"}, {"buildavalancheproof", 3, "stakes"}, + {"buildavalancheproof", 4, "staks"}, }; class CRPCConvertTable { ``` ``` diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 8bb08769ec..f883869060 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -168,7 +168,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { // Avalanche {"addavalanchenode", 0, "nodeid"}, {"buildavalancheproof", 0, "sequence"}, - {"buildavalancheproof", 1, "expiration"}, + {"buildavalancheproof", 8, "expiration"}, {"buildavalancheproof", 3, "stakes"}, }; ``` `ninja && test/functional/test_runner.py rpc_help` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D10760
Summary: This is a backport of [[bitcoin/bitcoin#20012 | core#20012]] [3/3] bitcoin/bitcoin@fa04f9b Depends on D10760 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10761
Currently, the RPC argument names are specified twice to simplify consistency linting. To avoid having to specify the argnames twice when adding new arguments, remove the linter and add an equivalent test based on RPCHelpMan.