Page MenuHomePhabricator

Assert that RPCArg names are equal to CRPCCommand ones (abc, avalanche)
ClosedPublic

Authored by PiRK on Dec 23 2021, 16:08.

Details

Summary

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 CRPCCommands 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 D10741 for a list of bugs that have been found as a result of the changes here.

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

This should be the final diff related to core#18531.

Depends on D10741

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Dec 23 2021, 16:08
PiRK planned changes to this revision.Dec 23 2021, 16:50

there is one more RPC to tackle in rpc/abc.cpp

PiRK retitled this revision from Assert that RPCArg names are equal to CRPCCommand ones (avalanche) to Assert that RPCArg names are equal to CRPCCommand ones (abc, valanche).

include the final RPC command from rpc/abc.cpp

This revision is now accepted and ready to land.Jan 3 2022, 07:19
PiRK retitled this revision from Assert that RPCArg names are equal to CRPCCommand ones (abc, valanche) to Assert that RPCArg names are equal to CRPCCommand ones (abc, avalanche).Jan 3 2022, 14:05