Page MenuHomePhabricator

RPCHelpMan: Check default values are given at compile-time
ClosedPublic

Authored by deadalnix on May 13 2020, 22:57.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC20bb047dd3a5: RPCHelpMan: Check default values are given at compile-time
Summary

This is a backport of Core PR14918

In order to automate somewhat the process, I used the following commands:

sed -n '1h; 1!H; ${ g; s@/\* opt \*/ true,\n \+@/* opt */ true, @g; p}' -i ../src/wallet/rpc*.cpp ../src/rpc/*.cpp
sed -n '1h; 1!H; ${ g; s@/\* opt \*/ false,\n \+@/* opt */ false, @g; p}' -i ../src/wallet/rpc*.cpp ../src/rpc/*.cpp
sed -e 's@/\* opt \*/ false, /\* default_val \*/ ""@RPCArg::Optional::NO@' -i ../src/wallet/rpc*.cpp ../src/rpc/*.cpp
# Manual edit for OMITTED and OMITTED_NAMED_ARG
sed -e 's@/\* opt \*/ true, /\* default_val \*/@/* default */@' -i ../src/wallet/rpc*.cpp ../src/rpc/*.cpp
Test Plan
ninja all check-all

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

You're missing the transformation from /* opt */ true, /* default_val */ "" to RPCArg::Optional::OMITTED. See getchaintxstats for an example.

Fabien requested changes to this revision.May 14 2020, 10:50
This revision now requires changes to proceed.May 14 2020, 10:50

Rebase and various manual fixups

Fabien requested changes to this revision.May 22 2020, 16:16
Fabien added inline comments.
src/rpc/blockchain.cpp
2079

OMITTED

2081

Dito

2506

Dito

2511

Dito

src/rpc/mining.cpp
387

RPCArg::Optional::NO

src/rpc/misc.cpp
201

Layout

205

Dito

src/rpc/rawtransaction.cpp
97

OMITTED_NAMED_ARGS

278

OMITTED

282

OMITTED_NAMED_ARGS

456

OMITTED

484

OMITTED

695

OMITTED

799

OMITTED

806

OMITTED_NAMED_ARGS

812

OMITTED_NAMED_ARGS

822

There is a hint in the default value :)

973

OMITTED

1370

OMITTED

1501

OMITTED

1529

OMITTED

1543

OMITTED

This revision now requires changes to proceed.May 22 2020, 16:16
Fabien added inline comments.
src/rpc/rawtransaction.cpp
812

Still missing

This revision is now accepted and ready to land.May 22 2020, 17:09