Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Refactor inherent filtering to be contained completely in the runtime #3989

Closed
rphmeier opened this issue Oct 1, 2021 · 0 comments · Fixed by #4254
Closed

Refactor inherent filtering to be contained completely in the runtime #3989

rphmeier opened this issue Oct 1, 2021 · 0 comments · Fixed by #4254
Assignees
Labels
I8-refactor Code needs refactoring.

Comments

@rphmeier
Copy link
Contributor

rphmeier commented Oct 1, 2021

At the moment, the provisioner does some filtering of candidates and bitfields to provide them to the runtime. However, it's not tightly integrated into the runtime which makes filtering difficult to do accurately and on a per-candidate or per-bitfield basis, and also for it to account for weight.

For disputes, the filtering is offloaded completely to the runtime's ProvideInherent implementation for the ParasInherent. This is invoked off-chain by the block author, and the provisioner just supplies all dispute votes and expects the runtime to filter it down to an acceptable set of disputes. It allows filtering out just a single dispute.

This pattern should be extended to cover both candidates and bitfields, and also apply filtering based on the disputes that are included. Basically, any kind of filtering needed in order for the end result to pass all checks in ParasInherent::enter on a fresh state. Additionally, the filtering done in the provisioner can be discarded, as it'll all be done by the runtime.

Concretely:

  • Filter out specific bitfields that reference a core which would be dropped as a result of a concluded dispute
  • Filter out specific candidates that have lost a dispute
  • Filter out specific bitfields which don't pass other checks.
  • Filter out arbitrary bitfields according to weight. The InherentData could be altered to contain a random value provided by the authoring node as a means of seeding an RNG within the runtime.
  • Filter out specific candidates that build on top of the wrong parent head, according to the current state + anything that might become available as a result of the remaining set of bitfields.
  • Filter out specific candidates that don't pass general validity checks.
  • Filter out arbitrary candidates according to weight. The InherentData could be altered to contain a random value provided by the authoring node as a means of seeding an RNG within the runtime.

Most of these checks are already done by the provisioner, but some are new.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I8-refactor Code needs refactoring.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants