serum-ts icon indicating copy to clipboard operation
serum-ts copied to clipboard

fix: bn overflow error

Open ZhengYuTay opened this issue 3 years ago • 3 comments

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()

ZhengYuTay avatar Nov 15 '21 11:11 ZhengYuTay

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.

thaaddeus avatar Nov 16 '21 14:11 thaaddeus

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

ZhengYuTay avatar Nov 17 '21 04:11 ZhengYuTay

@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.

thaaddeus avatar Nov 17 '21 12:11 thaaddeus