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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.May 13 2020, 22:57
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 13 2020, 22:57
deadalnix requested review of this revision.May 13 2020, 22:57
teamcity edited the summary of this revision. (Show Details)May 13 2020, 22:58

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

Fabien added a subscriber: Fabien.May 14 2020, 10:49

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
deadalnix edited the summary of this revision. (Show Details)May 18 2020, 14:29
deadalnix updated this revision to Diff 20514.May 22 2020, 15:15

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
deadalnix added inline comments.May 22 2020, 17:03
src/rpc/mining.cpp
387 ↗(On Diff #20514)
deadalnix updated this revision to Diff 20518.May 22 2020, 17:06

Fix OMITTED

Fabien accepted this revision.May 22 2020, 17:09
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