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

fix: bn overflow error #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZhengYuTay
Copy link

most of the time calling toNumber() would result in Number can only safely store up to 53 bits, workaround is to just call toString() into Number()

@thaaddeus
Copy link
Contributor

I've seen it as well, would be great to have it fixed in the lib directly, could be someone setting orders with very large prices that causes that? not sure.

@ZhengYuTay
Copy link
Author

@armaniferrante, can help take a look with this? Some serum orderbook break when fetching l2 because of large number, this would mitigate it

@thaaddeus
Copy link
Contributor

@ZhengYuTay I think this fix is incorrect in away not preserving decimal places, I think https://github.com/MikeMcl/big.js/ should be used instead for making division?
@armaniferrante I think order ids like 340282366920938463463374607431743501208 for example can trigger this issue.

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