threefoldtech / tfgrid-sdk-go

Apache License 2.0
2 stars 4 forks source link

🐞 [Bug]: Farmerbot Go, failed to validate account balance #647

Closed Mik-TF closed 9 months ago

Mik-TF commented 9 months ago

What happened?

Running the farmerbot in go on a tfgrid full vm ubuntu 22.04 deployment on farm 197 node 3860 with wireguard access:

I get the error:

12:06AM FTL error="failed to validate account balance: account contains 22.31 tft, min fee is 0.002 tft"

with the line:

root@fbotgo:~/farmerbotgo# farmerbot run -c config.yml -e .env -d

The farmerbot version is from the binary release.

The .env file

MNEMONIC_OR_SEED="word1 word2 ... word3"
NETWORK="main"

and the config.yml file:

farm_id: 197
included_nodes:
  - 577 
  - 580 
  - 581 
  - 582 
  - 879 
  - 880 
  - 3860 
never_shutdown_nodes:
  - 3860
power:
  periodic_wake_up_start: 06:00PM

which network/s did you face the problem on?

Main

Farm ID/s

197

Relevant log output

12:06AM FTL error="failed to validate account balance: account contains 22.31 tft, min fee is 0.002 tft"
xmonader commented 9 months ago

Yup, we should have shown that min is 100 TFT (which is quite reasonable to run without interruptions for a long time)

https://github.com/threefoldtech/tfgrid-sdk-go/blob/development/farmerbot/internal/constants.go#L23

For a farm of 10 nodes that's almost 10 tft for just the daily and random wakeups, maybe we can make that 50. Either way in code the required balance needs to be encoded in the error message

Mik-TF commented 9 months ago

I think 100 TFT is fine, especially with the current price. Thanks for the info.

Mik-TF commented 9 months ago

@xmonader I adjusted the error message in #648 We can fix this issue when the related PR is closed.

scottyeager commented 9 months ago

Maybe the fees have changed, but last I checked them empirically for farmerbot operation, it was .001 TFT per transaction. Since there should be 10 random wakeups per month and ~30 daily wakeups, and there's two transactions per wakeup, the cost per node per year is:

.001 * 40 * 2 * 12 = .96

I'd suggest an approach like this:

  1. Hard check at 1 (or maybe 5) TFT to start the bot
  2. Soft check at some higher recommended value (50 feels okay) that can be overridden with a cli flag (error says something like "Your balance is lower than the recommended amount of 50 TFT. Please top up your account or add the -b (--balance) flag to bypass this warning"
Mik-TF commented 9 months ago

Good data point! It does put the situation in perspective.

If it costs <1 TFT per year per node, a simple mimum of 2 TFT per node would be enough for any basic Farmerbot use. We can set it to anything >2 TFT in wallet at minimum per node and I think it would be fine.

@scottyeager's solution here is also very nice it seems. The manual shows the farmerbot costs. Farmers could take it from there.

@xmonader Please let us know what you think and we can help at any level of fixing this issue.

xmonader commented 9 months ago

we went with a soft limit 50 tft that the user is advised to have and 5 tft hard limit