Relax Slots-based engines from Epochs (#12360)

Remove Epochs reference from slots subsystem
This commit is contained in:
Davide Galassi
2022-09-27 13:16:30 +02:00
committed by GitHub
parent 96c1f8bcf0
commit 499ca74afe
3 changed files with 28 additions and 33 deletions
+4 -8
View File
@@ -729,7 +729,6 @@ where
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Sync,
Error: std::error::Error + Send + From<ConsensusError> + From<I::Error> + 'static,
{
type EpochData = ViableEpochDescriptor<B::Hash, NumberFor<B>, Epoch>;
type Claim = (PreDigest, AuthorityId);
type SyncOracle = SO;
type JustificationSyncLink = L;
@@ -737,6 +736,7 @@ where
Pin<Box<dyn Future<Output = Result<E::Proposer, sp_consensus::Error>> + Send + 'static>>;
type Proposer = E::Proposer;
type BlockImport = I;
type AuxData = ViableEpochDescriptor<B::Hash, NumberFor<B>, Epoch>;
fn logging_target(&self) -> &'static str {
"babe"
@@ -746,11 +746,7 @@ where
&mut self.block_import
}
fn epoch_data(
&self,
parent: &B::Header,
slot: Slot,
) -> Result<Self::EpochData, ConsensusError> {
fn aux_data(&self, parent: &B::Header, slot: Slot) -> Result<Self::AuxData, ConsensusError> {
self.epoch_changes
.shared_data()
.epoch_descriptor_for_child_of(
@@ -763,7 +759,7 @@ where
.ok_or(sp_consensus::Error::InvalidAuthoritiesSet)
}
fn authorities_len(&self, epoch_descriptor: &Self::EpochData) -> Option<usize> {
fn authorities_len(&self, epoch_descriptor: &Self::AuxData) -> Option<usize> {
self.epoch_changes
.shared_data()
.viable_epoch(epoch_descriptor, |slot| Epoch::genesis(&self.config, slot))
@@ -823,7 +819,7 @@ where
body: Vec<B::Extrinsic>,
storage_changes: StorageChanges<<Self::BlockImport as BlockImport<B>>::Transaction, B>,
(_, public): Self::Claim,
epoch_descriptor: Self::EpochData,
epoch_descriptor: Self::AuxData,
) -> Result<
sc_consensus::BlockImportParams<B, <Self::BlockImport as BlockImport<B>>::Transaction>,
sp_consensus::Error,