Skip to content
Snippets Groups Projects

Fix weight accounting

Merged Benjamin Gallois requested to merge 167-fix-remove-member-weight into master
Compare and Show latest version
4 files
+ 10
17
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -366,17 +366,13 @@ pub mod pallet {
if verify_rules {
// only verify internal rules if asked
if let Err(e) = Self::check_add_cert_internal(issuer, receiver, block_number) {
sp_std::if_std! {
println!("fail to force add cert: {:?}", e)
}
sp_std::if_std! {println!("fail to force add cert: {:?}", e)}
return T::WeightInfo::do_add_cert_checked();
}
}
if let Err(e) = Self::try_add_cert(block_number, issuer, receiver) {
sp_std::if_std! {
println!("fail to force add cert: {:?}", e)
}
sp_std::if_std! {println!("fail to force add cert: {:?}", e)}
}
T::WeightInfo::do_add_cert_checked()
}
@@ -491,7 +487,7 @@ pub mod pallet {
receiver: T::IdtyIndex,
block_number_opt: Option<BlockNumberFor<T>>,
) -> Weight {
let total_weight = Weight::zero();
let mut total_weight = Weight::zero();
let mut removed = false;
CertsByReceiver::<T>::mutate_exists(receiver, |issuers_opt| {
let issuers = issuers_opt.get_or_insert(Vec::with_capacity(0));
@@ -509,7 +505,7 @@ pub mod pallet {
removed = true;
}
} else {
total_weight.saturating_add(T::WeightInfo::do_remove_cert_noop());
total_weight += T::WeightInfo::do_remove_cert_noop();
}
});
if removed {
@@ -530,7 +526,6 @@ pub mod pallet {
receiver,
expiration: block_number_opt.is_some(),
});
// Should always return Weight::zero
T::OnRemovedCert::on_removed_cert(
issuer,
issuer_issued_count,
Loading