mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 04:11:09 +00:00
Configurable call fee refund for signed submissions (#11002)
* Refund call fee for all non-invalid signed submissions * Clean up * Fix benchmarks * Remove reward from struct * WIP SignedMaxRefunds * Apply suggestions from code review * Add test for ejected call_fee refunds * Add test for number of calls refunded * Account for read op in mutate * Apply suggestions from code review * Add to node runtime * Don't refund ejected solutions * Update frame/election-provider-multi-phase/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Inegrity test SignedMaxRefunds * Use reward handle to refund call fee * Fix node runtime build * Drain in order of submission * Update frame/election-provider-multi-phase/src/signed.rs * save * Update frame/election-provider-multi-phase/src/signed.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * Update frame/election-provider-multi-phase/src/signed.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -225,14 +225,24 @@ frame_benchmarking::benchmarks! {
|
||||
compute: Default::default()
|
||||
};
|
||||
let deposit: BalanceOf<T> = 10u32.into();
|
||||
let reward: BalanceOf<T> = 20u32.into();
|
||||
|
||||
let reward: BalanceOf<T> = T::SignedRewardBase::get();
|
||||
let call_fee: BalanceOf<T> = 30u32.into();
|
||||
|
||||
assert_ok!(T::Currency::reserve(&receiver, deposit));
|
||||
assert_eq!(T::Currency::free_balance(&receiver), initial_balance - 10u32.into());
|
||||
}: {
|
||||
<MultiPhase<T>>::finalize_signed_phase_accept_solution(ready, &receiver, deposit, reward)
|
||||
<MultiPhase<T>>::finalize_signed_phase_accept_solution(
|
||||
ready,
|
||||
&receiver,
|
||||
deposit,
|
||||
call_fee
|
||||
)
|
||||
} verify {
|
||||
assert_eq!(T::Currency::free_balance(&receiver), initial_balance + 20u32.into());
|
||||
assert_eq!(
|
||||
T::Currency::free_balance(&receiver),
|
||||
initial_balance + reward + call_fee
|
||||
);
|
||||
assert_eq!(T::Currency::reserved_balance(&receiver), 0u32.into());
|
||||
}
|
||||
|
||||
@@ -333,7 +343,7 @@ frame_benchmarking::benchmarks! {
|
||||
raw_solution,
|
||||
who: account("submitters", i, SEED),
|
||||
deposit: Default::default(),
|
||||
reward: Default::default(),
|
||||
call_fee: Default::default(),
|
||||
};
|
||||
signed_submissions.insert(signed_submission);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user