mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 20:05:49 +00:00
babe: initialize next authorities on genesis (#7872)
* babe: initialize next authorities on genesis * babe: add test for genesis authorities
This commit is contained in:
@@ -674,6 +674,7 @@ impl<T: Config> Module<T> {
|
|||||||
if !authorities.is_empty() {
|
if !authorities.is_empty() {
|
||||||
assert!(Authorities::get().is_empty(), "Authorities are already initialized!");
|
assert!(Authorities::get().is_empty(), "Authorities are already initialized!");
|
||||||
Authorities::put(authorities);
|
Authorities::put(authorities);
|
||||||
|
NextAuthorities::put(authorities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,12 @@ fn can_enact_next_config() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn can_fetch_current_and_next_epoch_data() {
|
fn can_fetch_current_and_next_epoch_data() {
|
||||||
new_test_ext(5).execute_with(|| {
|
new_test_ext(5).execute_with(|| {
|
||||||
|
// genesis authorities should be used for the first and second epoch
|
||||||
|
assert_eq!(
|
||||||
|
Babe::current_epoch().authorities,
|
||||||
|
Babe::next_epoch().authorities,
|
||||||
|
);
|
||||||
|
|
||||||
// 1 era = 3 epochs
|
// 1 era = 3 epochs
|
||||||
// 1 epoch = 3 slots
|
// 1 epoch = 3 slots
|
||||||
// Eras start from 0.
|
// Eras start from 0.
|
||||||
|
|||||||
Reference in New Issue
Block a user