mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 12:51:05 +00:00
Calculate and refund weight for identity pallet (#5680)
* add old_registrar_count as param to estimate weight * cast count to Weight Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * add weight calculation for set_identity * remove superfluous weight comment * add detailed weight estimation for set_subs * adjust benchmarking code to the new API * add second parameter to set_subs benchmark * rename o to p * calculate weight based on benchmarks * use try_mutate for registrars * fix weight number typo * update weights for set_subs + add weights for clear_identity and request_judgement * improve naming and docs * add weight calculation for cancel_request * fix benchmark * fix tests * fix arithmetic overflow in balances triggered by tests * add weight calcluations for more dispatchables * add weight calculation for provide_judgement * mark param as unused * add MaxRegistrars associated type used for weight estimation * check that MaxRegistrars is not exceeded * add remaining weight calculations * use weight refunds to use more constants in weight estimation * adjust usage of clear_identity * refund request_judgement weights and remove param * refund weights for cancel_request and remove param * add remaining refunds and remove params * refund weight for set_subs and remove param * make comment more specific * add range note to benchmarking docs * fix inconsistencies before review * fix actual weight calculation for add_registrar * remove duplicate balance ops weights + refund on all dispatchables Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -1099,7 +1099,7 @@ impl<T: Trait<I>, I: Instance> Currency<T::AccountId> for Module<T, I> where
|
||||
// equal and opposite cause (returned as an Imbalance), then in the
|
||||
// instance that there's no other accounts on the system at all, we might
|
||||
// underflow the issuance and our arithmetic will be off.
|
||||
ensure!(value + account.reserved >= ed || !account.total().is_zero(), ());
|
||||
ensure!(value.saturating_add(account.reserved) >= ed || !account.total().is_zero(), ());
|
||||
|
||||
let imbalance = if account.free <= value {
|
||||
SignedImbalance::Positive(PositiveImbalance::new(value - account.free))
|
||||
|
||||
Reference in New Issue
Block a user