mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
staking: Fix Reward usage (#10887)
* staking: Fix `Reward` usage
* Some small fixes
* Check on_unbalanced was called
* Improve tests
* Add not for Reward; FMT
* 🤦
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -237,6 +237,7 @@ const THRESHOLDS: [sp_npos_elections::VoteWeight; 9] =
|
||||
parameter_types! {
|
||||
pub static BagThresholds: &'static [sp_npos_elections::VoteWeight] = &THRESHOLDS;
|
||||
pub static MaxNominations: u32 = 16;
|
||||
pub static RewardOnUnbalanceWasCalled: bool = false;
|
||||
}
|
||||
|
||||
impl pallet_bags_list::Config for Test {
|
||||
@@ -255,6 +256,13 @@ impl onchain::Config for OnChainSeqPhragmen {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
pub struct MockReward {}
|
||||
impl OnUnbalanced<PositiveImbalanceOf<Test>> for MockReward {
|
||||
fn on_unbalanced(_: PositiveImbalanceOf<Test>) {
|
||||
RewardOnUnbalanceWasCalled::set(true);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::pallet::pallet::Config for Test {
|
||||
type MaxNominations = MaxNominations;
|
||||
type Currency = Balances;
|
||||
@@ -263,7 +271,7 @@ impl crate::pallet::pallet::Config for Test {
|
||||
type RewardRemainder = RewardRemainderMock;
|
||||
type Event = Event;
|
||||
type Slash = ();
|
||||
type Reward = ();
|
||||
type Reward = MockReward;
|
||||
type SessionsPerEra = SessionsPerEra;
|
||||
type SlashDeferDuration = SlashDeferDuration;
|
||||
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
|
||||
|
||||
Reference in New Issue
Block a user