Skip to content
Snippets Groups Projects
Unverified Commit 85ba727d authored by bgallois's avatar bgallois
Browse files

remove handlers weights for pallet_certification

parent a8aaa0de
No related branches found
No related tags found
No related merge requests found
...@@ -543,11 +543,10 @@ pub mod pallet { ...@@ -543,11 +543,10 @@ pub mod pallet {
// implement setting next_issuable_on for certification period // implement setting next_issuable_on for certification period
impl<T: Config<I>, I: 'static> SetNextIssuableOn<T::BlockNumber, T::IdtyIndex> for Pallet<T, I> { 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| { <StorageIdtyCertMeta<T, I>>::mutate_exists(idty_index, |cert_meta_opt| {
let cert_meta = cert_meta_opt.get_or_insert(IdtyCertMeta::default()); let cert_meta = cert_meta_opt.get_or_insert(IdtyCertMeta::default());
cert_meta.next_issuable_on = next_issuable_on; cert_meta.next_issuable_on = next_issuable_on;
}); });
Weight::zero()
} }
} }
...@@ -32,7 +32,7 @@ pub trait OnNewcert<IdtyIndex> { ...@@ -32,7 +32,7 @@ pub trait OnNewcert<IdtyIndex> {
issuer_issued_count: u32, issuer_issued_count: u32,
receiver: IdtyIndex, receiver: IdtyIndex,
receiver_received_count: u32, receiver_received_count: u32,
) -> frame_support::dispatch::Weight; );
} }
impl<IdtyIndex> OnNewcert<IdtyIndex> for () { impl<IdtyIndex> OnNewcert<IdtyIndex> for () {
fn on_new_cert( fn on_new_cert(
...@@ -40,8 +40,7 @@ impl<IdtyIndex> OnNewcert<IdtyIndex> for () { ...@@ -40,8 +40,7 @@ impl<IdtyIndex> OnNewcert<IdtyIndex> for () {
_issuer_issued_count: u32, _issuer_issued_count: u32,
_receiver: IdtyIndex, _receiver: IdtyIndex,
_receiver_received_count: u32, _receiver_received_count: u32,
) -> frame_support::dispatch::Weight { ) {
Weight::zero()
} }
} }
...@@ -52,7 +51,7 @@ pub trait OnRemovedCert<IdtyIndex> { ...@@ -52,7 +51,7 @@ pub trait OnRemovedCert<IdtyIndex> {
receiver: IdtyIndex, receiver: IdtyIndex,
receiver_received_count: u32, receiver_received_count: u32,
expiration: bool, expiration: bool,
) -> frame_support::dispatch::Weight; );
} }
impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () { impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () {
fn on_removed_cert( fn on_removed_cert(
...@@ -61,14 +60,10 @@ impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () { ...@@ -61,14 +60,10 @@ impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () {
_receiver: IdtyIndex, _receiver: IdtyIndex,
_receiver_received_count: u32, _receiver_received_count: u32,
_expiration: bool, _expiration: bool,
) -> frame_support::dispatch::Weight { ) {
Weight::zero()
} }
} }
pub trait SetNextIssuableOn<BlockNumber, IdtyIndex> { pub trait SetNextIssuableOn<BlockNumber, IdtyIndex> {
fn set_next_issuable_on( fn set_next_issuable_on(idty_index: IdtyIndex, next_issuable_on: BlockNumber);
idty_index: IdtyIndex,
next_issuable_on: BlockNumber,
) -> frame_support::dispatch::Weight;
} }
...@@ -406,11 +406,10 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnNewcert<IdtyIndex ...@@ -406,11 +406,10 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnNewcert<IdtyIndex
_issuer_issued_count: u32, _issuer_issued_count: u32,
receiver: IdtyIndex, receiver: IdtyIndex,
receiver_received_count: u32, receiver_received_count: u32,
) -> Weight { ) {
if receiver_received_count == T::MinReceivedCertToBeAbleToIssueCert::get() { if receiver_received_count == T::MinReceivedCertToBeAbleToIssueCert::get() {
Self::do_apply_first_issuable_on(receiver); Self::do_apply_first_issuable_on(receiver);
} }
Weight::zero()
} }
} }
...@@ -424,7 +423,7 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI ...@@ -424,7 +423,7 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI
receiver: IdtyIndex, receiver: IdtyIndex,
receiver_received_count: u32, receiver_received_count: u32,
_expiration: bool, _expiration: bool,
) -> Weight { ) {
if receiver_received_count < T::MinCertForMembership::get() if receiver_received_count < T::MinCertForMembership::get()
&& pallet_membership::Pallet::<T, I>::is_member(&receiver) && pallet_membership::Pallet::<T, I>::is_member(&receiver)
{ {
...@@ -436,8 +435,5 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI ...@@ -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()
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment