diff --git a/substrate/staking/pallet/src/lib.rs b/substrate/staking/pallet/src/lib.rs index 99b1415b..32bdfb73 100644 --- a/substrate/staking/pallet/src/lib.rs +++ b/substrate/staking/pallet/src/lib.rs @@ -158,17 +158,14 @@ pub mod pallet { // then we wait until the session ends then get a call to end_session(i) and so on. impl SessionManager for Pallet { fn new_session(_new_index: u32) -> Option> { - // Don't call new_session multiple times on genesis - // TODO: Will this cause pallet_session::Pallet::current_index to desync from validator-sets? - if frame_system::Pallet::::block_number() > 1u32.into() { - VsPallet::::new_session(); - } + VsPallet::::new_session(); // TODO: Where do we return their stake? - Some(VsPallet::::validators(NetworkId::Serai)) + Some(VsPallet::::select_validators(NetworkId::Serai)) } fn new_session_genesis(_: u32) -> Option> { - Some(VsPallet::::validators(NetworkId::Serai)) + // TODO: Because we don't call new_session here, we don't emit NewSet { Serai, session: 1 } + Some(VsPallet::::select_validators(NetworkId::Serai)) } fn end_session(_end_index: u32) {} diff --git a/substrate/validator-sets/pallet/src/lib.rs b/substrate/validator-sets/pallet/src/lib.rs index da319974..4f8a1c32 100644 --- a/substrate/validator-sets/pallet/src/lib.rs +++ b/substrate/validator-sets/pallet/src/lib.rs @@ -418,7 +418,7 @@ pub mod pallet { } } - pub fn validators(network: NetworkId) -> Vec { + pub fn select_validators(network: NetworkId) -> Vec { Self::participants(network).into() }