Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Nov 23, 2020

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.

@laanwj
Copy link
Member

laanwj commented Nov 23, 2020

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.

@maflcko
Copy link
Member Author

maflcko commented Nov 23, 2020

UniValue::getType() is not a compile-time constant, so I don't think this works at compile time (without replacing UniValue with something else)

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 23, 2020

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

Conflicts

No conflicts as of last run.

@amitiuttarwar
Copy link
Contributor

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

Copy link
Member

@sipa sipa left a 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:
Copy link
Member

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).

@maflcko maflcko marked this pull request as draft December 27, 2020 08:58
@maflcko maflcko marked this pull request as ready for review March 15, 2021 08:47
@maflcko maflcko force-pushed the 2011-rpcDoc branch 4 times, most recently from faba446 to fabf051 Compare March 15, 2021 10:12
Copy link
Contributor

@ryanofsky ryanofsky left a 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.

Copy link
Contributor

@ryanofsky ryanofsky left a 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

@maflcko maflcko merged commit ad4bf8a into bitcoin:master Apr 3, 2021
@maflcko maflcko deleted the 2011-rpcDoc branch April 3, 2021 07:45
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 3, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 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.

6 participants