-
Notifications
You must be signed in to change notification settings - Fork 38.6k
rpc: Auto-format RPCResult #17809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc: Auto-format RPCResult #17809
Conversation
|
Currently based on #17804, will squash after that was merged |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, 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. |
|
Concept ACK 👏 |
paymog
left a comment
There was a problem hiding this 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.
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/rpc/blockchain.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NUM_AMOUNT?
There was a problem hiding this comment.
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
fe3e2f1 to
bf8feaa
Compare
|
Concept ACK. Great to see progress on the RPC output as well.. |
bf8feaa to
37fc4d6
Compare
|
Concept ACK |
|
Please review #18098 first |
|
I just ran #17804 and this PR on: The base PR worked fine, however this PR gave me more than 20 errors. |
|
Concept ACK |
1 similar comment
|
Concept ACK |
a254bd0 to
a6db5ef
Compare
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
a6db5ef to
fa6b061
Compare
|
Rebased due to trivial conflict in the includes. Should be easy to re-ACK |
|
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)"}, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #18346
ajtowns
left a comment
There was a problem hiding this 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
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
Converted auxpow-specific RPC result help texts to the new "auto-format" system (bitcoin/bitcoin#17809).
Converted namecoin-specific RPC result help texts to the new "auto-format" system (bitcoin/bitcoin#17809).
Converted xaya-specific RPC result help texts to the new "auto-format" system (bitcoin/bitcoin#17809).
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
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
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
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
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/