diff --git a/Cargo.lock b/Cargo.lock index 47aee8f69532d2b4ac1d7326d52de6025540f610..6e2559994c044b30c296cf7be4df1ce2808e242a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5844,6 +5844,7 @@ dependencies = [ name = "pallet-distance" version = "1.0.0" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "pallet-authority-members", diff --git a/pallets/distance/Cargo.toml b/pallets/distance/Cargo.toml index 1a08c2f2fd428782d39aee506f315629a47494d2..b1910ffba55fb1d69ad8907e3cb9f6b577a7a3ce 100644 --- a/pallets/distance/Cargo.toml +++ b/pallets/distance/Cargo.toml @@ -11,9 +11,11 @@ version = '1.0.0' [features] default = ['std'] +runtime-benchmarks = ['frame-benchmarking/runtime-benchmarks'] std = [ 'codec/std', 'frame-support/std', + 'frame-benchmarking/std', 'pallet-authority-members/std', 'pallet-authorship/std', 'pallet-identity/std', @@ -37,6 +39,12 @@ scale-info = { version = "2.1.1", default-features = false, features = [ "derive", ] } +[dependencies.frame-benchmarking] +default-features = false +git = 'https://github.com/duniter/substrate' +optional = true +branch = 'duniter-substrate-v0.9.42' + [dependencies.codec] default-features = false features = ['derive'] diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index 92ed6acc00b1444f63491dab40d48d4d24d52244..2fc58a3723131bf18ca84d824f0bf38ff89d8479 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -21,10 +21,13 @@ mod traits; mod types; mod weights; +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + pub use pallet::*; pub use traits::*; pub use types::*; -// pub use weights::WeightInfo; +pub use weights::WeightInfo; use frame_support::traits::StorageVersion; use pallet_authority_members::SessionIndex; diff --git a/pallets/distance/src/weights.rs b/pallets/distance/src/weights.rs index 8b137891791fe96927ad78e64b0aad7bded08bdc..9177a415a561b1b89f234f590a01bc6a37a6f9ae 100644 --- a/pallets/distance/src/weights.rs +++ b/pallets/distance/src/weights.rs @@ -1 +1,27 @@ +// Copyright 2021-2023 Axiom-Team +// +// This file is part of Duniter-v2S. +// +// Duniter-v2S is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, version 3 of the License. +// +// Duniter-v2S is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. +#![allow(clippy::unnecessary_cast)] + +use frame_support::weights::Weight; + +/// Weight functions needed for pallet_universal_dividend. +pub trait WeightInfo { + fn request_distance_evaluation() -> Weight; + fn update_evaluation() -> Weight; + fn force_update_evaluation() -> Weight; + fn force_set_distance_status() -> Weight; +}