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

Commit

Permalink
Aura: Expose SimpleSlotWorker (#11247)
Browse files Browse the repository at this point in the history
Instead of just returning `SlotWorker` from `build_aura_worker` we now return `SimpleSlotWorker`.
This is required for some future changes in Cumulus.
  • Loading branch information
bkchr authored Apr 20, 2022
1 parent 7dd9798 commit 6091c6b
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ use codec::{Codec, Decode, Encode};
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction};
use sc_consensus_slots::{
BackoffAuthoringBlocksStrategy, InherentDataProviderExt, SlotInfo, StorageChanges,
BackoffAuthoringBlocksStrategy, InherentDataProviderExt, SimpleSlotWorkerToSlotWorker,
SlotInfo, StorageChanges,
};
use sc_telemetry::TelemetryHandle;
use sp_api::ProvideRuntimeApi;
Expand Down Expand Up @@ -201,7 +202,7 @@ where
Ok(sc_consensus_slots::start_slot_worker(
slot_duration,
select_chain,
worker,
SimpleSlotWorkerToSlotWorker(worker),
sync_oracle,
create_inherent_data_providers,
can_author_with,
Expand Down Expand Up @@ -256,7 +257,15 @@ pub fn build_aura_worker<P, B, C, PF, I, SO, L, BS, Error>(
telemetry,
force_authoring,
}: BuildAuraWorkerParams<C, I, PF, SO, L, BS>,
) -> impl sc_consensus_slots::SlotWorker<B, <PF::Proposer as Proposer<B>>::Proof>
) -> impl sc_consensus_slots::SimpleSlotWorker<
B,
Proposer = PF::Proposer,
BlockImport = I,
SyncOracle = SO,
JustificationSyncLink = L,
Claim = P::Public,
EpochData = Vec<AuthorityId<P>>,
>
where
B: BlockT,
C: ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync,
Expand All @@ -272,7 +281,7 @@ where
L: sc_consensus::JustificationSyncLink<B>,
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
{
sc_consensus_slots::SimpleSlotWorkerToSlotWorker(AuraWorker {
AuraWorker {
client,
block_import,
env: proposer_factory,
Expand All @@ -285,7 +294,7 @@ where
block_proposal_slot_portion,
max_block_proposal_slot_portion,
_key_type: PhantomData::<P>,
})
}
}

struct AuraWorker<C, E, I, P, SO, L, BS> {
Expand Down Expand Up @@ -448,11 +457,10 @@ where
}

fn proposer(&mut self, block: &B::Header) -> Self::CreateProposer {
Box::pin(
self.env
.init(block)
.map_err(|e| sp_consensus::Error::ClientImport(format!("{:?}", e)).into()),
)
self.env
.init(block)
.map_err(|e| sp_consensus::Error::ClientImport(format!("{:?}", e)).into())
.boxed()
}

fn telemetry(&self) -> Option<TelemetryHandle> {
Expand Down

0 comments on commit 6091c6b

Please sign in to comment.