mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Rb staking pallet validator commission change event (#10827)
* commission-changed-event-and-deposit * deposit_event fix * commission_changed_event_works * fmt * CommissionChanged -> ValidatorPrefsUpdated * event ValidatorPrefs * updated commet * fmt * Update frame/staking/src/pallet/mod.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/staking/src/pallet/mod.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/staking/src/tests.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -628,6 +628,8 @@ pub mod pallet {
|
||||
Chilled(T::AccountId),
|
||||
/// The stakers' rewards are getting paid. \[era_index, validator_stash\]
|
||||
PayoutStarted(EraIndex, T::AccountId),
|
||||
/// A validator has set their preferences.
|
||||
ValidatorPrefsSet(T::AccountId, ValidatorPrefs),
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
@@ -1016,7 +1018,9 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
Self::do_remove_nominator(stash);
|
||||
Self::do_add_validator(stash, prefs);
|
||||
Self::do_add_validator(stash, prefs.clone());
|
||||
Self::deposit_event(Event::<T>::ValidatorPrefsSet(ledger.stash, prefs));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -4598,11 +4598,21 @@ fn capped_stakers_works() {
|
||||
#[test]
|
||||
fn min_commission_works() {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
// account 10 controls the stash from account 11
|
||||
assert_ok!(Staking::validate(
|
||||
Origin::signed(10),
|
||||
ValidatorPrefs { commission: Perbill::from_percent(5), blocked: false }
|
||||
));
|
||||
|
||||
// event emitted should be correct
|
||||
assert_eq!(
|
||||
*staking_events().last().unwrap(),
|
||||
Event::ValidatorPrefsSet(
|
||||
11,
|
||||
ValidatorPrefs { commission: Perbill::from_percent(5), blocked: false }
|
||||
)
|
||||
);
|
||||
|
||||
assert_ok!(Staking::set_staking_configs(
|
||||
Origin::root(),
|
||||
ConfigOp::Remove,
|
||||
|
||||
Reference in New Issue
Block a user