dappnode / node-dashboard-app

https://dappnode-dashboard.vercel.app/
GNU General Public License v3.0
1 stars 1 forks source link

Dashboard Crashes when 0 < xDai Staked Balance < 0.000001 #158

Closed JHGrove3 closed 3 years ago

JHGrove3 commented 3 years ago

Describe the bug

The dashboard has 6 decimals of precision in most of the fields.

When you look at the amount of coins you have staked, it generally reports something like: 10.123456

However it is possible to enter additional decimal places if you copy and paste the number into the field when staking tokens.

This can create a crash bug if you end up with a number of tokens staked that is between 0 and 0.000001

To Reproduce

  1. Type the number 1.7654321 on a text editor. Then select the number and copy it
  2. Stake xNode tokens. When asked how many tokens to stake, press ctrl-V to paste the number
  3. The screen will show "1.765432"
  4. Stake the tokens
  5. Click "Manage" to manage your xNode tokens
  6. It will say you have 1.765432 tokens staked
  7. Remove 1.765432 tokens. Note that this will leave 0.0000001 tokens staked
  8. When you re-load the screen it will not load completely, then it will go blank and show the message "Application error: a client-side exception has occurred (developer guidance)"

Expected behavior

It should show that you have 0 tokens staked at this point, but otherwise operate normally

Screenshots

Fractional Stake Error Screen

If you click the hyperlink, this is the Developer Guidance page you see: Fractional Stake Developer Guidance

DAppNode version:

Web Node Staking Dashboard.

Additional context

In addition to fixing this out of bounds problem, I suggest adding a "Max" button, so the user can stake or un-stake all the xNode they have, even if it's just a tiny fraction of a token.

It is possible to fix this problem if you can load the page, and quickly click the button to stake xNode, stake 1 xNode, and submit. After the transaction processes you will then have 1.0000001 xNode and the dashboard will work again. It will show you as having 1 xNode.

JHGrove3 commented 3 years ago

This bug may exist in other places on the dashboard. I am aware of this instance, but I suspect that others exist also.