mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Aura: Expose SimpleSlotWorker (#11247)
Instead of just returning `SlotWorker` from `build_aura_worker` we now return `SimpleSlotWorker`. This is required for some future changes in Cumulus.
This commit is contained in:
@@ -40,7 +40,8 @@ use codec::{Codec, Decode, Encode};
|
|||||||
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
|
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
|
||||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction};
|
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction};
|
||||||
use sc_consensus_slots::{
|
use sc_consensus_slots::{
|
||||||
BackoffAuthoringBlocksStrategy, InherentDataProviderExt, SlotInfo, StorageChanges,
|
BackoffAuthoringBlocksStrategy, InherentDataProviderExt, SimpleSlotWorkerToSlotWorker,
|
||||||
|
SlotInfo, StorageChanges,
|
||||||
};
|
};
|
||||||
use sc_telemetry::TelemetryHandle;
|
use sc_telemetry::TelemetryHandle;
|
||||||
use sp_api::ProvideRuntimeApi;
|
use sp_api::ProvideRuntimeApi;
|
||||||
@@ -201,7 +202,7 @@ where
|
|||||||
Ok(sc_consensus_slots::start_slot_worker(
|
Ok(sc_consensus_slots::start_slot_worker(
|
||||||
slot_duration,
|
slot_duration,
|
||||||
select_chain,
|
select_chain,
|
||||||
worker,
|
SimpleSlotWorkerToSlotWorker(worker),
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
create_inherent_data_providers,
|
create_inherent_data_providers,
|
||||||
can_author_with,
|
can_author_with,
|
||||||
@@ -256,7 +257,15 @@ pub fn build_aura_worker<P, B, C, PF, I, SO, L, BS, Error>(
|
|||||||
telemetry,
|
telemetry,
|
||||||
force_authoring,
|
force_authoring,
|
||||||
}: BuildAuraWorkerParams<C, I, PF, SO, L, BS>,
|
}: 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
|
where
|
||||||
B: BlockT,
|
B: BlockT,
|
||||||
C: ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync,
|
C: ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync,
|
||||||
@@ -272,7 +281,7 @@ where
|
|||||||
L: sc_consensus::JustificationSyncLink<B>,
|
L: sc_consensus::JustificationSyncLink<B>,
|
||||||
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
|
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
sc_consensus_slots::SimpleSlotWorkerToSlotWorker(AuraWorker {
|
AuraWorker {
|
||||||
client,
|
client,
|
||||||
block_import,
|
block_import,
|
||||||
env: proposer_factory,
|
env: proposer_factory,
|
||||||
@@ -285,7 +294,7 @@ where
|
|||||||
block_proposal_slot_portion,
|
block_proposal_slot_portion,
|
||||||
max_block_proposal_slot_portion,
|
max_block_proposal_slot_portion,
|
||||||
_key_type: PhantomData::<P>,
|
_key_type: PhantomData::<P>,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AuraWorker<C, E, I, P, SO, L, BS> {
|
struct AuraWorker<C, E, I, P, SO, L, BS> {
|
||||||
@@ -448,11 +457,10 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn proposer(&mut self, block: &B::Header) -> Self::CreateProposer {
|
fn proposer(&mut self, block: &B::Header) -> Self::CreateProposer {
|
||||||
Box::pin(
|
self.env
|
||||||
self.env
|
.init(block)
|
||||||
.init(block)
|
.map_err(|e| sp_consensus::Error::ClientImport(format!("{:?}", e)).into())
|
||||||
.map_err(|e| sp_consensus::Error::ClientImport(format!("{:?}", e)).into()),
|
.boxed()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn telemetry(&self) -> Option<TelemetryHandle> {
|
fn telemetry(&self) -> Option<TelemetryHandle> {
|
||||||
|
|||||||
Reference in New Issue
Block a user