Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Sep 25, 2020

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.

@promag
Copy link
Contributor

promag commented Sep 25, 2020

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 25, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, 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.

@maflcko
Copy link
Member Author

maflcko commented Jan 12, 2021

Rebased

Copy link
Contributor

@ryanofsky ryanofsky left a 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.

@jonasschnelli
Copy link
Contributor

Much tidier!
Concept ACK

@maflcko maflcko force-pushed the 2009-rpcCheckMapping branch from fafd58e to fab5a77 Compare January 28, 2021 07:17
@maflcko maflcko force-pushed the 2009-rpcCheckMapping branch from fab5a77 to fa04f9b Compare January 28, 2021 07:20
@maflcko
Copy link
Member Author

maflcko commented Jan 28, 2021

Rebased, should be trivial to re-ACK

@maflcko
Copy link
Member Author

maflcko commented Jan 28, 2021

@laanwj As the author of test/lint/check-rpc-mappings.py, could you take a look here on the python changes?

@laanwj
Copy link
Member

laanwj commented Jan 28, 2021

ACK fa04f9b
Not sad to see that script go.

@laanwj laanwj merged commit 80e16ca into bitcoin:master Jan 28, 2021
@maflcko maflcko deleted the 2009-rpcCheckMapping branch January 28, 2021 18:45
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 29, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 29, 2021
UniValue ret{UniValue::VARR};
for (const auto& cmd : mapCommands) {
for (const auto& c : cmd.second) {
const auto help = RpcMethodFnType(c->unique_id)();
Copy link
Contributor

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.

domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Feb 1, 2021
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Feb 1, 2021
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".
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 5, 2022
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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 5, 2022
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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 5, 2022
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants