Skip to content

fix: bn overflow error#187

Open
ZhengYuTay wants to merge 1 commit intoproject-serum:masterfrom
ZhengYuTay:master
Open

fix: bn overflow error#187
ZhengYuTay wants to merge 1 commit intoproject-serum:masterfrom
ZhengYuTay:master

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