-
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
Refactor/remove lock balance logic in billing flow #990
Comments
We may also consider replacing locks with reserves/holds, which would simplify the flow and make it less error-prone. |
Update:
Bug Fixes
completed: Still WIP:
|
Choosing between locking and distributing less frequently, or not locking and distributing more frequently could be debatable as both actions require modifications to the account balances storage, which involves computational resources.
Locking Tokens:
Each lock is recorded in the state, and removing or updating a lock involves additional state changes.
Transferring Tokens:
Each transfer results in changes to the state (balance updates) for both the sender and the receiver. Also, distributing tokens in our logic involves multiple transfers to (foundation, sales, staking pool, and service provider) accounts.
The advantages of the current flow:
Locks due amounts every hour, leading to fewer state changes during the day.
Transfers the total amount once daily, spreading the computational load.
The disadvantages:
I believe that the current approach, if works correctly (which is not the case), is generally more efficient in terms of network usage. However, I propose simplifying the logic by transferring overdue amounts directly every cycle. This is because the added complexity of locking brings many flaws that cannot be justified by the potential savings in network usage.
We can still benefit from both worlds by changing the billing cycle to occur every 24 hours instead of hourly, aligning it with the cultivation distribution schedule. This approach consolidates multiple transfers into fewer transactions, reducing the computational load on the network to even lower levels than what we have currently.
Additional context
The text was updated successfully, but these errors were encountered: