Closed frontusia closed 1 month ago
For the use-case of wallet IDs within a safe range, see this commit for schematics:
walletId
is in range from 0
to 2^32 - 1
, so it fits in JavaScript's default number range.
(It might still simplify the code not to do any conversions, but I haven't looked deep into it)
yes, no problem with uint32.
but I hope v5 wrapper in ton-core used only Number or only BigInt, not both like the tests here.
When working with BigInt, problems arise when attempting to convert its value to type Number. This can lead to loss of precision or incorrect results when indentify users or comparing.
File: wallet-contract-v5/wrappers/wallet-v5.ts
Code steps:
walletId: bigint
subwalletNumber = Number(walletId)
this.serialized = BigInt(this.subwalletNumber)
Extreme cases:
So, any number greater than max safe integer will be rounded to the nearest representable value.
Proposed changes:
Instead of converting BigInt to Number and then back to BigInt, use BigInt directly where needed.