From 6f6e596b773abd36d278b93b06c2554aed74983c Mon Sep 17 00:00:00 2001 From: abdulhakim2902 Date: Tue, 23 Nov 2021 15:41:09 +0800 Subject: [PATCH] fix: clippy and fmt certification pallet --- pallets/certifications/src/interface.rs | 48 +- pallets/certifications/src/lib.rs | 615 ++++++++++++------------ pallets/certifications/src/weights.rs | 43 +- 3 files changed, 352 insertions(+), 354 deletions(-) diff --git a/pallets/certifications/src/interface.rs b/pallets/certifications/src/interface.rs index 0f9aa91e..d06f4a81 100644 --- a/pallets/certifications/src/interface.rs +++ b/pallets/certifications/src/interface.rs @@ -1,31 +1,31 @@ //use sp_std::prelude::*; pub trait CertificationInterface { - type Error; - type CertificationId; - type Certification; - type CertificationInfo; + type Error; + type CertificationId; + type Certification; + type CertificationInfo; - fn generate_certification_id( - owner_id: &T::AccountId, - certification_count: u64, - ) -> Self::CertificationId; + fn generate_certification_id( + owner_id: &T::AccountId, + certification_count: u64, + ) -> Self::CertificationId; - fn create_certification( - owner_id: &T::AccountId, - certification: &Self::CertificationInfo, - ) -> Result; - fn update_certification( - owner_id: &T::AccountId, - certification_id: &Self::CertificationId, - certification: &Self::CertificationInfo, - ) -> Result; - fn delete_certification( - owner_id: &T::AccountId, - certification_id: &Self::CertificationId, - ) -> Result; + fn create_certification( + owner_id: &T::AccountId, + certification: &Self::CertificationInfo, + ) -> Result; + fn update_certification( + owner_id: &T::AccountId, + certification_id: &Self::CertificationId, + certification: &Self::CertificationInfo, + ) -> Result; + fn delete_certification( + owner_id: &T::AccountId, + certification_id: &Self::CertificationId, + ) -> Result; - fn certification_count_by_owner(owner_id: &T::AccountId) -> u64; - fn certification_by_id(certification_id: &Self::CertificationId) - -> Option; + fn certification_count_by_owner(owner_id: &T::AccountId) -> u64; + fn certification_by_id(certification_id: &Self::CertificationId) + -> Option; } diff --git a/pallets/certifications/src/lib.rs b/pallets/certifications/src/lib.rs index 2f998410..dd74fc7b 100644 --- a/pallets/certifications/src/lib.rs +++ b/pallets/certifications/src/lib.rs @@ -1,7 +1,9 @@ #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::codec::{Decode, Encode}; -use frame_support::pallet_prelude::*; +use frame_support::{ + codec::{Decode, Encode}, + pallet_prelude::*, +}; pub mod weights; @@ -13,7 +15,7 @@ pub use pallet::*; pub use scale_info::TypeInfo; use traits_certifications::{ - CertificationInfo as CertificationInfoT, CertificationOwner, CertificationsProvider, + CertificationInfo as CertificationInfoT, CertificationOwner, CertificationsProvider, }; pub mod interface; @@ -24,175 +26,176 @@ use sp_std::prelude::*; /// Information that is mutable by user #[derive(Encode, Decode, Clone, Default, RuntimeDebug, PartialEq, Eq, TypeInfo)] pub struct CertificationInfo { - pub title: Vec, - pub issuer: Vec, - pub month: Vec, - pub year: Vec, - pub description: Vec, - pub supporting_document: Option>, + pub title: Vec, + pub issuer: Vec, + pub month: Vec, + pub year: Vec, + pub description: Vec, + pub supporting_document: Option>, } #[derive(Encode, Decode, Clone, Default, RuntimeDebug, PartialEq, Eq, TypeInfo)] pub struct Certification { - pub id: Hash, - pub owner_id: AccountId, - pub info: CertificationInfo, + pub id: Hash, + pub owner_id: AccountId, + pub info: CertificationInfo, } impl Certification { - pub fn new(id: Hash, owner_id: AccountId, info: CertificationInfo) -> Self { - Self { id, owner_id, info } - } + pub fn new(id: Hash, owner_id: AccountId, info: CertificationInfo) -> Self { + Self { id, owner_id, info } + } - pub fn get_id(&self) -> &Hash { - &self.id - } + pub fn get_id(&self) -> &Hash { + &self.id + } - pub fn get_owner_id(&self) -> &AccountId { - &self.owner_id - } + pub fn get_owner_id(&self) -> &AccountId { + &self.owner_id + } } impl CertificationInfoT for Certification where - T: frame_system::Config, + T: frame_system::Config, { - fn get_id(&self) -> &Hash { - self.get_id() - } - fn get_owner_id(&self) -> &AccountId { - self.get_owner_id() - } + fn get_id(&self) -> &Hash { + self.get_id() + } + fn get_owner_id(&self) -> &AccountId { + self.get_owner_id() + } } #[frame_support::pallet] pub mod pallet { - use crate::weights::WeightInfo; - use crate::interface::CertificationInterface; - use crate::{Certification, CertificationInfo, CertificationOwner}; - use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; - use frame_system::pallet_prelude::*; - pub use sp_std::prelude::*; - - #[pallet::config] - pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; - type CertificationOwner: CertificationOwner; - type WeightInfo: WeightInfo; - } - - // ----- This is template code, every pallet needs this --- - #[pallet::pallet] - #[pallet::generate_store(pub(super) trait Store)] - pub struct Pallet(_); - - #[pallet::hooks] - impl Hooks> for Pallet {} - // -------------------------------------------------------- - - // ----- Types ------- - pub type AccountIdOf = ::AccountId; - pub type HashOf = ::Hash; - pub type CertificationOf = Certification, HashOf>; - pub type CertificationInfoOf = CertificationInfo; - pub type CertificationIdOf = HashOf; - - // ------- Storage ------------- - #[pallet::storage] - #[pallet::getter(fn certification_by_id)] - pub type Certifications = StorageMap<_, Blake2_128Concat, HashOf, CertificationOf>; - // _, Hasher , Key , Value - - #[pallet::storage] - #[pallet::getter(fn certifications_count)] - pub type CertificationsCount = StorageValue<_, u64>; - - #[pallet::storage] - #[pallet::getter(fn certification_count_by_owner)] - pub type CertificationsCountByOwner = StorageMap<_, Blake2_128Concat, AccountIdOf, u64>; - // ----------------------------- - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - /// Event documentation should end with an array that provides descriptive names for event - /// parameters, [Certification, who] - CertificationCreated(CertificationOf, AccountIdOf), - //// Certification updated - /// parameters, [Certification, who] - CertificationUpdated(CertificationOf, AccountIdOf), - //// Certification deleted - /// parameters, [Certification, who] - CertificationDeleted(CertificationOf, AccountIdOf), - } - - // Errors inform users that something went wrong. - #[pallet::error] - pub enum Error { - /// User not allowed to create certification - NotAllowedToCreate, - /// User is not the owner of a certification - NotCertificationOwner, - /// Ordering a certification that does not exist - CertificationDoesNotExist, - } - - #[pallet::call] - impl Pallet { - #[pallet::weight(T::WeightInfo::create_certification())] - pub fn create_certification( - origin: OriginFor, - certification_info: CertificationInfoOf, - ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - - match >::create_certification( - &who, - &certification_info, - ) { - Ok(certification) => { - Self::deposit_event(Event::CertificationCreated(certification, who.clone())); - Ok(().into()) - } - Err(error) => Err(error)?, - } - } - - #[pallet::weight(T::WeightInfo::update_certification())] - pub fn update_certification( - origin: OriginFor, - certification_id: HashOf, - certification_info: CertificationInfoOf, - ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - match >::update_certification( - &who, - &certification_id, - &certification_info, - ) { - Ok(certification) => { - Self::deposit_event(Event::CertificationUpdated(certification, who.clone())); - Ok(().into()) - } - Err(error) => Err(error)?, - } - } - - #[pallet::weight(T::WeightInfo::delete_certification())] - pub fn delete_certification( - origin: OriginFor, - certification_id: T::Hash, - ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - match >::delete_certification(&who, &certification_id) - { - Ok(certification) => { - Self::deposit_event(Event::CertificationDeleted(certification, who.clone())); - Ok(().into()) - } - Err(error) => Err(error)?, - } - } - } + use crate::{ + interface::CertificationInterface, weights::WeightInfo, Certification, CertificationInfo, + CertificationOwner, + }; + use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; + use frame_system::pallet_prelude::*; + pub use sp_std::prelude::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type Event: From> + IsType<::Event>; + type CertificationOwner: CertificationOwner; + type WeightInfo: WeightInfo; + } + + // ----- This is template code, every pallet needs this --- + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + #[pallet::hooks] + impl Hooks> for Pallet {} + // -------------------------------------------------------- + + // ----- Types ------- + pub type AccountIdOf = ::AccountId; + pub type HashOf = ::Hash; + pub type CertificationOf = Certification, HashOf>; + pub type CertificationInfoOf = CertificationInfo; + pub type CertificationIdOf = HashOf; + + // ------- Storage ------------- + #[pallet::storage] + #[pallet::getter(fn certification_by_id)] + pub type Certifications = StorageMap<_, Blake2_128Concat, HashOf, CertificationOf>; + // _, Hasher , Key , Value + + #[pallet::storage] + #[pallet::getter(fn certifications_count)] + pub type CertificationsCount = StorageValue<_, u64>; + + #[pallet::storage] + #[pallet::getter(fn certification_count_by_owner)] + pub type CertificationsCountByOwner = StorageMap<_, Blake2_128Concat, AccountIdOf, u64>; + // ----------------------------- + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Event documentation should end with an array that provides descriptive names for event + /// parameters, [Certification, who] + CertificationCreated(CertificationOf, AccountIdOf), + //// Certification updated + /// parameters, [Certification, who] + CertificationUpdated(CertificationOf, AccountIdOf), + //// Certification deleted + /// parameters, [Certification, who] + CertificationDeleted(CertificationOf, AccountIdOf), + } + + // Errors inform users that something went wrong. + #[pallet::error] + pub enum Error { + /// User not allowed to create certification + NotAllowedToCreate, + /// User is not the owner of a certification + NotCertificationOwner, + /// Ordering a certification that does not exist + CertificationDoesNotExist, + } + + #[pallet::call] + impl Pallet { + #[pallet::weight(T::WeightInfo::create_certification())] + pub fn create_certification( + origin: OriginFor, + certification_info: CertificationInfoOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + match >::create_certification( + &who, + &certification_info, + ) { + Ok(certification) => { + Self::deposit_event(Event::CertificationCreated(certification, who.clone())); + Ok(().into()) + }, + Err(error) => Err(error.into()), + } + } + + #[pallet::weight(T::WeightInfo::update_certification())] + pub fn update_certification( + origin: OriginFor, + certification_id: HashOf, + certification_info: CertificationInfoOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + match >::update_certification( + &who, + &certification_id, + &certification_info, + ) { + Ok(certification) => { + Self::deposit_event(Event::CertificationUpdated(certification, who.clone())); + Ok(().into()) + }, + Err(error) => Err(error.into()), + } + } + + #[pallet::weight(T::WeightInfo::delete_certification())] + pub fn delete_certification( + origin: OriginFor, + certification_id: T::Hash, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + match >::delete_certification(&who, &certification_id) + { + Ok(certification) => { + Self::deposit_event(Event::CertificationDeleted(certification, who.clone())); + Ok(().into()) + }, + Err(error) => Err(error.into()), + } + } + } } use frame_support::sp_runtime::traits::Hash; @@ -200,166 +203,160 @@ use traits_certifications::CertificationOwnerInfo; /// Certification Interface Implementation impl CertificationInterface for Pallet { - type Error = Error; - type CertificationId = T::Hash; - type Certification = CertificationOf; - type CertificationInfo = CertificationInfoOf; - - fn generate_certification_id( - owner_id: &T::AccountId, - certification_count: u64, - ) -> Self::CertificationId { - let mut account_id_bytes = owner_id.encode(); - let mut certification_count_bytes = certification_count.encode(); - account_id_bytes.append(&mut certification_count_bytes); - - let seed = &account_id_bytes; - T::Hashing::hash(seed) - } - - /// Create Certification - /// Add reference to CertificationsByCountryCity storage - /// Associate certification reference to the owner (creator) - /// Increment Counts - fn create_certification( - owner_id: &T::AccountId, - certification_info: &Self::CertificationInfo, - ) -> Result { - // Check if user can create_certification - let can_create_certification = T::CertificationOwner::can_create_certification(owner_id); - if !can_create_certification { - return Err(Error::::NotAllowedToCreate)?; - } - - let owner_certification_count = - >::certification_count_by_owner(owner_id); - let certification_id = Self::generate_certification_id(owner_id, owner_certification_count); - - let certification = Certification::new( - certification_id.clone(), - owner_id.clone(), - certification_info.clone(), - ); - // Store to Certifications storage - Certifications::::insert(&certification_id, &certification); - - // Increment Certifications Count - Self::add_certifications_count(); - // Increment CertificationsCountByOwner - Self::add_certification_count_by_owner(&certification.owner_id); - - // Associate created certification to the owner - T::CertificationOwner::associate(owner_id, &certification_id); - - Ok(certification) - } - - /// Update Certification information - fn update_certification( - owner_id: &T::AccountId, - certification_id: &Self::CertificationId, - certification_info: &Self::CertificationInfo, - ) -> Result { - let certification = Certifications::::get(certification_id); - if certification == None { - return Err(Error::::CertificationDoesNotExist)?; - } - let mut certification = certification.unwrap(); - - if certification.owner_id != owner_id.clone() { - return Err(Error::::NotCertificationOwner)?; - } - - certification.info = certification_info.clone(); - Certifications::::insert(certification_id, &certification); - - Ok(certification) - } - - /// Delete Certification - /// Delete from Certifications Storage - /// Remove the certification id reference in CertificationsByCountryCity storage - /// Disassociate certification id from the owner - /// Decrement Counts - fn delete_certification( - owner_id: &T::AccountId, - certification_id: &Self::CertificationId, - ) -> Result { - let certification = Certifications::::get(certification_id); - if certification == None { - return Err(Error::::CertificationDoesNotExist)?; - } - let certification = certification.unwrap(); - - if certification.owner_id != owner_id.clone() { - return Err(Error::::NotCertificationOwner)?; - } - // Remove certification from storage - let certification = Certifications::::take(certification_id).unwrap(); - - let owner = T::CertificationOwner::get_owner(owner_id).unwrap(); - // disassociate certification reference from the owner - T::CertificationOwner::disassociate(owner.get_owner_id(), &certification.id); - // Decrement counts - Self::sub_certifications_count(); - Self::sub_certification_count_by_owner(owner.get_owner_id()); - - Ok(certification) - } - - fn certification_by_id( - certification_id: &Self::CertificationId, - ) -> Option { - match Certifications::::get(certification_id) { - None => None, - Some(certification) => Some(certification), - } - } - - fn certification_count_by_owner(owner_id: &T::AccountId) -> u64 { - Self::certification_count_by_owner(owner_id).unwrap_or(0) - } + type Error = Error; + type CertificationId = T::Hash; + type Certification = CertificationOf; + type CertificationInfo = CertificationInfoOf; + + fn generate_certification_id( + owner_id: &T::AccountId, + certification_count: u64, + ) -> Self::CertificationId { + let mut account_id_bytes = owner_id.encode(); + let mut certification_count_bytes = certification_count.encode(); + account_id_bytes.append(&mut certification_count_bytes); + + let seed = &account_id_bytes; + T::Hashing::hash(seed) + } + + /// Create Certification + /// Add reference to CertificationsByCountryCity storage + /// Associate certification reference to the owner (creator) + /// Increment Counts + fn create_certification( + owner_id: &T::AccountId, + certification_info: &Self::CertificationInfo, + ) -> Result { + // Check if user can create_certification + let can_create_certification = T::CertificationOwner::can_create_certification(owner_id); + if !can_create_certification { + return Err(Error::::NotAllowedToCreate) + } + + let owner_certification_count = + >::certification_count_by_owner(owner_id); + let certification_id = Self::generate_certification_id(owner_id, owner_certification_count); + + let certification = + Certification::new(certification_id, owner_id.clone(), certification_info.clone()); + // Store to Certifications storage + Certifications::::insert(&certification_id, &certification); + + // Increment Certifications Count + Self::add_certifications_count(); + // Increment CertificationsCountByOwner + Self::add_certification_count_by_owner(&certification.owner_id); + + // Associate created certification to the owner + T::CertificationOwner::associate(owner_id, &certification_id); + + Ok(certification) + } + + /// Update Certification information + fn update_certification( + owner_id: &T::AccountId, + certification_id: &Self::CertificationId, + certification_info: &Self::CertificationInfo, + ) -> Result { + let certification = Certifications::::get(certification_id); + if certification == None { + return Err(Error::::CertificationDoesNotExist) + } + let mut certification = certification.unwrap(); + + if certification.owner_id != owner_id.clone() { + return Err(Error::::NotCertificationOwner) + } + + certification.info = certification_info.clone(); + Certifications::::insert(certification_id, &certification); + + Ok(certification) + } + + /// Delete Certification + /// Delete from Certifications Storage + /// Remove the certification id reference in CertificationsByCountryCity storage + /// Disassociate certification id from the owner + /// Decrement Counts + fn delete_certification( + owner_id: &T::AccountId, + certification_id: &Self::CertificationId, + ) -> Result { + let certification = Certifications::::get(certification_id); + if certification == None { + return Err(Error::::CertificationDoesNotExist) + } + let certification = certification.unwrap(); + + if certification.owner_id != owner_id.clone() { + return Err(Error::::NotCertificationOwner) + } + // Remove certification from storage + let certification = Certifications::::take(certification_id).unwrap(); + + let owner = T::CertificationOwner::get_owner(owner_id).unwrap(); + // disassociate certification reference from the owner + T::CertificationOwner::disassociate(owner.get_owner_id(), &certification.id); + // Decrement counts + Self::sub_certifications_count(); + Self::sub_certification_count_by_owner(owner.get_owner_id()); + + Ok(certification) + } + + fn certification_by_id( + certification_id: &Self::CertificationId, + ) -> Option { + Certifications::::get(certification_id) + } + + fn certification_count_by_owner(owner_id: &T::AccountId) -> u64 { + Self::certification_count_by_owner(owner_id).unwrap_or(0) + } } /// Pallet Methods impl Pallet { - // Certifications Count Addition and Substraction Helpers - // Add certifications count - pub fn add_certifications_count() { - let certifications_count = >::get().unwrap_or(0); - >::put(certifications_count.wrapping_add(1)); - } - // Add certifications count by owner - pub fn add_certification_count_by_owner(owner_id: &T::AccountId) { - let certifications_count = CertificationsCountByOwner::::get(owner_id).unwrap_or(0); - CertificationsCountByOwner::::insert(owner_id, certifications_count.wrapping_add(1)) - } - - // Subtract certifications count - pub fn sub_certifications_count() { - let certifications_count = >::get().unwrap_or(1); - CertificationsCount::::put(certifications_count - 1); - } - // Subtract certifications count by owner - pub fn sub_certification_count_by_owner(owner_id: &T::AccountId) { - let certifications_count = CertificationsCountByOwner::::get(owner_id).unwrap_or(1); - CertificationsCountByOwner::::insert(owner_id, certifications_count - 1); - } + // Certifications Count Addition and Substraction Helpers + // Add certifications count + pub fn add_certifications_count() { + let certifications_count = >::get().unwrap_or(0); + >::put(certifications_count.wrapping_add(1)); + } + // Add certifications count by owner + pub fn add_certification_count_by_owner(owner_id: &T::AccountId) { + let certifications_count = CertificationsCountByOwner::::get(owner_id).unwrap_or(0); + CertificationsCountByOwner::::insert(owner_id, certifications_count.wrapping_add(1)) + } + + // Subtract certifications count + pub fn sub_certifications_count() { + let certifications_count = >::get().unwrap_or(1); + CertificationsCount::::put(certifications_count - 1); + } + // Subtract certifications count by owner + pub fn sub_certification_count_by_owner(owner_id: &T::AccountId) { + let certifications_count = CertificationsCountByOwner::::get(owner_id).unwrap_or(1); + CertificationsCountByOwner::::insert(owner_id, certifications_count - 1); + } } /// CertificationsProvider Trait Implementation impl CertificationsProvider for Pallet { - type Error = Error; - type Certification = CertificationOf; - - fn certification_by_id(id: &T::Hash) -> Option> { - >::certification_by_id(id) - } - - fn delete_certification( - owner_id: &T::AccountId, - id: &T::Hash, - ) -> Result { - >::delete_certification(owner_id, id) - } + type Error = Error; + type Certification = CertificationOf; + + fn certification_by_id(id: &T::Hash) -> Option> { + >::certification_by_id(id) + } + + fn delete_certification( + owner_id: &T::AccountId, + id: &T::Hash, + ) -> Result { + >::delete_certification(owner_id, id) + } } diff --git a/pallets/certifications/src/weights.rs b/pallets/certifications/src/weights.rs index 1c7fb07e..69633508 100644 --- a/pallets/certifications/src/weights.rs +++ b/pallets/certifications/src/weights.rs @@ -1,4 +1,3 @@ - //! Autogenerated weights for certifications //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 @@ -26,11 +25,13 @@ // --output // ./runtime/src/weights - #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{ + traits::Get, + weights::{constants::RocksDbWeight, Weight}, +}; use sp_std::marker::PhantomData; /// Weight functions needed for certifications. @@ -44,37 +45,37 @@ pub trait WeightInfo { pub struct DeBioWeight(PhantomData); impl WeightInfo for DeBioWeight { fn create_certification() -> Weight { - (74_749_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + 74_749_000_u64 + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn update_certification() -> Weight { - (80_144_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + 80_144_000_u64 + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn delete_certification() -> Weight { - (155_487_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + 155_487_000_u64 + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } } // For backwards compatibility and tests impl WeightInfo for () { fn create_certification() -> Weight { - (74_749_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(3 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + 74_749_000_u64 + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } fn update_certification() -> Weight { - (80_144_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + 80_144_000_u64 + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn delete_certification() -> Weight { - (155_487_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + 155_487_000_u64 + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } }