NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 441 forks source link

Sia loses funds during contract formation #2772

Open mtlynch opened 6 years ago

mtlynch commented 6 years ago

BUG REPORT

How to reproduce it (as minimally and precisely as possible)

  1. Deposit 500 SC into Sia wallet
  2. Set allowance of 500 SC for 12w
  3. Wait for 50 contracts to form
  4. Upload 300 GiB of data to Sia, 5 files at a time

Expected Behavior

The sum of wallet balance and contract spending remains constant at 500 SC. Any money removed from the wallet should end up in total contract spending.

I see this behavior hold when I try it with a 5 KS wallet:

funds-balance-test1

In that test, the sum of wallet balance and contract spending remains a constant 5 KS.

Actual Behavior

Sia loses 166.66 SC of funds. Wallet balance reduces to 0, but Sia contract spending only increases to 333.33 SC, leaving 166.66 SC unaccounted for.

funds-balance-dev missing.

Environment

Logs: https://gist.github.com/mtlynch/ccc29acfbd7cf4c9716180eac2af39a5 Metrics data: https://docs.google.com/spreadsheets/d/1g6bMB7CrH_Nn7orUfguD7RDd_9rmHKlXLJrrqv06sd4/edit#gid=1191012075

mtlynch commented 6 years ago

I actually ended up seeing the same thing on the 5000 SC allowance. I started with a 5000 SC wallet balance. Ended with 0 SC wallet balance and 2,966.7 in total contract spending, losing 2033.3 (41%).

image