Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
node: reduce unsafe uint256S usage #30569
node: reduce unsafe uint256S usage #30569
Changes from 1 commit
85b7cbf
70e2c87
8a44d7d
2e58fdb
6819e5a
18d65d2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Since this is a "User" centric specialization of
FromHex
(and not aHex
specialization ofFromUser
), I'd keep theFromHex
prefix, i.e.:FromHexUser
or perhapsFromHexLenient
, since theUser
part is just incidentalThere 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.
(Thread https://github.com/bitcoin/bitcoin/pull/30569/files#r1725693175)
I prefer the current
uint256::FromUserHex
overuint256::FromHexUser
(the latter makes me think of sorcerers). (uint256::FromHexLenient
is okay to).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.
I have nothing against any of the suggested names, but personally I still find
FromUserHex
to be the most intuitive (and it seems at least 2 other reviewers like it as well), so I'm going to stick with that if that's okay?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.
re: #30569 (comment)
re: #30569 (comment)
Maybe I have a slightly different perspective because I think it can be good to name functions after how they are intended to be used, instead of what they do, depending on what's more relevant to callers. In this case, though, I do think the name describes what it does: parse hex input from a user. The assumption is that callers should not make idiosyncratic choices about what user input to accept, and there should be a common standard.
I don't like name
FromHexLenient
so much because it sounds like a negative thing that should be avoided, and doesn't provide much more information about what the function does either.If we do want the function name to more literally describe what it does, I think
FromHexNumber
could work because it's conventional for hex numbers to have 0x prefixes and not need to be padded with 0's.But my vote would be for FromUserHex over FromHexNumber over FromHexLenient