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

Diff Detail

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

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 ↗(On Diff #20514)

OMITTED

2081 ↗(On Diff #20514)

Dito

2506 ↗(On Diff #20514)

Dito

2511 ↗(On Diff #20514)

Dito

src/rpc/mining.cpp
387 ↗(On Diff #20514)

RPCArg::Optional::NO

src/rpc/misc.cpp
201 ↗(On Diff #20514)

Layout

205 ↗(On Diff #20514)

Dito

src/rpc/rawtransaction.cpp
97 ↗(On Diff #20514)

OMITTED_NAMED_ARGS

278 ↗(On Diff #20514)

OMITTED

282 ↗(On Diff #20514)

OMITTED_NAMED_ARGS

456 ↗(On Diff #20514)

OMITTED

484 ↗(On Diff #20514)

OMITTED

695 ↗(On Diff #20514)

OMITTED

799 ↗(On Diff #20514)

OMITTED

806 ↗(On Diff #20514)

OMITTED_NAMED_ARGS

812 ↗(On Diff #20514)

OMITTED_NAMED_ARGS

822 ↗(On Diff #20514)

There is a hint in the default value :)

973 ↗(On Diff #20514)

OMITTED

1370 ↗(On Diff #20514)

OMITTED

1501 ↗(On Diff #20514)

OMITTED

1529 ↗(On Diff #20514)

OMITTED

1543 ↗(On Diff #20514)

OMITTED

This revision now requires changes to proceed.May 22 2020, 16:16
Fabien added inline comments.
src/rpc/rawtransaction.cpp
812 ↗(On Diff #20514)

Still missing

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