Skip to content
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

TransactionExpiry.toJSON can fail if the internal bigint is not a safe integer #346

Open
lassemoldrup opened this issue Apr 9, 2024 · 0 comments
Labels
Breaking changes Implementation of the issue will cause breaking changes. [Project] js-sdk [Type] Bug Something isn't working

Comments

@lassemoldrup
Copy link
Contributor

Bug Description
TransactionExpiry.toJSON converts a TransactionExpiry to a number as a serializable representation. However, a TransactionExpiry is implemented as a number of seconds from the UNIX epoch as a bigint. Therefore, converting to a number can give imprecise results, e.g. one might not be able to convert back to a TransactionExpiry.

#336 makes the method explicitly throw if the internal bigint is outside the safe range, but ideally a toJSON method should not throw errors.

Solution
Converting to a string instead would fix the problem, but this is a breaking change.

@lassemoldrup lassemoldrup added the [Type] Bug Something isn't working label Apr 9, 2024
@soerenbf soerenbf added the Breaking changes Implementation of the issue will cause breaking changes. label Apr 24, 2024
@mh-concordium mh-concordium added the [Res] works as designed The functionality is as intended. label May 13, 2024 — with Linear
@mh-concordium mh-concordium removed the [Res] works as designed The functionality is as intended. label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking changes Implementation of the issue will cause breaking changes. [Project] js-sdk [Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants