mirror of
https://git.ghostchain.io/proxmio/ghost-node.git
synced 2025-12-27 11:19:57 +00:00
authorities stored based on the session hash map
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
@@ -16,7 +16,6 @@ use sp_staking::{
|
||||
SessionIndex,
|
||||
};
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
use crate as slow_clap;
|
||||
@@ -231,12 +230,33 @@ pub fn advance_session() {
|
||||
let now = System::block_number().max(1);
|
||||
System::set_block_number(now + 1);
|
||||
Session::rotate_session();
|
||||
let session_index = Session::current_index();
|
||||
|
||||
let authorities = Session::validators()
|
||||
.into_iter()
|
||||
.map(UintAuthorityId)
|
||||
.collect();
|
||||
|
||||
SlowClap::set_test_authorities(authorities);
|
||||
assert_eq!(Session::current_index(), (now / Period::get()) as u32);
|
||||
SlowClap::set_test_authorities(session_index, authorities);
|
||||
assert_eq!(session_index, (now / Period::get()) as u32);
|
||||
}
|
||||
|
||||
pub fn advance_session_with_authority(authority: u64) {
|
||||
let now = System::block_number().max(1);
|
||||
System::set_block_number(now + 1);
|
||||
Session::rotate_session();
|
||||
|
||||
let session_index = Session::current_index();
|
||||
|
||||
SlowClap::set_test_authorities(
|
||||
session_index,
|
||||
vec![
|
||||
UintAuthorityId::from(authority),
|
||||
UintAuthorityId::from(69),
|
||||
UintAuthorityId::from(420),
|
||||
UintAuthorityId::from(1337),
|
||||
]
|
||||
);
|
||||
assert_eq!(session_index, (now / Period::get()) as u32);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user