tfchain icon indicating copy to clipboard operation
tfchain copied to clipboard

Re-Implementing billing trigger on ZOS to prevent overbilling during downtime

Open DylanVerstraete opened this issue 1 year ago • 6 comments

Issue https://github.com/threefoldtech/tfchain/issues/801 was created with the question that "why am I getting billed when my workload or Node is down?"

Tfchain initially was designed in a way that the billing would be triggered by the node, this came with some issues and that is why we implemented the trigger to bill contracts here https://github.com/threefoldtech/tfchain/blob/development/docs/architecture/0002-smart-contract-billing-changed.md

I think there is another solution to make sure contracts are being billed appropriatly. What if we re-implement the trigger to bill contracts back on the node. This would make sure that contracts are only getting billed when the workload is live.

Some important things to take into account before we can achieve this:

  • Public IP management and assignment to contracts need to be taken off-chain. Otherwise anyone can lock up all public ips and not pay for them if the trigger is implemented off-chain. I think this could be a great addition for the farmerbot to take care of.
  • Zos needs to implement the trigger for all workloads that are live on the node. The report needs to consist of:
    • total resources (cu/su and ipu)
    • total window of used resources (this could be the total uptime of the vm)
    • ..

An important note here is that the report of resources and the window of the used resources need to be limited so some malicious users cannot exploit this functionality. Also some previous reported state need to be tracked to make sure the reports are "valid"

When implementing this trigger back on the node we can solve getting billed whilst a node is down or a workload is not functioning.

DylanVerstraete avatar Jul 24 '23 11:07 DylanVerstraete