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

refactor overseer into proc-macro based pattern #2962

Merged
merged 166 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from 164 commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
a6955f7
doc: initial testing outline
drahnr Apr 29, 2021
0cb6120
impro
drahnr Apr 30, 2021
c4c8b79
fix: avoid underflow in some circumstances
drahnr May 4, 2021
cd8ae9f
addendums, quotes
drahnr May 4, 2021
98e1211
bike-shedding
drahnr May 5, 2021
6002b0d
better var names
drahnr Apr 1, 2021
dbcd8f3
git foo bar
drahnr May 5, 2021
08fae45
snapshot WIP
drahnr May 6, 2021
75ba380
more fixins
drahnr May 7, 2021
cf537e8
parse
drahnr May 7, 2021
b36d75a
more changes
drahnr May 7, 2021
d86938e
shuffle
drahnr May 10, 2021
d484fde
foo
drahnr May 10, 2021
a6bfc20
refactor
drahnr May 10, 2021
4f839be
refactor
drahnr May 10, 2021
a6e9e27
file shuffle
drahnr May 11, 2021
be930df
fixins
drahnr May 11, 2021
d01a318
message
drahnr May 11, 2021
d3f5bcb
drop subsystems gen
drahnr May 11, 2021
bb97f08
refactor
drahnr May 11, 2021
6d05f4e
refactor
drahnr May 11, 2021
7bdd388
drop dispatch-gen crate, obsolete
drahnr May 11, 2021
581df1f
more impl details
drahnr May 11, 2021
c985c42
fixins
drahnr May 11, 2021
aabd88c
🍌-split
drahnr May 11, 2021
7644dc8
more fixins
drahnr May 12, 2021
b0dc502
level up 🍄
drahnr May 12, 2021
1170675
intermediate
drahnr May 12, 2021
cc4544d
fixins
drahnr May 12, 2021
16f704d
almost there
drahnr May 12, 2021
705bc2f
fixins
drahnr May 17, 2021
ebf71f0
fffffixins
drahnr May 18, 2021
4a6ded3
foo
drahnr May 18, 2021
af5bdbb
fixins
drahnr May 18, 2021
6701179
apply
drahnr May 18, 2021
2865a31
generator
drahnr May 19, 2021
734d576
avoid redundant definitions / conflicts
drahnr May 19, 2021
cc90686
shuffle
drahnr May 19, 2021
86b4e08
more generics, better split
drahnr May 20, 2021
f4defb2
cargo spellcheck
drahnr May 20, 2021
4d79333
refactor, move things into the macro again, requires GATs for ctx init
drahnr May 21, 2021
78e7c71
Hot like ℃ or K ?
drahnr May 26, 2021
3709117
fixins
drahnr May 26, 2021
0f77289
dummy example works
drahnr May 26, 2021
a028b16
extend example, improved fixins
drahnr May 26, 2021
97bc447
chores
drahnr May 26, 2021
4251405
spelling
drahnr May 26, 2021
4bc034f
remove pointless vars
drahnr May 26, 2021
097c65a
make sure all prefixes are there
drahnr May 27, 2021
2ad93be
more fixins
drahnr May 27, 2021
fdf7057
more fallout fixins
drahnr May 27, 2021
06c969f
foo
drahnr May 27, 2021
eddda16
fixins
drahnr Jun 1, 2021
c7f3467
minor
drahnr Jun 1, 2021
ca23d5b
minor
drahnr Jun 2, 2021
489f72f
undo some damage
drahnr Jun 2, 2021
67e7dde
🌈
drahnr Jun 7, 2021
6beb656
remove dispatch-gen
drahnr Jun 7, 2021
60e46ab
🌈2
drahnr Jun 7, 2021
f2b3395
partial fixin
drahnr Jun 7, 2021
ba19adb
foo
drahnr Jun 8, 2021
9098e81
fixins
drahnr Jun 8, 2021
59584b9
fixins again
drahnr Jun 8, 2021
f5abc5d
silence warnings, fixins
drahnr Jun 8, 2021
261be34
Merge remote-tracking branch 'origin/master' into bernhard-testing-doc
drahnr Jun 8, 2021
2fe0312
fix/spellcheck: improve whitelist
drahnr Jun 8, 2021
d3598f3
fallout (quite a bit)
drahnr Jun 8, 2021
78dcd08
chain-api
drahnr Jun 9, 2021
cab7530
split node-subsystem
drahnr Jun 24, 2021
c17a590
error handling in proc-macro
drahnr Jun 25, 2021
e683410
more OverseerError -> SubsystemError
drahnr Jun 25, 2021
6858084
locky
drahnr Jun 25, 2021
5ae073a
all?
drahnr Jun 28, 2021
e2bf006
Merge remote-tracking branch 'origin/master' into bernhard-testing-doc
drahnr Jun 28, 2021
6049ccb
split out metrics
drahnr Jun 29, 2021
d3e7596
split subsystem-util up
drahnr Jun 29, 2021
24c3668
error foo
drahnr Jul 1, 2021
d6c35be
dedup types, add convenience alias types
drahnr Jul 1, 2021
3323cd7
foo
drahnr Jul 1, 2021
601a566
make backing work
drahnr Jul 1, 2021
1844d1f
make network bridge work
drahnr Jul 1, 2021
5c3377e
fix bitfield dist
drahnr Jul 1, 2021
c19be05
split bitfield subsystem test
drahnr Jul 1, 2021
4fdebf8
fixup collator protocol
drahnr Jul 1, 2021
15bc814
fixup gossip support
drahnr Jul 1, 2021
d33c72d
fixup candidate validation
drahnr Jul 1, 2021
15672d3
yikes and quirks
drahnr Jul 1, 2021
372ebcb
fixup availability recovery
drahnr Jul 2, 2021
821024b
fixup av-store
drahnr Jul 2, 2021
12d5dd3
collator and runtime msg
drahnr Jul 2, 2021
868b612
fixup runtime API
drahnr Jul 2, 2021
686bb7f
fixup availabilty distribution
drahnr Jul 2, 2021
161a639
fixup bitfield distribution
drahnr Jul 2, 2021
8583c96
fixup collation generation
drahnr Jul 2, 2021
9b0bb57
chore
drahnr Jul 2, 2021
5da3e34
fixup approval voting , part of chain-api
drahnr Jul 2, 2021
c90657c
split tests off in chain-api
drahnr Jul 2, 2021
096ea78
fixup remaining subsystems
drahnr Jul 2, 2021
4bed823
add new subsystems
drahnr Jul 2, 2021
39e0008
license header foo
drahnr Jul 5, 2021
5b5e114
introduce wip
drahnr Jul 5, 2021
6fbece0
finalize `wip` tag
drahnr Jul 5, 2021
322341e
missing baggage type
drahnr Jul 5, 2021
e5a72c9
fixup merge artifact labeled as TODO
drahnr Jul 5, 2021
2e9ba17
fixins
drahnr Jul 5, 2021
cff421e
avoid instantiating dead subsystems
drahnr Jul 5, 2021
117497a
minro
drahnr Jul 5, 2021
54c87e6
silence warnings
drahnr Jul 5, 2021
d01890e
Merge remote-tracking branch 'origin/master' into bernhard-testing-doc
drahnr Jul 5, 2021
417daff
avoid duplicate *Message suffix
drahnr Jul 6, 2021
6a89fd0
fix candidate validation tests
drahnr Jul 6, 2021
db267b6
fix dispute participation
drahnr Jul 6, 2021
d3b6ab4
fix dispute coord test
drahnr Jul 6, 2021
7a31f93
fix chain selection test
drahnr Jul 6, 2021
93786cb
fix availability dist
drahnr Jul 6, 2021
f0adaf2
fix approval dist tests
drahnr Jul 6, 2021
c18f85c
fixup malus
drahnr Jul 6, 2021
3435ca7
re-add all-subsystems-gen
drahnr Jul 6, 2021
f5f91f7
gen foo
drahnr Jul 6, 2021
2269761
criss cross
drahnr Jul 6, 2021
ba9f2f1
fix overseer except for doctests
drahnr Jul 6, 2021
441619b
fix overseer doc test
drahnr Jul 7, 2021
8531594
Merge remote-tracking branch 'origin/master' into bernhard-testing-doc
drahnr Jul 7, 2021
7828027
remainder warnings
drahnr Jul 7, 2021
f59078c
do not rename the proc-macro
drahnr Jul 7, 2021
8f777fe
better error
drahnr Jul 7, 2021
1855c54
chore: remove dead code
drahnr Jul 7, 2021
212a858
behavior tests are legacy, see malus
drahnr Jul 7, 2021
f2d08c4
Update node/core/approval-voting/src/lib.rs
drahnr Jul 7, 2021
33942ea
attr parsing fixin
drahnr Jul 7, 2021
2cd4593
remove unused dependencies
drahnr Jul 7, 2021
6a31014
reintroduce a constant
drahnr Jul 7, 2021
cb2564d
get rid of ::std::mem::drop and use let _ = ..
drahnr Jul 7, 2021
b38c643
fix comment
drahnr Jul 7, 2021
cd4803b
reference accumulator issue for further improvements
drahnr Jul 7, 2021
7c8b894
proc-macro remove impl_replace for now
drahnr Jul 7, 2021
3a56d54
remove unused crate deps
drahnr Jul 8, 2021
f607bd8
remove wrong deprecation warnigns
drahnr Jul 8, 2021
a9f2118
undo accidental undo
drahnr Jul 8, 2021
256fb38
Update node/metrics/src/lib.rs
drahnr Jul 8, 2021
6e8dfad
Update node/metrics/src/lib.rs
drahnr Jul 8, 2021
1e774ef
Update node/overseer/overseer-gen/src/lib.rs
drahnr Jul 8, 2021
6700a2d
use proc-macro-crate
drahnr Jul 8, 2021
662215e
chores
drahnr Jul 8, 2021
a3f3c47
extra line breaks
drahnr Jul 8, 2021
91fe7eb
remove stale dependency
drahnr Jul 8, 2021
c90f8b4
bitfield signing test fmt + license fixup
drahnr Jul 8, 2021
9662033
tabs
drahnr Jul 8, 2021
7dd86d7
more tabs
drahnr Jul 8, 2021
4a73141
up they go
drahnr Jul 8, 2021
9962bc5
Handler -> Handle
drahnr Jul 8, 2021
21c9f76
use statements and results
drahnr Jul 8, 2021
c82cfc4
print the subsystem name on send fail
drahnr Jul 8, 2021
0270602
avoid iter chain
drahnr Jul 8, 2021
1a036bf
give unreachables a msg
drahnr Jul 8, 2021
4fa3ff2
simplify
drahnr Jul 8, 2021
8ff6a63
better msg for unbounded too
drahnr Jul 8, 2021
450ae2d
Update node/overseer/overseer-gen/proc-macro/src/parse_struct.rs
drahnr Jul 8, 2021
538e159
Update node/overseer/overseer-gen/proc-macro/src/parse_struct.rs
drahnr Jul 8, 2021
a06634c
rework parse attr
drahnr Jul 8, 2021
aa515e9
more lookahead usage
drahnr Jul 8, 2021
1fa00e6
path
drahnr Jul 8, 2021
1434404
slips
drahnr Jul 8, 2021
0be5ee9
Merge remote-tracking branch 'origin/master' into bernhard-testing-doc
drahnr Jul 8, 2021
d176007
minor tweaks, fix silly test
drahnr Jul 8, 2021
a630a3e
one space
drahnr Jul 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 89 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ members = [
"node/network/collator-protocol",
"node/network/gossip-support",
"node/overseer",
"node/overseer/overseer-gen",
"node/overseer/overseer-gen/proc-macro",
"node/overseer/all-subsystems-gen",
"node/malus",
"node/primitives",
"node/service",
"node/subsystem",
"node/subsystem/dispatch-gen",
"node/subsystem-types",
"node/subsystem-test-helpers",
"node/subsystem-util",
"node/jaeger",
"node/metrics",
"node/metered-channel",
"node/test/client",
"node/test/service",
Expand Down
24 changes: 13 additions & 11 deletions node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ use polkadot_node_primitives::{
CollationGenerationConfig, AvailableData, PoV,
};
use polkadot_node_subsystem::{
ActiveLeavesUpdate,
messages::{AllMessages, CollationGenerationMessage, CollatorProtocolMessage},
FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemResult,
SpawnedSubsystem, SubsystemContext, SubsystemResult,
SubsystemError, FromOverseer, OverseerSignal,
overseer,
};
use polkadot_node_subsystem_util::{
request_availability_cores, request_persisted_validation_data,
Expand Down Expand Up @@ -83,6 +86,7 @@ impl CollationGenerationSubsystem {
async fn run<Context>(mut self, mut ctx: Context)
where
Context: SubsystemContext<Message = CollationGenerationMessage>,
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
{
// when we activate new leaves, we spawn a bunch of sub-tasks, each of which is
// expected to generate precisely one message. We don't want to block the main loop
Expand Down Expand Up @@ -114,19 +118,16 @@ impl CollationGenerationSubsystem {
// it should hopefully therefore be ok that it's an async function mutably borrowing self.
async fn handle_incoming<Context>(
&mut self,
incoming: SubsystemResult<FromOverseer<Context::Message>>,
incoming: SubsystemResult<FromOverseer<<Context as SubsystemContext>::Message>>,
ctx: &mut Context,
sender: &mpsc::Sender<AllMessages>,
) -> bool
where
Context: SubsystemContext<Message = CollationGenerationMessage>,
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
{
use polkadot_node_subsystem::ActiveLeavesUpdate;
use polkadot_node_subsystem::FromOverseer::{Communication, Signal};
use polkadot_node_subsystem::OverseerSignal::{ActiveLeaves, BlockFinalized, Conclude};

match incoming {
Ok(Signal(ActiveLeaves(ActiveLeavesUpdate { activated, .. }))) => {
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, .. }))) => {
// follow the procedure from the guide
if let Some(config) = &self.config {
let metrics = self.metrics.clone();
Expand All @@ -143,8 +144,8 @@ impl CollationGenerationSubsystem {

false
}
Ok(Signal(Conclude)) => true,
Ok(Communication {
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => true,
Ok(FromOverseer::Communication {
msg: CollationGenerationMessage::Initialize(config),
}) => {
if self.config.is_some() {
Expand All @@ -154,7 +155,7 @@ impl CollationGenerationSubsystem {
}
false
}
Ok(Signal(BlockFinalized(..))) => false,
Ok(FromOverseer::Signal(OverseerSignal::BlockFinalized(..))) => false,
Err(err) => {
tracing::error!(
target: LOG_TARGET,
Expand All @@ -168,9 +169,10 @@ impl CollationGenerationSubsystem {
}
}

impl<Context> Subsystem<Context> for CollationGenerationSubsystem
impl<Context> overseer::Subsystem<Context, SubsystemError> for CollationGenerationSubsystem
where
Context: SubsystemContext<Message = CollationGenerationMessage>,
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
let future = async move {
Expand Down
Loading