diff --git a/pallets/certification/src/benchmarking.rs b/pallets/certification/src/benchmarking.rs index 13909632e506a53714c3e832ebaf0483321de094..25f12579e4f83a6ec0002e6ef96ca828f939573d 100644 --- a/pallets/certification/src/benchmarking.rs +++ b/pallets/certification/src/benchmarking.rs @@ -34,7 +34,7 @@ fn assert_has_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::R fn add_certs<T: Config<I>, I: 'static>(i: u32, receiver: T::IdtyIndex) -> Result<(), &'static str> { Pallet::<T, I>::remove_all_certs_received_by(RawOrigin::Root.into(), receiver)?; for j in 1..i { - Pallet::<T, I>::force_add_cert(RawOrigin::Root.into(), j.into(), receiver, false)?; + Pallet::<T, I>::do_add_cert_checked(RawOrigin::Root.into(), j.into(), receiver, false)?; } assert!( CertsByReceiver::<T, I>::get(receiver).len() as u32 == i - 1, @@ -63,7 +63,7 @@ benchmarks_instance_pallet! { del_cert { let issuer: T::IdtyIndex = 1.into(); let receiver: T::IdtyIndex = 0.into(); - Pallet::<T, I>::force_add_cert(RawOrigin::Root.into(), issuer, receiver, false)?; + Pallet::<T, I>::do_add_cert_checked(RawOrigin::Root.into(), issuer, receiver, false)?; let receiver_cert: u32 = StorageIdtyCertMeta::<T, I>::get(receiver).received_count; let issuer_cert: u32 = StorageIdtyCertMeta::<T, I>::get(issuer).issued_count; }: _<T::RuntimeOrigin>(RawOrigin::Root.into(), issuer, receiver) diff --git a/pallets/certification/src/weights.rs b/pallets/certification/src/weights.rs index 54665716e423e023d0e38068563f0b7d9cf8d882..2d4ed1c30565b3491f9eae58819f41714654e2dd 100644 --- a/pallets/certification/src/weights.rs +++ b/pallets/certification/src/weights.rs @@ -20,7 +20,7 @@ use frame_support::weights::{constants::RocksDbWeight, Weight}; /// Weight functions needed for pallet_universal_dividend. pub trait WeightInfo { - fn force_add_cert() -> Weight; + fn do_add_cert_checked() -> Weight; fn add_cert() -> Weight; fn del_cert() -> Weight; fn remove_all_certs_received_by(i: u32) -> Weight; @@ -32,7 +32,7 @@ impl WeightInfo for () { // Storage: Parameters ParametersStorage (r:1 w:0) // Storage: Cert StorageCertsRemovableOn (r:1 w:1) // Storage: Cert CertsByReceiver (r:1 w:1) - fn force_add_cert() -> Weight { + fn do_add_cert_checked() -> Weight { // Minimum execution time: 221_467 nanoseconds. Weight::from_ref_time(227_833_000 as u64) .saturating_add(RocksDbWeight::get().reads(5 as u64)) diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs index adc21d5734f53ffe97ffa002ad29bbb174458b2a..50a41c70b5184d96a8fa1598b958a80cfb32aad1 100644 --- a/pallets/duniter-wot/src/lib.rs +++ b/pallets/duniter-wot/src/lib.rs @@ -303,9 +303,9 @@ impl<T: Config<I>, I: 'static> pallet_identity::traits::OnIdtyChange<T> for Pall fn on_idty_change(idty_index: IdtyIndex, idty_event: &IdtyEvent<T>) -> Weight { match idty_event { IdtyEvent::Created { creator } => { - if let Err(e) = - <pallet_certification::Pallet<T, I>>::force_add_cert(*creator, idty_index, true) - { + if let Err(e) = <pallet_certification::Pallet<T, I>>::do_add_cert_checked( + *creator, idty_index, true, + ) { sp_std::if_std! { println!("fail to force add cert: {:?}", e) } diff --git a/runtime/common/src/weights/pallet_certification_cert.rs b/runtime/common/src/weights/pallet_certification_cert.rs index 4a5f50a28223edad62f535c52f5fbf20f7780acc..acd4cd7aa9018d5a6e04a77e83e191f25ab6187c 100644 --- a/runtime/common/src/weights/pallet_certification_cert.rs +++ b/runtime/common/src/weights/pallet_certification_cert.rs @@ -50,7 +50,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T> // Storage: Parameters ParametersStorage (r:1 w:0) // Storage: Cert StorageCertsRemovableOn (r:1 w:1) // Storage: Cert CertsByReceiver (r:1 w:1) - fn force_add_cert() -> Weight { + fn do_add_cert_checked() -> Weight { // Minimum execution time: 48_363 nanoseconds. Weight::from_ref_time(59_125_000 as u64) .saturating_add(T::DbWeight::get().reads(5 as u64)) diff --git a/runtime/common/src/weights/pallet_certification_smith_cert.rs b/runtime/common/src/weights/pallet_certification_smith_cert.rs index b3d4c3d912f269d85c31a8e63be62f6456a66234..6f735ab2bc1e8746e9869b468028be48cde89864 100644 --- a/runtime/common/src/weights/pallet_certification_smith_cert.rs +++ b/runtime/common/src/weights/pallet_certification_smith_cert.rs @@ -50,7 +50,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T> // Storage: Parameters ParametersStorage (r:1 w:0) // Storage: SmithCert StorageCertsRemovableOn (r:1 w:1) // Storage: SmithCert CertsByReceiver (r:1 w:1) - fn force_add_cert() -> Weight { + fn do_add_cert_checked() -> Weight { // Minimum execution time: 57_241 nanoseconds. Weight::from_ref_time(69_631_000 as u64) .saturating_add(T::DbWeight::get().reads(5 as u64))