From a4216b5ad019d0d5aecdf492da58164957255af8 Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Tue, 28 Nov 2023 13:29:15 +0100
Subject: [PATCH] refactor functions naming for pallet-certification

---
 pallets/certification/src/benchmarking.rs            |  8 ++++----
 pallets/certification/src/lib.rs                     | 12 ++++++------
 pallets/certification/src/weights.rs                 |  8 ++++----
 .../common/src/weights/pallet_certification_cert.rs  |  4 ++--
 .../src/weights/pallet_certification_smith_cert.rs   |  4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/pallets/certification/src/benchmarking.rs b/pallets/certification/src/benchmarking.rs
index 075f8a20e..5539c7981 100644
--- a/pallets/certification/src/benchmarking.rs
+++ b/pallets/certification/src/benchmarking.rs
@@ -82,9 +82,9 @@ benchmarks_instance_pallet! {
     on_initialize {
         assert!(StorageCertsRemovableOn::<T, I>::try_get(T::BlockNumber::zero()).is_err());
     }: {Pallet::<T, I>::on_initialize(T::BlockNumber::zero());}
-    remove_cert_inner_noop {
-    }: {Pallet::<T, I>::remove_cert_inner(100.into(), 101.into(), Some(T::BlockNumber::zero()));}
-    remove_cert_inner {
+    do_remove_cert_noop {
+    }: {Pallet::<T, I>::do_remove_cert(100.into(), 101.into(), Some(T::BlockNumber::zero()));}
+    do_remove_cert {
         let issuer: T::IdtyIndex = 1.into();
         let receiver: T::IdtyIndex = 0.into();
         Pallet::<T, I>::do_add_cert_checked(issuer, receiver, false)?;
@@ -92,7 +92,7 @@ benchmarks_instance_pallet! {
         let receiver_cert: u32 = StorageIdtyCertMeta::<T, I>::get(receiver).received_count;
         let block_number = T::ValidityPeriod::get();
         frame_system::pallet::Pallet::<T>::set_block_number(block_number);
-    }: {Pallet::<T, I>::remove_cert_inner(issuer, receiver, Some(block_number));}
+    }: {Pallet::<T, I>::do_remove_cert(issuer, receiver, Some(block_number));}
     verify {
         assert_has_event::<T, I>(Event::<T, I>::RemovedCert{ issuer: issuer, issuer_issued_count: issuer_cert - 1, receiver: receiver, receiver_received_count: receiver_cert - 1, expiration: true }.into());
     }
diff --git a/pallets/certification/src/lib.rs b/pallets/certification/src/lib.rs
index 164efbe8e..77af87888 100644
--- a/pallets/certification/src/lib.rs
+++ b/pallets/certification/src/lib.rs
@@ -334,7 +334,7 @@ pub mod pallet {
             receiver: T::IdtyIndex,
         ) -> DispatchResultWithPostInfo {
             ensure_root(origin)?;
-            Self::remove_cert_inner(issuer, receiver, None);
+            Self::do_remove_cert(issuer, receiver, None);
             Ok(().into())
         }
 
@@ -347,7 +347,7 @@ pub mod pallet {
         ) -> DispatchResultWithPostInfo {
             ensure_root(origin)?;
             for (issuer, _) in CertsByReceiver::<T, I>::get(idty_index) {
-                Self::remove_cert_inner(issuer, idty_index, None);
+                Self::do_remove_cert(issuer, idty_index, None);
             }
             Ok(().into())
         }
@@ -469,7 +469,7 @@ pub mod pallet {
 
             if let Some(certs) = StorageCertsRemovableOn::<T, I>::take(block_number) {
                 for (issuer, receiver) in certs {
-                    total_weight += Self::remove_cert_inner(issuer, receiver, Some(block_number));
+                    total_weight += Self::do_remove_cert(issuer, receiver, Some(block_number));
                 }
             }
 
@@ -477,7 +477,7 @@ pub mod pallet {
         }
         /// perform the certification removal
         /// if block number is given only remove cert if still set to expire at this block number
-        pub fn remove_cert_inner(
+        pub fn do_remove_cert(
             issuer: T::IdtyIndex,
             receiver: T::IdtyIndex,
             block_number_opt: Option<T::BlockNumber>,
@@ -500,7 +500,7 @@ pub mod pallet {
                         removed = true;
                     }
                 } else {
-                    total_weight += T::WeightInfo::remove_cert_inner_noop();
+                    total_weight += T::WeightInfo::do_remove_cert_noop();
                 }
             });
             if removed {
@@ -534,7 +534,7 @@ pub mod pallet {
                 // Pessimistic overhead estimation based on the worst path of a successfull
                 // certificate removal to avoid multiplying benchmarks for every branching,
                 // include the OnRemovedCert weight.
-                total_weight.saturating_add(T::WeightInfo::remove_cert_inner());
+                total_weight.saturating_add(T::WeightInfo::do_remove_cert());
             }
             total_weight
         }
diff --git a/pallets/certification/src/weights.rs b/pallets/certification/src/weights.rs
index c80099fff..4a5bc2f40 100644
--- a/pallets/certification/src/weights.rs
+++ b/pallets/certification/src/weights.rs
@@ -24,8 +24,8 @@ pub trait WeightInfo {
     fn del_cert() -> Weight;
     fn remove_all_certs_received_by(i: u32) -> Weight;
     fn on_initialize() -> Weight;
-    fn remove_cert_inner_noop() -> Weight;
-    fn remove_cert_inner() -> Weight;
+    fn do_remove_cert_noop() -> Weight;
+    fn do_remove_cert() -> Weight;
 }
 
 // Insecure weights implementation, use it for tests only!
@@ -72,13 +72,13 @@ impl WeightInfo for () {
             .saturating_add(RocksDbWeight::get().reads(7 as u64))
             .saturating_add(RocksDbWeight::get().writes(4 as u64))
     }
-    fn remove_cert_inner_noop() -> Weight {
+    fn do_remove_cert_noop() -> Weight {
         // Minimum execution time: 259_247 nanoseconds.
         Weight::from_parts(269_348_000 as u64, 0)
             .saturating_add(RocksDbWeight::get().reads(7 as u64))
             .saturating_add(RocksDbWeight::get().writes(4 as u64))
     }
-    fn remove_cert_inner() -> Weight {
+    fn do_remove_cert() -> Weight {
         // Minimum execution time: 259_247 nanoseconds.
         Weight::from_parts(269_348_000 as u64, 0)
             .saturating_add(RocksDbWeight::get().reads(7 as u64))
diff --git a/runtime/common/src/weights/pallet_certification_cert.rs b/runtime/common/src/weights/pallet_certification_cert.rs
index bffd614ac..0378b59c1 100644
--- a/runtime/common/src/weights/pallet_certification_cert.rs
+++ b/runtime/common/src/weights/pallet_certification_cert.rs
@@ -111,7 +111,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T>
 	}
 	/// Storage: Cert CertsByReceiver (r:1 w:1)
 	/// Proof Skipped: Cert CertsByReceiver (max_values: None, max_size: None, mode: Measured)
-	fn remove_cert_inner_noop() -> Weight {
+	fn do_remove_cert_noop() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `279`
 		//  Estimated: `3744`
@@ -129,7 +129,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T>
 	/// Proof Skipped: Parameters ParametersStorage (max_values: Some(1), max_size: None, mode: Measured)
 	/// Storage: Membership Membership (r:1 w:0)
 	/// Proof Skipped: Membership Membership (max_values: None, max_size: None, mode: Measured)
-	fn remove_cert_inner() -> Weight {
+	fn do_remove_cert() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `722`
 		//  Estimated: `6662`
diff --git a/runtime/common/src/weights/pallet_certification_smith_cert.rs b/runtime/common/src/weights/pallet_certification_smith_cert.rs
index baadba991..d0bd5e069 100644
--- a/runtime/common/src/weights/pallet_certification_smith_cert.rs
+++ b/runtime/common/src/weights/pallet_certification_smith_cert.rs
@@ -111,7 +111,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T>
 	}
 	/// Storage: SmithCert CertsByReceiver (r:1 w:1)
 	/// Proof Skipped: SmithCert CertsByReceiver (max_values: None, max_size: None, mode: Measured)
-	fn remove_cert_inner_noop() -> Weight {
+	fn do_remove_cert_noop() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `235`
 		//  Estimated: `3700`
@@ -129,7 +129,7 @@ impl<T: frame_system::Config> pallet_certification::WeightInfo for WeightInfo<T>
 	/// Proof Skipped: Parameters ParametersStorage (max_values: Some(1), max_size: None, mode: Measured)
 	/// Storage: SmithMembership Membership (r:1 w:0)
 	/// Proof Skipped: SmithMembership Membership (max_values: None, max_size: None, mode: Measured)
-	fn remove_cert_inner() -> Weight {
+	fn do_remove_cert() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `638`
 		//  Estimated: `6578`
-- 
GitLab