From d815566246d57bcfa2c59a600cb47b51d7e8cd06 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 1 Jul 2021 10:55:18 +0200 Subject: [PATCH 1/2] name reward amount --- frame/election-provider-multi-phase/src/lib.rs | 5 +++-- frame/election-provider-multi-phase/src/signed.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 7aab93fb652f7..24d94fb85deae 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -983,6 +983,7 @@ pub mod pallet { #[pallet::event] #[pallet::metadata(::AccountId = "AccountId")] + #[pallet::metadata(BalanceOf = "Balance")] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// A solution was stored with the given compute. @@ -996,9 +997,9 @@ pub mod pallet { /// election failed, `None`. ElectionFinalized(Option), /// An account has been rewarded for their signed submission being finalized. - Rewarded(::AccountId), + Rewarded(::AccountId, BalanceOf), /// An account has been slashed for submitting an invalid signed submission. - Slashed(::AccountId), + Slashed(::AccountId, BalanceOf), /// The signed phase of the given round has started. SignedPhaseStarted(u32), /// The unsigned phase of the given round has started. diff --git a/frame/election-provider-multi-phase/src/signed.rs b/frame/election-provider-multi-phase/src/signed.rs index ba1123c1331ad..1aaf96b8add94 100644 --- a/frame/election-provider-multi-phase/src/signed.rs +++ b/frame/election-provider-multi-phase/src/signed.rs @@ -417,7 +417,7 @@ impl Pallet { >::put(ready_solution); // emit reward event - Self::deposit_event(crate::Event::Rewarded(who.clone())); + Self::deposit_event(crate::Event::Rewarded(who.clone(), reward)); // unreserve deposit. let _remaining = T::Currency::unreserve(who, deposit); @@ -434,7 +434,7 @@ impl Pallet { /// /// Infallible pub fn finalize_signed_phase_reject_solution(who: &T::AccountId, deposit: BalanceOf) { - Self::deposit_event(crate::Event::Slashed(who.clone())); + Self::deposit_event(crate::Event::Slashed(who.clone(), deposit)); let (negative_imbalance, _remaining) = T::Currency::slash_reserved(who, deposit); debug_assert!(_remaining.is_zero()); T::SlashHandler::on_unbalanced(negative_imbalance); From bc687966c9cb80e8eb97dceabb6761fd806c0e74 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 1 Jul 2021 11:17:52 +0200 Subject: [PATCH 2/2] Fix --- frame/election-provider-multi-phase/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 24d94fb85deae..6c92f2b157180 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -982,8 +982,10 @@ pub mod pallet { } #[pallet::event] - #[pallet::metadata(::AccountId = "AccountId")] - #[pallet::metadata(BalanceOf = "Balance")] + #[pallet::metadata( + ::AccountId = "AccountId", + BalanceOf = "Balance" + )] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// A solution was stored with the given compute.