-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Fail to return undocumented return values #20459
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
Conversation
Concept ACK but it would be much better if checks like this could be done at compile time instead of run time. This seems to me like a kind of a python-esque solution instead of a static language one. |
UniValue::getType() is not a compile-time constant, so I don't think this works at compile time (without replacing UniValue with something else) |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
concept ACK, very nice! having a programatic check that the docs are in sync with the actual output seems like a win for maintaining up-to-date docs & reducing review burden |
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.
utACK faca73c
src/rpc/util.cpp
Outdated
return UniValue::VSTR == result.getType(); | ||
} | ||
case Type::NUM: | ||
case Type::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.
Suggestion for a follow-up: for NUM_AMOUNT, you can do a stronger test (parse with AmountFromValue, convert back to JSON using ValueFromAmount, and the string representation must match exactly).
faba446
to
fabf051
Compare
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.
Code review ACK fabf051. Suggested a tweak to get rid of const_cast, but current implementation also looks good, so feel free to ignore suggestion.
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.
Code review ACK fa8192f. Only changes: rebase, no const_cast suggestion, and tostring cleanups needed after suggestion
Currently a few return values are undocumented. This is causing confusion at the least. See for example #18476
Fix this by treating it as an internal bug to return undocumented return values.