babe: expose next epoch data (#7829)

* babe: expose next epoch data

* babe: add runtime api for next_epoch

* babe: avoid reading next authorities from storage unnecessarily

* babe: add notes about epoch duration constraints

* babe: guard against overflow

* babe: add test for fetching current and next epoch data
This commit is contained in:
André Silva
2021-01-06 11:08:29 +00:00
committed by GitHub
parent 452244514a
commit dd4625a1e7
6 changed files with 88 additions and 4 deletions
+8
View File
@@ -741,6 +741,10 @@ cfg_if! {
<pallet_babe::Module<Runtime>>::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::next_epoch()
}
fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: sp_consensus_babe::EquivocationProof<
<Block as BlockT>::Header,
@@ -996,6 +1000,10 @@ cfg_if! {
<pallet_babe::Module<Runtime>>::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::next_epoch()
}
fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: sp_consensus_babe::EquivocationProof<
<Block as BlockT>::Header,