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

Block ActiveLeavesUpdate and BlockFinalized events in overseer until major sync is complete #6689

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions node/overseer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ orchestra = "0.0.4"
gum = { package = "tracing-gum", path = "../gum" }
lru = "0.9"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
async-trait = "0.1.57"
tikv-jemalloc-ctl = "0.5.0"

Expand Down
21 changes: 13 additions & 8 deletions node/overseer/examples/minimal-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use polkadot_overseer::{
self as overseer,
dummy::dummy_overseer_builder,
gen::{FromOrchestra, SpawnedSubsystem},
HeadSupportsParachains, SubsystemError,
HeadSupportsParachains, MajorSyncOracle, SubsystemError,
};
use polkadot_primitives::{CandidateReceipt, Hash};

Expand Down Expand Up @@ -153,13 +153,18 @@ fn main() {
Delay::new(Duration::from_secs(1)).await;
});

let (overseer, _handle) = dummy_overseer_builder(spawner, AlwaysSupportsParachains, None)
.unwrap()
.replace_candidate_validation(|_| Subsystem2)
.replace_candidate_backing(|orig| orig)
.replace_candidate_backing(|_orig| Subsystem1)
.build()
.unwrap();
let (overseer, _handle) = dummy_overseer_builder(
spawner,
AlwaysSupportsParachains,
None,
MajorSyncOracle::new_dummy(),
)
.unwrap()
.replace_candidate_validation(|_| Subsystem2)
.replace_candidate_backing(|orig| orig)
.replace_candidate_backing(|_orig| Subsystem1)
.build()
.unwrap();

let overseer_fut = overseer.run().fuse();
let timer_stream = timer_stream;
Expand Down
22 changes: 17 additions & 5 deletions node/overseer/src/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use crate::{
prometheus::Registry, HeadSupportsParachains, InitializedOverseerBuilder, MetricsTrait,
Overseer, OverseerMetrics, OverseerSignal, OverseerSubsystemContext, SpawnGlue,
prometheus::Registry, HeadSupportsParachains, InitializedOverseerBuilder, MajorSyncOracle,
MetricsTrait, Overseer, OverseerMetrics, OverseerSignal, OverseerSubsystemContext, SpawnGlue,
KNOWN_LEAVES_CACHE_SIZE,
};
use lru::LruCache;
use orchestra::{FromOrchestra, SpawnedSubsystem, Subsystem, SubsystemContext};
use polkadot_node_subsystem_types::{errors::SubsystemError, messages::*};
use polkadot_node_subsystem_types::{errors::SubsystemError, messages::*, BlockNumber, Hash};
// Generated dummy messages
use crate::messages::*;

Expand Down Expand Up @@ -63,6 +63,8 @@ pub fn dummy_overseer_builder<Spawner, SupportsParachains>(
spawner: Spawner,
supports_parachains: SupportsParachains,
registry: Option<&Registry>,
sync_oracle: MajorSyncOracle,
initial_leaves: Vec<(Hash, BlockNumber)>,
) -> Result<
InitializedOverseerBuilder<
SpawnGlue<Spawner>,
Expand Down Expand Up @@ -96,7 +98,14 @@ where
SpawnGlue<Spawner>: orchestra::Spawner + 'static,
SupportsParachains: HeadSupportsParachains,
{
one_for_all_overseer_builder(spawner, supports_parachains, DummySubsystem, registry)
one_for_all_overseer_builder(
spawner,
supports_parachains,
DummySubsystem,
registry,
sync_oracle,
initial_leaves,
)
}

/// Create an overseer with all subsystem being `Sub`.
Expand All @@ -105,6 +114,8 @@ pub fn one_for_all_overseer_builder<Spawner, SupportsParachains, Sub>(
supports_parachains: SupportsParachains,
subsystem: Sub,
registry: Option<&Registry>,
sync_oracle: MajorSyncOracle,
initial_leaves: Vec<(Hash, BlockNumber)>,
) -> Result<
InitializedOverseerBuilder<
SpawnGlue<Spawner>,
Expand Down Expand Up @@ -190,9 +201,10 @@ where
.span_per_active_leaf(Default::default())
.active_leaves(Default::default())
.known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE))
.leaves(Default::default())
.leaves(initial_leaves)
.spawner(SpawnGlue(spawner))
.metrics(metrics)
.sync_oracle(sync_oracle)
.supports_parachains(supports_parachains);
Ok(builder)
}
Loading