From f7b47ee5124bb12651c86de7d7e1637f26e244f4 Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Sat, 25 Nov 2023 15:52:05 +0100
Subject: [PATCH] remove handlers weights for pallet_certification

---
 pallets/certification/src/lib.rs    |  3 +--
 pallets/certification/src/traits.rs | 15 +++++----------
 pallets/duniter-wot/src/lib.rs      |  8 ++------
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/pallets/certification/src/lib.rs b/pallets/certification/src/lib.rs
index 0045814c2..164efbe8e 100644
--- a/pallets/certification/src/lib.rs
+++ b/pallets/certification/src/lib.rs
@@ -543,11 +543,10 @@ pub mod pallet {
 
 // implement setting next_issuable_on for certification period
 impl<T: Config<I>, I: 'static> SetNextIssuableOn<T::BlockNumber, T::IdtyIndex> for Pallet<T, I> {
-    fn set_next_issuable_on(idty_index: T::IdtyIndex, next_issuable_on: T::BlockNumber) -> Weight {
+    fn set_next_issuable_on(idty_index: T::IdtyIndex, next_issuable_on: T::BlockNumber) {
         <StorageIdtyCertMeta<T, I>>::mutate_exists(idty_index, |cert_meta_opt| {
             let cert_meta = cert_meta_opt.get_or_insert(IdtyCertMeta::default());
             cert_meta.next_issuable_on = next_issuable_on;
         });
-        Weight::zero()
     }
 }
diff --git a/pallets/certification/src/traits.rs b/pallets/certification/src/traits.rs
index 6189b35e0..ae6e37c0f 100644
--- a/pallets/certification/src/traits.rs
+++ b/pallets/certification/src/traits.rs
@@ -32,7 +32,7 @@ pub trait OnNewcert<IdtyIndex> {
         issuer_issued_count: u32,
         receiver: IdtyIndex,
         receiver_received_count: u32,
-    ) -> frame_support::dispatch::Weight;
+    );
 }
 impl<IdtyIndex> OnNewcert<IdtyIndex> for () {
     fn on_new_cert(
@@ -40,8 +40,7 @@ impl<IdtyIndex> OnNewcert<IdtyIndex> for () {
         _issuer_issued_count: u32,
         _receiver: IdtyIndex,
         _receiver_received_count: u32,
-    ) -> frame_support::dispatch::Weight {
-        Weight::zero()
+    ) {
     }
 }
 
@@ -52,7 +51,7 @@ pub trait OnRemovedCert<IdtyIndex> {
         receiver: IdtyIndex,
         receiver_received_count: u32,
         expiration: bool,
-    ) -> frame_support::dispatch::Weight;
+    );
 }
 impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () {
     fn on_removed_cert(
@@ -61,14 +60,10 @@ impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () {
         _receiver: IdtyIndex,
         _receiver_received_count: u32,
         _expiration: bool,
-    ) -> frame_support::dispatch::Weight {
-        Weight::zero()
+    ) {
     }
 }
 
 pub trait SetNextIssuableOn<BlockNumber, IdtyIndex> {
-    fn set_next_issuable_on(
-        idty_index: IdtyIndex,
-        next_issuable_on: BlockNumber,
-    ) -> frame_support::dispatch::Weight;
+    fn set_next_issuable_on(idty_index: IdtyIndex, next_issuable_on: BlockNumber);
 }
diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs
index 44f400d1d..38951486b 100644
--- a/pallets/duniter-wot/src/lib.rs
+++ b/pallets/duniter-wot/src/lib.rs
@@ -406,11 +406,10 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnNewcert<IdtyIndex
         _issuer_issued_count: u32,
         receiver: IdtyIndex,
         receiver_received_count: u32,
-    ) -> Weight {
+    ) {
         if receiver_received_count == T::MinReceivedCertToBeAbleToIssueCert::get() {
             Self::do_apply_first_issuable_on(receiver);
         }
-        Weight::zero()
     }
 }
 
@@ -424,7 +423,7 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI
         receiver: IdtyIndex,
         receiver_received_count: u32,
         _expiration: bool,
-    ) -> Weight {
+    ) {
         if receiver_received_count < T::MinCertForMembership::get()
             && pallet_membership::Pallet::<T, I>::is_member(&receiver)
         {
@@ -436,8 +435,5 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI
                 }
             }
         }
-        // The weight accounting is performed where the handler is called.
-        // See remove_cert_inner in pallet-certification.
-        Weight::zero()
     }
 }
-- 
GitLab