Skip to content

Consider refactoring subsystem initialization in overseer #586

Description

@mrcnski

Currently we include all subsystems in RealOverseerGen, irregardless of whether they are needed or not. A couple of them are only initialized based on passed-in parameters. E.g. there is a conditional for whether pvf-checker is enabled, and if not we spawn a DummySubsystem, which is a bit clumsy.

Proposal

We could instead nix RealOverseerGen and have three new structs that implement OverseerGen:

  1. ValidatorOverseerGen
  2. CollatorOverseerGen
  3. FullNodeOverseerGen

Then for each we only initialize the subsystems that are relevant to that kind of node.

Edit: in the future there can be nodes that are both validators and collators. See paritytech/polkadot#7566 (comment). Perhaps a capabilities-based approach would be better, or a builder pattern, e.g. new().is_validator(true).is_collator(true).

I'm not too familiar with the code so looking for feedback. cc @ordian

Followup

After this has been done we can move the worker binary check (where we call determine_workers_paths) into CandidateValidation::new. This would ensure that the workers are only required for nodes that actually need them (validators).

Metadata

Metadata

Assignees

No one assigned

    Labels

    I4-refactorCode needs refactoring.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions