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

remove the overseer trait bounds #3454

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ impl CollationGenerationSubsystem {
/// Otherwise, most are logged and then discarded.
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
Expand Down Expand Up @@ -123,7 +122,6 @@ impl CollationGenerationSubsystem {
sender: &mpsc::Sender<AllMessages>,
) -> bool
where
Context: SubsystemContext<Message = CollationGenerationMessage>,
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
{
match incoming {
Expand Down Expand Up @@ -169,9 +167,8 @@ impl CollationGenerationSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for CollationGenerationSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for CollationGenerationSubsystem
where
Context: SubsystemContext<Message = CollationGenerationMessage>,
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand Down
4 changes: 2 additions & 2 deletions node/core/approval-voting/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct ImportedBlockInfoEnv<'a> {
// Computes information about the imported block. Returns `None` if the info couldn't be extracted -
// failure to communicate with overseer,
async fn imported_block_info(
ctx: &mut (impl SubsystemContext + overseer::SubsystemContext),
ctx: &mut overseer::SubsystemContext,
env: ImportedBlockInfoEnv<'_>,
block_hash: Hash,
block_header: &Header,
Expand Down Expand Up @@ -286,7 +286,7 @@ pub struct BlockImportedCandidates {
///
/// It is the responsibility of the caller to schedule wakeups for each block.
pub(crate) async fn handle_new_head(
ctx: &mut (impl SubsystemContext + overseer::SubsystemContext),
ctx: &mut overseer::SubsystemContext,
state: &mut State,
db: &mut OverlayedBackend<'_, impl Backend>,
head: Hash,
Expand Down
18 changes: 8 additions & 10 deletions node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use polkadot_node_subsystem::{
AvailabilityRecoveryMessage, ChainSelectionMessage,
},
errors::RecoveryError,
overseer::{self, SubsystemSender as _}, SubsystemContext, SubsystemError, SubsystemResult, SpawnedSubsystem,
FromOverseer, OverseerSignal, SubsystemSender,
overseer::{self, SubsystemSender}, SubsystemError, SubsystemResult, SpawnedSubsystem,
FromOverseer, OverseerSignal,
};
use polkadot_node_subsystem_util::{
TimeoutExt,
Expand Down Expand Up @@ -333,9 +333,8 @@ impl ApprovalVotingSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for ApprovalVotingSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for ApprovalVotingSubsystem
where
Context: SubsystemContext<Message = ApprovalVotingMessage>,
Context: overseer::SubsystemContext<Message = ApprovalVotingMessage>,
{

Expand Down Expand Up @@ -674,8 +673,7 @@ async fn run<B, Context>(
mut backend: B,
) -> SubsystemResult<()>
where
Context: SubsystemContext<Message = ApprovalVotingMessage>,
Context: overseer::SubsystemContext<Message = ApprovalVotingMessage>,
Context: overseer::SubsystemContext,
B: Backend,
{
let mut state = State {
Expand Down Expand Up @@ -801,7 +799,7 @@ async fn run<B, Context>(
//
// returns `true` if any of the actions was a `Conclude` command.
async fn handle_actions(
ctx: &mut (impl SubsystemContext<Message = ApprovalVotingMessage> + overseer::SubsystemContext<Message = ApprovalVotingMessage>),
ctx: &mut overseer::SubsystemContext,
state: &mut State,
overlayed_db: &mut OverlayedBackend<'_, impl Backend>,
metrics: &Metrics,
Expand Down Expand Up @@ -1021,7 +1019,7 @@ fn distribution_messages_for_activation(

// Handle an incoming signal from the overseer. Returns true if execution should conclude.
async fn handle_from_overseer(
ctx: &mut (impl SubsystemContext<Message = ApprovalVotingMessage> + overseer::SubsystemContext<Message = ApprovalVotingMessage>),
ctx: &mut overseer::SubsystemContext<Message = ApprovalVotingMessage>,
state: &mut State,
db: &mut OverlayedBackend<'_, impl Backend>,
metrics: &Metrics,
Expand Down Expand Up @@ -1134,7 +1132,7 @@ async fn handle_from_overseer(
}

async fn handle_approved_ancestor(
ctx: &mut (impl SubsystemContext + overseer::SubsystemContext),
ctx: &mut overseer::SubsystemContext,
db: &OverlayedBackend<'_, impl Backend>,
target: Hash,
lower_bound: BlockNumber,
Expand Down Expand Up @@ -1998,7 +1996,7 @@ fn process_wakeup(
// spawned. When the background work is no longer needed, the `AbortHandle` should be dropped
// to cancel the background work and any requests it has spawned.
async fn launch_approval(
ctx: &mut (impl SubsystemContext<Message = ApprovalVotingMessage> + overseer::SubsystemContext<Message = ApprovalVotingMessage>),
ctx: &mut overseer::SubsystemContext,
metrics: Metrics,
session_index: SessionIndex,
candidate: CandidateReceipt,
Expand Down
2 changes: 1 addition & 1 deletion node/core/av-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bitvec = "0.20.1"

parity-scale-codec = { version = "2.0.0", features = ["derive"] }
erasure = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-overseer = { path = "../../overseer" }
polkadot-primitives = { path = "../../../primitives" }
Expand Down
17 changes: 6 additions & 11 deletions node/core/av-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,21 @@ use polkadot_primitives::v1::{
use polkadot_node_primitives::{
ErasureChunk, AvailableData,
};
use polkadot_subsystem::{
use polkadot_node_subsystem::{
FromOverseer, OverseerSignal, SubsystemError,
SubsystemContext, SpawnedSubsystem,
overseer,
ActiveLeavesUpdate,
errors::{ChainApiError, RuntimeApiError},
messages::{
AvailabilityStoreMessage, ChainApiMessage, RuntimeApiMessage, RuntimeApiRequest,
}
};
use polkadot_node_subsystem_util::{
self as util,
metrics::{self, prometheus},
};
use polkadot_subsystem::messages::{
AvailabilityStoreMessage, ChainApiMessage, RuntimeApiMessage, RuntimeApiRequest,
};
use polkadot_subsystem::;
use bitvec::{vec::BitVec, order::Lsb0 as BitOrderLsb0};

#[cfg(test)]
Expand Down Expand Up @@ -524,9 +525,8 @@ impl KnownUnfinalizedBlocks {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for AvailabilityStoreSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for AvailabilityStoreSubsystem
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand All @@ -543,7 +543,6 @@ where

async fn run<Context>(mut subsystem: AvailabilityStoreSubsystem, mut ctx: Context)
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{
let mut next_pruning = Delay::new(subsystem.pruning_config.pruning_interval).fuse();
Expand Down Expand Up @@ -574,7 +573,6 @@ async fn run_iteration<Context>(
)
-> Result<bool, Error>
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{
select! {
Expand Down Expand Up @@ -626,7 +624,6 @@ async fn process_block_activated<Context>(
activated: Hash,
) -> Result<(), Error>
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{
let now = subsystem.clock.now()?;
Expand Down Expand Up @@ -686,7 +683,6 @@ async fn process_new_head<Context>(
header: Header,
) -> Result<(), Error>
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{

Expand Down Expand Up @@ -855,7 +851,6 @@ async fn process_block_finalized<Context>(
finalized_number: BlockNumber,
) -> Result<(), Error>
where
Context: SubsystemContext<Message = AvailabilityStoreMessage>,
Context: overseer::SubsystemContext<Message = AvailabilityStoreMessage>,
{
let now = subsystem.clock.now()?;
Expand Down
8 changes: 1 addition & 7 deletions node/core/candidate-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ impl CandidateValidationSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for CandidateValidationSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for CandidateValidationSubsystem
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand All @@ -108,7 +107,6 @@ async fn run<Context>(
program_path: PathBuf,
) -> SubsystemResult<()>
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
let (mut validation_host, task) = polkadot_node_core_pvf::start(
Expand Down Expand Up @@ -188,7 +186,6 @@ async fn runtime_api_request<T, Context>(
receiver: oneshot::Receiver<Result<T, RuntimeApiError>>,
) -> SubsystemResult<Result<T, RuntimeApiError>>
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
ctx.send_message(
Expand All @@ -214,7 +211,6 @@ async fn check_assumption_validation_data<Context>(
assumption: OccupiedCoreAssumption,
) -> SubsystemResult<AssumptionCheckOutcome>
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
let validation_data = {
Expand Down Expand Up @@ -267,7 +263,6 @@ async fn find_assumed_validation_data<Context>(
descriptor: &CandidateDescriptor,
) -> SubsystemResult<AssumptionCheckOutcome>
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
// The candidate descriptor has a `persisted_validation_data_hash` which corresponds to
Expand Down Expand Up @@ -305,7 +300,6 @@ async fn spawn_validate_from_chain_state<Context>(
metrics: &Metrics,
) -> SubsystemResult<Result<ValidationResult, ValidationFailed>>
where
Context: SubsystemContext<Message = CandidateValidationMessage>,
Context: overseer::SubsystemContext<Message = CandidateValidationMessage>,
{
let (validation_data, validation_code) =
Expand Down
4 changes: 1 addition & 3 deletions node/core/chain-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ impl<Client> ChainApiSubsystem<Client> {
}
}

impl<Client, Context> overseer::Subsystem<Context, SubsystemError> for ChainApiSubsystem<Client>
impl<Client, Context> overseer::overseer::Subsystem<Context> for ChainApiSubsystem<Client>
where
Client: HeaderBackend<Block> + AuxStore + 'static,
Context: SubsystemContext<Message = ChainApiMessage>,
Context: overseer::SubsystemContext<Message = ChainApiMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand All @@ -90,7 +89,6 @@ async fn run<Client, Context>(
) -> SubsystemResult<()>
where
Client: HeaderBackend<Block> + AuxStore,
Context: SubsystemContext<Message = ChainApiMessage>,
Context: overseer::SubsystemContext<Message = ChainApiMessage>,
{
loop {
Expand Down
5 changes: 1 addition & 4 deletions node/core/chain-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,8 @@ impl ChainSelectionSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for ChainSelectionSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for ChainSelectionSubsystem
where
Context: SubsystemContext<Message = ChainSelectionMessage>,
Context: overseer::SubsystemContext<Message = ChainSelectionMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand Down Expand Up @@ -338,7 +337,6 @@ async fn run<Context, B>(
clock: Box<dyn Clock + Send + Sync>,
)
where
Context: SubsystemContext<Message = ChainSelectionMessage>,
Context: overseer::SubsystemContext<Message = ChainSelectionMessage>,
B: Backend,
{
Expand Down Expand Up @@ -378,7 +376,6 @@ async fn run_iteration<Context, B>(
)
-> Result<(), Error>
where
Context: SubsystemContext<Message = ChainSelectionMessage>,
Context: overseer::SubsystemContext<Message = ChainSelectionMessage>,
B: Backend,
{
Expand Down
11 changes: 4 additions & 7 deletions node/core/dispute-coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ impl DisputeCoordinatorSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for DisputeCoordinatorSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for DisputeCoordinatorSubsystem
where
Context: SubsystemContext<Message = DisputeCoordinatorMessage>,
Context: overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand Down Expand Up @@ -163,8 +162,7 @@ impl Error {
async fn run<Context>(subsystem: DisputeCoordinatorSubsystem, mut ctx: Context)
where
Context: overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
Context: SubsystemContext<Message = DisputeCoordinatorMessage>
{
{
loop {
let res = run_iteration(&mut ctx, &subsystem).await;
match res {
Expand Down Expand Up @@ -192,8 +190,7 @@ async fn run_iteration<Context>(ctx: &mut Context, subsystem: &DisputeCoordinato
-> Result<(), Error>
where
Context: overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
Context: SubsystemContext<Message = DisputeCoordinatorMessage>
{
{
let DisputeCoordinatorSubsystem { ref store, ref keystore, ref config } = *subsystem;
let mut state = State {
keystore: keystore.clone(),
Expand Down Expand Up @@ -230,7 +227,7 @@ where
}

async fn handle_new_activations(
ctx: &mut (impl SubsystemContext<Message = DisputeCoordinatorMessage> + overseer::SubsystemContext<Message = DisputeCoordinatorMessage>),
ctx: &mut impl overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
store: &dyn KeyValueDB,
state: &mut State,
config: &Config,
Expand Down
4 changes: 1 addition & 3 deletions node/core/dispute-participation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ impl DisputeParticipationSubsystem {
}
}

impl<Context> overseer::Subsystem<Context, SubsystemError> for DisputeParticipationSubsystem
impl<Context> overseer::overseer::Subsystem<Context> for DisputeParticipationSubsystem
where
Context: SubsystemContext<Message = DisputeParticipationMessage>,
Context: overseer::SubsystemContext<Message = DisputeParticipationMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand Down Expand Up @@ -115,7 +114,6 @@ impl Error {

async fn run<Context>(mut ctx: Context)
where
Context: SubsystemContext<Message = DisputeParticipationMessage>,
Context: overseer::SubsystemContext<Message = DisputeParticipationMessage>,
{
let mut state = State { recent_block: None };
Expand Down
4 changes: 1 addition & 3 deletions node/core/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ impl<Client> RuntimeApiSubsystem<Client> {
}
}

impl<Client, Context> overseer::Subsystem<Context, SubsystemError> for RuntimeApiSubsystem<Client> where
impl<Client, Context> overseer::overseer::Subsystem<Context> for RuntimeApiSubsystem<Client> where
Client: ProvideRuntimeApi<Block> + Send + 'static + Sync,
Client::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Context: SubsystemContext<Message = RuntimeApiMessage>,
Context: overseer::SubsystemContext<Message = RuntimeApiMessage>,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
Expand Down Expand Up @@ -274,7 +273,6 @@ async fn run<Client, Context>(
) -> SubsystemResult<()> where
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static,
Client::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Context: SubsystemContext<Message = RuntimeApiMessage>,
Context: overseer::SubsystemContext<Message = RuntimeApiMessage>,
{
loop {
Expand Down
Loading