fix: toBignumber conversion error with high balance#12010
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
|
Do you have a link (or would you be able to describe in PR description) the issue this fixes? Considering if this is related at all to solving it: Also, is there any possible way to add a regression test for this bugfix? |
Daniel-Cross
left a comment
There was a problem hiding this comment.
Check whether the useMemo is actually needed. This kind of hook allocates system memory to watch the dependancies.
Daniel-Cross
left a comment
There was a problem hiding this comment.
Looks good, once the tests are passing. Thanks
@siibars Thanks for updating, much clearer! 👍 Looks like it is indeed related. First steps in sorting out this larger mess: |
|
@siibars I am trying to track down exactly where the |
We get this as wei string from the server side API. |
|
using new BN(assets) instead of hexToBn(assets) fixes the issue. |
|
hi @legobeat I think this hextobn util here make sense but Indeed the BN import should probably be aligned and this file should also be written in ts for more type safety at build time. @amitabh94 I am curious about d. and e. working as expected with account with a high share amount / conversion rate with a lot of decimals, do we have tests for such cases ? cheers |
|
|
|
We will have to check whether if we have specific test cases for decimals but what I know is that we use bignumber.js in Staking api which is used to deal with big numbers with decimal places. |



Description
There is a bignumber conversion attempt which is failing, this change fixes this.
Related issues
Fixes: STAKE-848
Manual testing steps
Screenshots/Recordings
Before
View: Root
Error: [number-to-bn] while converting number "3.487400189415765903484e+21" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.
After
This issue doesn't happen.
Pre-merge author checklist
Pre-merge reviewer checklist