Skip to content

Commit

Permalink
Rename validators to select_validators
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Oct 11, 2023
1 parent 2401266 commit f692047
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions substrate/staking/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Config> SessionManager<T::ValidatorId> for Pallet<T> {
fn new_session(_new_index: u32) -> Option<Vec<T::ValidatorId>> {
// 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::<T>::block_number() > 1u32.into() {
VsPallet::<T>::new_session();
}
VsPallet::<T>::new_session();
// TODO: Where do we return their stake?
Some(VsPallet::<T>::validators(NetworkId::Serai))
Some(VsPallet::<T>::select_validators(NetworkId::Serai))
}

fn new_session_genesis(_: u32) -> Option<Vec<T::ValidatorId>> {
Some(VsPallet::<T>::validators(NetworkId::Serai))
// TODO: Because we don't call new_session here, we don't emit NewSet { Serai, session: 1 }
Some(VsPallet::<T>::select_validators(NetworkId::Serai))
}

fn end_session(_end_index: u32) {}
Expand Down
2 changes: 1 addition & 1 deletion substrate/validator-sets/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ pub mod pallet {
}
}

pub fn validators(network: NetworkId) -> Vec<Public> {
pub fn select_validators(network: NetworkId) -> Vec<Public> {
Self::participants(network).into()
}

Expand Down

0 comments on commit f692047

Please sign in to comment.