0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-06 10:18:44 -05:00
bitcoin-bitcoin-core/src/rpc
MarcoFalke 31760bb7c9
Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc)
fa77de2baa rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) (MarcoFalke)
fa50bdc755 rpc: Limit echo to 10 args (MarcoFalke)
fa89ca9b5b refactor: Use C++11 range based for loops to simplify rpc code (MarcoFalke)
fa459bdc87 rpc: Treat all args after a hidden arg as hidden as well (MarcoFalke)

Pull request description:

  This is split out from #18531 to just touch the RPC methods in misc. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  laanwj:
    Code review ACK fa77de2baa
  fjahr:
    tested ACK fa77de2baa
  theStack:
    ACK fa77de2baa
  ryanofsky:
    Code review ACK fa77de2baa. Pretty straightfoward changes

Tree-SHA512: badae1606518c0b55ce2c0bb9025d14f05556532375eb20fd6f3bfadae1e5e6568860bff8599d037e655bf1d23f1f464ca17f4db10a6ab3d502b6e9e61c7b3d3
2020-08-14 09:26:37 +02:00
..
blockchain.cpp refactor: Use C++11 range based for loops to simplify rpc code 2020-08-02 21:32:36 +02:00
blockchain.h validation: Make ProcessNewBlock*() members of ChainstateManager 2020-05-21 09:56:16 -04:00
client.cpp Merge #18654: rpc: separate bumpfee's psbt creation function into psbtbumpfee 2020-08-13 12:21:11 +12:00
client.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
mining.cpp Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-14 09:26:37 +02:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
misc.cpp rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-02 21:33:27 +02:00
net.cpp Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-14 09:26:37 +02:00
protocol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
rawtransaction.cpp Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-14 09:26:37 +02:00
rawtransaction_util.cpp refactor: Replace HexStr(o.begin(), o.end()) with HexStr(o) 2020-06-24 18:41:45 +02:00
rawtransaction_util.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
register.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
request.cpp refactor: Make HexStr take a span 2020-08-06 19:41:43 +02:00
request.h Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
server.cpp refactor: Use C++11 range based for loops to simplify rpc code 2020-08-02 21:32:36 +02:00
server.h rpc: Assert that passed arg names are equal to hardcoded ones 2020-07-03 10:32:36 -04:00
util.cpp Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-14 09:26:37 +02:00
util.h Merge #19386: rpc: Assert that RPCArg names are equal to CRPCCommand ones (server) 2020-07-15 19:20:21 +02:00