-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[move] Use u256 instead of bigint for parsing #19998
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
txt.as_bytes(), | ||
let max_len = match base { | ||
NumberFormat::Hex => AccountAddress::LENGTH * 2, | ||
NumberFormat::Decimal => 78, |
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.
Where is the 78 coming from? Is it possible to express that in terms of AccountAddress::LENGTH
?
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.
Yea! I can do that. It's based off of this: https://stackoverflow.com/questions/43787672/the-max-number-of-digits-in-an-int-based-on-number-of-bits
So would be 241 * AccountAddress::LENGTH / 100 + 1
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.
Wowza. Yeah I would definitely comment the shit out of that number lol
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.
Updated it to be a const + I put a link to the stack overflow article on it as that did a much better job than any explanation I can give.
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'm reconsidering this move to u256 here altogether -- in particular _
s in addresses are going to mess this change all up. So will need to look a bit more at it and will land outside of this stack.
d2e321f
to
7691959
Compare
7ed24aa
to
04adc54
Compare
04adc54
to
6b941b1
Compare
Updated so we handle underscores as well now (in integers) + some minor updates to promote parity between the value tokenizer and type tokenizer. |
Description
Switches to using u256 instead of bigint for parsing.
Test plan
CI + additional tests to make sure parity was preserved.