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:
ValidatorOverseerGen
CollatorOverseerGen
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).
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 aDummySubsystem, which is a bit clumsy.Proposal
We could instead nix
RealOverseerGenand have three new structs that implementOverseerGen:ValidatorOverseerGenCollatorOverseerGenFullNodeOverseerGenThen 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) intoCandidateValidation::new. This would ensure that the workers are only required for nodes that actually need them (validators).