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

Some bill contract extrinsics are failing with error #650

Closed
DylanVerstraete opened this issue Mar 30, 2023 · 4 comments
Closed

Some bill contract extrinsics are failing with error #650

DylanVerstraete opened this issue Mar 30, 2023 · 4 comments
Assignees
Labels
type_bug Something isn't working

Comments

@DylanVerstraete
Copy link
Contributor

ContractWrongBillingLoopIndex

On devnet I checked that contract 21023 was failing with this error, this contract was billed at block 5146505 which resolves to index 305

When checking the index 305 in chainstate I see:

[
  17,744
  20,924
  19,918
]

But when checking index 304 I found the contract:

[
  ...
  21,023
]

So it seems the extrinsic is failing because it tries to lookup the wrong index to remove the contract in

@DylanVerstraete DylanVerstraete added the type_bug Something isn't working label Mar 30, 2023
@DylanVerstraete DylanVerstraete self-assigned this Mar 30, 2023
@DylanVerstraete
Copy link
Contributor Author

I think it's because the offchain worker creates the extrinsics to be included in the next block.

This means that the index that the offchain worker got is different from the index in the next block (index + 1).

We can fix this by subtracting the index with 1 in case contracts need to be deleted.

@renauter
Copy link
Collaborator

As you explained, when we first get index here it is in ocw context (at block X)

let current_index = Self::get_current_billing_loop_index();

and then when we effectively remove contract in billing loop we get index here at next block context (X+1)

let index = Self::get_current_billing_loop_index();

which gives index inconsistency
so indeed, passing billing index to bill_contract() guaranty us to avoid this

no impact when we call bill_contract() out of ocw context (cancel contract / delete node)
because removing contract from billing loop is always triggered by a call to bill_contract() in ocw context

@DylanVerstraete DylanVerstraete added this to the 2.4.0 milestone Apr 4, 2023
@DylanVerstraete
Copy link
Contributor Author

Non blocking issue, will be released in 2.4.0

@DylanVerstraete
Copy link
Contributor Author

Fix deployed and verified on devnet

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

No branches or pull requests

2 participants