-
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
feat: rework contract billing storage #477
feat: rework contract billing storage #477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Some small comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general though I'd prefer the index calculation to live in its own fuction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Some small comments already approving.
@LeeSmet can you review migration as well please? |
668ef5f
into
feat/269-rework-pallet-smart-contract-billing
Contracts will not get reinserted after a successful bill, rather it will get a index which can be calculated as following:
Now block % billing frequency
When a contract is created the index is generated as:
Now block - 1 % billing frequency
For such, the offchain worker will not bill the contract in the same block it gets created.
Even if the offchain worker now fails to bill the contract, it can be billed in the next cycle. The elapsed time between the first bill (or creation) and next bill is calculated anyway.