mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Improve overall performance (#6699)
* Improve overall performance * Clean up code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,7 @@ pub fn create_validator_with_nominators<T: Trait>(
|
||||
let validator_prefs = ValidatorPrefs {
|
||||
commission: Perbill::from_percent(50),
|
||||
};
|
||||
Staking::<T>::validate(RawOrigin::Signed(v_controller.clone()).into(), validator_prefs)?;
|
||||
Staking::<T>::validate(RawOrigin::Signed(v_controller).into(), validator_prefs)?;
|
||||
let stash_lookup: <T::Lookup as StaticLookup>::Source = T::Lookup::unlookup(v_stash.clone());
|
||||
|
||||
points_total += 10;
|
||||
@@ -375,7 +375,7 @@ benchmarks! {
|
||||
for _ in 0 .. l {
|
||||
staking_ledger.unlocking.push(unlock_chunk.clone())
|
||||
}
|
||||
Ledger::<T>::insert(controller.clone(), staking_ledger.clone());
|
||||
Ledger::<T>::insert(controller, staking_ledger);
|
||||
let slash_amount = T::Currency::minimum_balance() * 10.into();
|
||||
let balance_before = T::Currency::free_balance(&stash);
|
||||
}: {
|
||||
|
||||
@@ -1626,7 +1626,7 @@ decl_module! {
|
||||
let era = Self::current_era().unwrap_or(0) + T::BondingDuration::get();
|
||||
ledger.unlocking.push(UnlockChunk { value, era });
|
||||
Self::update_ledger(&controller, &ledger);
|
||||
Self::deposit_event(RawEvent::Unbonded(ledger.stash.clone(), value));
|
||||
Self::deposit_event(RawEvent::Unbonded(ledger.stash, value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ fn slash_nominators<T: Trait>(
|
||||
let mut era_slash = <Module<T> as Store>::NominatorSlashInEra::get(
|
||||
&slash_era,
|
||||
stash,
|
||||
).unwrap_or(Zero::zero());
|
||||
).unwrap_or_else(|| Zero::zero());
|
||||
|
||||
era_slash += own_slash_difference;
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ pub fn get_weak_solution<T: Trait>(
|
||||
|
||||
// self stake
|
||||
<Validators<T>>::iter().for_each(|(who, _p)| {
|
||||
*backing_stake_of.entry(who.clone()).or_insert(Zero::zero()) +=
|
||||
*backing_stake_of.entry(who.clone()).or_insert_with(|| Zero::zero()) +=
|
||||
<Module<T>>::slashable_balance_of(&who)
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user