Skip to content
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

Billing: contract appear double in billing loops #701

Closed
DylanVerstraete opened this issue May 23, 2023 · 5 comments
Closed

Billing: contract appear double in billing loops #701

DylanVerstraete opened this issue May 23, 2023 · 5 comments
Assignees
Labels
priority_major type_bug Something isn't working

Comments

@DylanVerstraete
Copy link
Contributor

I have identified multiple contracts which appear to be inserted on a index in the billing loop. See

Self::insert_contract_in_billing_loop(contract.contract_id);
where contracts are inserted in a billing loop if there are resources pushed or it is created with a public IP or it is any other contract
Self::insert_contract_in_billing_loop(id);

We need to redesign this because this will cause issues in the long run.

@DylanVerstraete DylanVerstraete added priority_major type_bug Something isn't working labels May 23, 2023
@DylanVerstraete DylanVerstraete added this to the 2.4.0 milestone May 23, 2023
@DylanVerstraete
Copy link
Contributor Author

Code was added here: 8eaa3de#diff-9621ac9aed0d3dce47f6c26910446b2d480d84bca8a6eb7b7402a2001be9eac7 and deployed on devnet a while ago. So it seems like we didn't think it through enough

@DylanVerstraete
Copy link
Contributor Author

Let's revert these changes and also add an extra check in the offchain worker:

fetch the contract ->

  • check if used resources
  • check if used ip
  • check if any consumption reports were pushed

IF no => don't make an extrinsic and such will be excluded from billing

@renauter
Copy link
Collaborator

New billing loop rules:

  1. Each contract (node/rent/name contracts) is inserted in billing loop only once, when contract is created.
    There is no more exception for node contracts with no public ips and no used resources on chain.

  2. When a contract is to be billed during the billing loop execution (via the offchain worker), bill it ONLY if there is effectively some IP/SU/CU/NU consumed. Technically this comes down to trigger bill_contract() extrinsic only when there is some used ip / resources or consumption reports linked to this contract.

@DylanVerstraete
Copy link
Contributor Author

Fix was deployed on devnet, need to verify before we close but its looking good so far.

@DylanVerstraete
Copy link
Contributor Author

Fix verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority_major type_bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants