From e43e8859d140ad937e134981bb259d627889baf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Pestana?= Date: Tue, 3 Dec 2024 23:04:56 +0100 Subject: [PATCH] addresses PR comments --- .../frame/election-provider-multi-phase/src/lib.rs | 1 + substrate/frame/staking/src/pallet/impls.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/substrate/frame/election-provider-multi-phase/src/lib.rs b/substrate/frame/election-provider-multi-phase/src/lib.rs index 8676be438300..6733bd15b357 100644 --- a/substrate/frame/election-provider-multi-phase/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/src/lib.rs @@ -679,6 +679,7 @@ pub mod pallet { /// Maximum number of winners that an election supports. /// /// Note: This must always be greater or equal to `T::DataProvider::desired_targets()`. + #[pallet::constant] type MaxWinners: Get; /// Maximum number of voters that can support a winner in an election solution. diff --git a/substrate/frame/staking/src/pallet/impls.rs b/substrate/frame/staking/src/pallet/impls.rs index 785c688453dd..fb30e3f497d1 100644 --- a/substrate/frame/staking/src/pallet/impls.rs +++ b/substrate/frame/staking/src/pallet/impls.rs @@ -707,18 +707,17 @@ impl Pallet { }, _ => {}, } - // election failed, clear election prep metadata. Self::clear_election_metadata(); - Self::deposit_event(Event::StakingElectionFailed); - return None - } - Self::deposit_event(Event::StakersElected); - Self::trigger_new_era(start_session_index); + None + } else { + Self::deposit_event(Event::StakersElected); + Self::trigger_new_era(start_session_index); - Some(validators) + Some(validators) + } } /// Paginated elect.