diff --git a/src/lib.rs b/src/lib.rs index 60a0374..63013bf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1847,7 +1847,7 @@ pub mod pallet { let now = Self::current_block_number(); let kick_threshold = T::KickThreshold::get(); let min_collators = T::MinEligibleCollators::get(); - let candidacy_bond = MinCandidacyBond::::get(); + let min_candidacy_bond = MinCandidacyBond::::get(); Candidates::::iter() .filter_map(|(who, info)| { let last_block = LastAuthoredBlock::::get(who.clone()); @@ -1855,7 +1855,7 @@ pub mod pallet { let is_lazy = since_last >= kick_threshold; let bond = Self::get_bond(&who); - if Self::eligible_collators() <= min_collators || (!is_lazy && bond.saturating_add(info.stake) >= candidacy_bond) { + if Self::eligible_collators() <= min_collators || (!is_lazy && bond >= min_candidacy_bond) { // Either this is a good collator (not lazy) or we are at the minimum // that the system needs. They get to stay, as long as they have sufficient deposit plus stake. Some(info) diff --git a/src/tests.rs b/src/tests.rs index e737725..0a6a58f 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -571,7 +571,6 @@ mod set_min_candidacy_bond { let candidate_5 = CandidateInfo { stake: 0, stakers: 0 }; register_candidates(3..=5); - lock_for_staking(3..=5); assert_eq!( candidate_list(), vec![(5, candidate_5.clone()), (3, candidate_3.clone()), (4, candidate_4.clone())] @@ -616,21 +615,9 @@ mod set_min_candidacy_bond { bond_amount: 20, })); assert_eq!(MinCandidacyBond::::get(), 20); - assert_ok!(CollatorStaking::stake( - RuntimeOrigin::signed(5), - vec![StakeTarget { candidate: 5, stake: 20 }].try_into().unwrap() - )); - let new_candidate_5 = CandidateInfo { stake: 20, stakers: 1 }; - assert_eq!( - candidate_list(), - vec![ - (3, candidate_3.clone()), - (4, candidate_4.clone()), - (5, new_candidate_5.clone()) - ] - ); + assert_ok!(CollatorStaking::update_candidacy_bond(RuntimeOrigin::signed(5), 20)); CollatorStaking::kick_stale_candidates(); - assert_eq!(candidate_list(), vec![(5, new_candidate_5)]); + assert_eq!(candidate_list(), vec![(5, candidate_5)]); }); } }