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

Decouple the current billing index from best block-number #931

Open
sameh-farouk opened this issue Jan 8, 2024 · 2 comments
Open

Decouple the current billing index from best block-number #931

sameh-farouk opened this issue Jan 8, 2024 · 2 comments
Milestone

Comments

@sameh-farouk
Copy link
Member

sameh-farouk commented Jan 8, 2024

Describe the bug

Currently, all network validators are required to have offchain worker enabled. This is because we depend on the best block number in retrieval contracts ids from the billing shards. Skipping subsets of contracts in the billing cycle can occur in cases such as:

  • Offchain worker is not enabled on one or more validators
  • Offchain workers are not triggered on a block import (this is on substrate, it is not guaranteed to trigger the hook every block).
  • Local key store has multiple signing/aura keys (some validators were incorrectly set up).

My suggestion is to store the current index in the smart contract pallet storage and increment it upon every successful billing cycle.

By decoupling the current billing index from best block-number we would ensure that all contracts billing are handled as long as there is at least one validator have offcahin worker enabled on the network and configured correctly .

if this implemented, The only side effect for less offchain workers would be prelonged cycle (less workers = more time) but this would be better than no billing done at all.

This is primarily an improvement to enable better error tolerance, but we can also plan and proceed in parallel with a more comprehensive redesign that involve zos nodes, gateways, and other components responsible for triggering the billing instead of the offchain workers if needed.

@sameh-farouk sameh-farouk changed the title Decouple the current billing index from current block-number Decouple the current billing index from best block-number Jan 8, 2024
@sameh-farouk
Copy link
Member Author

sameh-farouk commented Feb 11, 2024

I want to add that the motivation here beside better operation error tolerance, that I don't want to make a critical feature (contracts billing) depends on one option passed to the tfchain binary specially if we still plan to launch the validators program. As alternative maybe we could enforce enabling the offchain worker from the code.

@renauter renauter added this to the later milestone Mar 21, 2024
@sameh-farouk
Copy link
Member Author

This can be done using the approach suggested here #932 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants