-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misuse of balance lock #969
Comments
I'm working on threefoldtech/tfgrid-sdk-ts#2489 , and while testing the flow, i had total locked amount with less than 19 tft, i have funded my wallet with 19 tft, i was expecting to bill all of them, but after call locks like there is somthing wrong with rent contract billing |
Due to a bug ...
This leads to the contract being restored if this amount is available.
This should fixed in this PR , which kinda WIP |
Describe the bug
By reviewing the billing code, it seems that the balance lock feature (from the balances pallet) may have been used incorrectly in our smart-contract pallet (at least it wasn't intended for such a use case).
Here are some side effects that I can think of:
For the last point, my account on Devnet
5DFkH2fcqYecVHjfgAEfxgsJyoEg5Kd93JFihfpHDaNoWagJ
can serve as an example.There are two issues here: the remaining locks from an old billing implementation that weren't properly removed, and the discrepancy involving having 881.9 TFT locked with gridlock ID, even though I have no contracts at all.
I can provide more details later (issue to be updated)
Update:
I would recommend rewriting the locking code to use holds instead of locks. Holds are very similar to locks, with two major differences:
Example:
In our code, we are trying to add locks in a way that is similar to how reserve/hold works. This is the reason why it should be replaced by holds instead.
The text was updated successfully, but these errors were encountered: