Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Dec 27, 2019

This enforces most syntax rules of the RPCResult at compile time (or some at run time during unit and functional tests)

Apart from normalizing the syntax, by separating stylistic formatting from the structure, we could in theory directly generate the html for e.g. https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/

@maflcko
Copy link
Member Author

maflcko commented Dec 27, 2019

Currently based on #17804, will squash after that was merged

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 27, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@promag
Copy link
Contributor

promag commented Dec 27, 2019

Concept ACK 👏

Copy link

@paymog paymog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a heroic PR. I left some comments but I didn't finish going through all the code. I'll take a look again after the comments are responded to - I don't want to provide bad comments and I'll calibrate based on how these are received.

However, concept ACK. This is awesome.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worthwhile to add a constructor where these two empty strings aren't needed. It's quite confusing as a reader to see these everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first one is the name and it is only used when it is needed to name it (i.e. as a key in a dictionary). Not sure if it makes sense to omit it from the constructor when it is not needed. I'll wait for others to chime in.

The second string is the description, which should never be empty. Or at least it shouldn't be made easy to leave empty. I prefer if new code is explicit about not providing a description.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NUM_AMOUNT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not. This should be fixed in a follow-up pull request

@jonasschnelli
Copy link
Contributor

Concept ACK. Great to see progress on the RPC output as well..

@cvengler
Copy link
Contributor

Concept ACK

@maflcko
Copy link
Member Author

maflcko commented Jan 24, 2020

Please review #18098 first

@cvengler
Copy link
Contributor

I just ran #17804 and this PR on:

clang version 7.0.1-8 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

The base PR worked fine, however this PR gave me more than 20 errors.
I post the error log here:
https://pastebin.com/G5G6fNMJ

@laanwj
Copy link
Member

laanwj commented Jan 31, 2020

Concept ACK

1 similar comment
@jonatack
Copy link
Member

jonatack commented Feb 7, 2020

Concept ACK

MarcoFalke added 2 commits February 25, 2020 22:33
This is needed so that it can be used by RPCResult

Also,
* rename NAMED_ARG to NONE for generalization.
* change RPCArg constructors to initialize the members by moving values
@maflcko
Copy link
Member Author

maflcko commented Feb 25, 2020

Rebased due to trivial conflict in the includes. Should be easy to re-ACK

@Sjors
Copy link
Member

Sjors commented Feb 25, 2020

Indeed, re-ACK fa6b061

{
{RPCResult::Type::OBJ, "address", "json object with information about address",
{
{RPCResult::Type::STR, "purpose", "Purpose of address (\"send\" for sending address, \"receive\" for receiving address)"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"(json object) json object with ...." seems a bit redundant. Maybe "(json object) keyed by address" and "(json object) information about the address" would be better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good follow-up issue: #18258

{RPCResult::Type::BOOL, "reused", "(only present if avoid_reuse is set) Whether this output is reused/dirty (sent to an address that was previously spent from)"},
{RPCResult::Type::STR, "desc", "(only when solvable) A descriptor for spending this output"},
{RPCResult::Type::BOOL, "safe", "Whether this output is considered safe to spend. Unconfirmed transactions"
" from outside keys and unconfirmed replacement transactions are considered unsafe\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following why the leading spaces here are being kept?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To preserve the output of git blame. Our style-guideline is to keep the current style unless the line is changed for other reasons.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, perhaps I was unclear: I meant the leading spaces inside the quoted string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even those are stylistic and should be trimmed at the beginning of a newline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait you are saying in the line above this line I missed a \n character? I think I did. Someone should fix that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #18346

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa6b061 -- skimmed code changes and differences to rpc help output

@maflcko maflcko merged commit a71c347 into bitcoin:master Mar 4, 2020
@maflcko maflcko deleted the 1906-rpcResult branch March 4, 2020 13:19
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 5, 2020
fa6b061 rpc: Auto-format RPCResult (MarcoFalke)
fa7d050 rpc: Move OuterType enum to header (MarcoFalke)

Pull request description:

  This enforces most syntax rules of the RPCResult at compile time (or some at run time during unit and functional tests)

  Apart from normalizing the syntax, by separating stylistic formatting from the structure, we could in theory directly generate the html for e.g. https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/

ACKs for top commit:
  Sjors:
    Indeed, re-ACK fa6b061
  ajtowns:
    ACK fa6b061 -- skimmed code changes and differences to rpc help output

Tree-SHA512: 5b510b3aa0b7c7b9189a48c77593159409069f939145b9a00c5478e894cf65f994d44d633eb7bb7dbea40ee820645a2930976c24772379d96929002b120efa28
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Mar 13, 2020
Converted auxpow-specific RPC result help texts to the new "auto-format"
system (bitcoin/bitcoin#17809).
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Mar 13, 2020
Converted namecoin-specific RPC result help texts to the new "auto-format"
system (bitcoin/bitcoin#17809).
domob1812 added a commit to xaya/xaya that referenced this pull request Mar 13, 2020
Converted xaya-specific RPC result help texts to the new "auto-format"
system (bitcoin/bitcoin#17809).
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 26, 2020
Summary:
This is needed so that it can be used by RPCResult

Also,
* rename NAMED_ARG to NONE for generalization.
* change RPCArg constructors to initialize the members by moving values

Backport of Core [[bitcoin/bitcoin#17809 | PR17809]] [1/2] : bitcoin/bitcoin@fa7d050

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8123
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 27, 2020
Summary:
Backport of Core [[bitcoin/bitcoin#17809 | PR17809]] part [2/2] : bitcoin/bitcoin@fa6b061

Depends on D8123

Test Plan:
  ninja all check-all

Examine the differential in documentation to ensure it is correct: https://reviews.bitcoinabc.org/differential/diff/25141/

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8124
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
fa6b061 rpc: Auto-format RPCResult (MarcoFalke)
fa7d050 rpc: Move OuterType enum to header (MarcoFalke)

Pull request description:

  This enforces most syntax rules of the RPCResult at compile time (or some at run time during unit and functional tests)

  Apart from normalizing the syntax, by separating stylistic formatting from the structure, we could in theory directly generate the html for e.g. https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/

ACKs for top commit:
  Sjors:
    Indeed, re-ACK fa6b061
  ajtowns:
    ACK fa6b061 -- skimmed code changes and differences to rpc help output

Tree-SHA512: 5b510b3aa0b7c7b9189a48c77593159409069f939145b9a00c5478e894cf65f994d44d633eb7bb7dbea40ee820645a2930976c24772379d96929002b120efa28
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Apr 14, 2021
Summary:
This is needed so that it can be used by RPCResult

Also,
* rename NAMED_ARG to NONE for generalization.
* change RPCArg constructors to initialize the members by moving values

Backport of Core [[bitcoin/bitcoin#17809 |
PR17809]] [1/2] :
bitcoin/bitcoin@fa7d050

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8123
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.