Skip to content

Conversation

tzakian
Copy link
Contributor

@tzakian tzakian commented Oct 23, 2024

Description

Switches to using u256 instead of bigint for parsing.

Test plan

CI + additional tests to make sure parity was preserved.

@tzakian tzakian requested a review from a team October 23, 2024 23:09
Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 10:59pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2024 10:59pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2024 10:59pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2024 10:59pm

txt.as_bytes(),
let max_len = match base {
NumberFormat::Hex => AccountAddress::LENGTH * 2,
NumberFormat::Decimal => 78,
Copy link
Contributor

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?

Copy link
Contributor Author

@tzakian tzakian Oct 23, 2024

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@tzakian tzakian force-pushed the tzakian/new-tt-parser5 branch from d2e321f to 7691959 Compare October 23, 2024 23:32
@tzakian tzakian force-pushed the tzakian/new-tt-parser6 branch from 7ed24aa to 04adc54 Compare October 23, 2024 23:32
Base automatically changed from tzakian/new-tt-parser5 to tzakian/new-tt-parser4 October 24, 2024 16:58
Base automatically changed from tzakian/new-tt-parser4 to tzakian/new-tt-parser3 October 24, 2024 16:58
Base automatically changed from tzakian/new-tt-parser3 to tzakian/new-tt-parser2 October 24, 2024 16:59
Base automatically changed from tzakian/new-tt-parser2 to tzakian/new-tt-parser1 October 24, 2024 16:59
Base automatically changed from tzakian/new-tt-parser1 to main October 24, 2024 17:32
@tzakian tzakian force-pushed the tzakian/new-tt-parser6 branch from 04adc54 to 6b941b1 Compare October 24, 2024 22:58
@tzakian
Copy link
Contributor Author

tzakian commented Oct 24, 2024

Updated so we handle underscores as well now (in integers) + some minor updates to promote parity between the value tokenizer and type tokenizer.

@tzakian tzakian merged commit 3162494 into main Oct 25, 2024
52 checks passed
@tzakian tzakian deleted the tzakian/new-tt-parser6 branch October 25, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants