This repository was archived by the owner on Nov 15, 2023. It is now read-only.
refactor overseer into proc-macro based pattern#2962
Merged
Conversation
rphmeier
reviewed
May 4, 2021
rphmeier
reviewed
May 4, 2021
75935ad to
a38f2b8
Compare
ordian
reviewed
May 6, 2021
rphmeier
reviewed
May 7, 2021
rphmeier
reviewed
May 7, 2021
rphmeier
reviewed
May 7, 2021
bkchr
reviewed
May 10, 2021
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
drahnr
commented
Jul 8, 2021
Lldenaurois
approved these changes
Jul 8, 2021
Contributor
Lldenaurois
left a comment
There was a problem hiding this comment.
Made a few small suggestions. Overall, I think this is fine to merge as-is though
| finalized_number: &Option<BlockNumber>, | ||
| ) -> SubsystemResult<Vec<BlockImportedCandidates>> { | ||
| ) -> SubsystemResult<Vec<BlockImportedCandidates>> | ||
| { |
Contributor
There was a problem hiding this comment.
nit: I believe it's standard to have the braces on the same line as the return unless the return is deconstructed (multi-line).
|
|
||
| loop { | ||
| futures::select! { | ||
| m = receiver.next() => match m.unwrap() { |
Contributor
There was a problem hiding this comment.
nit: single character variables are a bit mysterious. I would suggest msg = instead of m and res = instead of r
| Context: overseer::SubsystemContext<Message = CandidateValidationMessage>, | ||
| { | ||
| fn start(self, ctx: C) -> SpawnedSubsystem { | ||
| fn start(self, ctx: Context) -> SpawnedSubsystem { |
| number_leaves: 0, | ||
| finalized_state: None, | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
nit: Spaces between functions?
| #[doc = $doc_name] | ||
| #[doc = "` from the runtime"] | ||
| pub async fn $func_name( | ||
| pub async fn $func_name ( |
Contributor
Author
|
I'll take care of the nits in a follow up |
This was referenced Jul 9, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The branch name is historical, this expanded into a refactoring of the
Overseerinto a pattern to actually allow simpler spawning of modified nodes with subsystems that exhibit modified (malicious and/or broken) behavior besides future compile time checks based on subsystem.This is stage one and lies the groundwork for further checks:
AllMessagesand.into()in any subsystem, always send the subsystem specific types directlyNext steps are covered in #3427
Notes to reviewers:
You will find two traits called
SubsystemContext, where one binds 3 associated types, the other is a wrapper around it. This was meant to simplifify the trait bounds across all subsystem's generic typeContext. In retrospective I am not sure which is better:Subsystem<Message=X> + overseer::Subsystem<Message=X>vsoverseer::Subsystem<Message=X, AllMessages=AllMessages, Signal=OverseerSignal, Error=SubsystemError>.Most usages of conversions into
AllMessagesaroundfn send_message(..)were removed, instead almost all instances now do the conversion implicitly which removes quite a bit of clutter and will be necessary for [node] Add additional sanitization checks to overseer #3427 anyways.I moved the
#[cfg(test)] mod tests;back at the end of the file. It caused a whole lot of duplicate definitions and it's just clearer to have one spot to look for the test module, and that's at the bottom of a file. External or not is imho secondary to that.Most changes are boring trait bounds, so I'd recommend on focusing on the node/overseer/src/lib.rs and more generally on
node/{overseer,subsystem}/*where the most relevant changes are.