-
Notifications
You must be signed in to change notification settings - Fork 63
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
[consts] Make upper bound numbers hardcoded #247
Conversation
c795860
to
2d16974
Compare
are we sure this is the fix? Looks like adapter v1 works fine, and that version works with the legacy sdk that actually uses the same consts |
Ah... it is possible this happens on the old SDK as well. In the case of this particular individual no version of the wallet adapter worked for them. So, this would explain that. |
that's weird... I mean it works for others. It might be an issue with a specific prod env..? |
That is possible. I'm working with him on it, but this also happened to me once, I don't remember how (then I used create-aptos-dapp and it was all fine). I'm leaning towards this because it's a simple fix that could prevent some users from even running into this at all, since there are so many different platforms to support. I think... I was using netlify and moved to vercel, then it just worked. |
yes I think your issue was with Netlify (tho you probably could have configured a specific node version to use) - we use BigInt a lot in the sdk, would it make more sense to simply say that in order to use the SDK is required to use Node version X and above? where x is the minimum version that supports BigInt |
Well that's where it's weird... It supports BigInt, it just doesn't support the power And it looks like it needs to be ES7+ to support native It's one of those things though, Netlify didn't really let you configure some pieces, and that causes a headache depending on your deployment platform, that isn't something you necessarily have control over |
yea... looks like you need ES10+ to use pow with BigInt, and ES7+ to use it with number primitives. tho ES10 was out in 2019 so most if not all should be using it. |
src/bcs/consts.ts
Outdated
export const MAX_U8_NUMBER: Uint8 = 255; | ||
export const MAX_U16_NUMBER: Uint16 = 65535; | ||
export const MAX_U32_NUMBER: Uint32 = 4294967295; | ||
export const MAX_U64_BIG_INT: Uint64 = BigInt("18446744073709551615"); |
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.
nit
export const MAX_U64_BIG_INT: Uint64 = BigInt("18446744073709551615"); | |
export const MAX_U64_BIG_INT: Uint64 = 18446744073709551615n; |
cb3a144
to
02aeedd
Compare
Doing powers of bigints doesn't work on older versions of node, and it seems to be hard to reproduce, but still occurs. Hardcoding these should have the same behavior, without these quirks. Fixes aptos-labs/aptos-wallet-adapter#223
02aeedd
to
cd12b0a
Compare
Description
Doing powers of bigints doesn't work on older versions of node, and it seems to be hard to reproduce, but still occurs. Hardcoding these should have the same behavior, without these quirks.
Fixes aptos-labs/aptos-wallet-adapter#223
Test Plan
TBD, making a test now with an older version of node to check
Related Links
Related aptos-labs/aptos-core#11540