From cee7c3b2763ba402e807f126534d9cd39a8bd025 Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Sun, 12 Jun 2022 23:37:32 +0200 Subject: [PATCH] feat(runtimes): use our benchmarks for pallet universal dividend --- Cargo.lock | 1 + runtime/common/Cargo.toml | 2 + runtime/common/src/pallets_config.rs | 1 + runtime/common/src/weights.rs | 1 + .../src/weights/pallet_universal_dividend.rs | 68 +++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 runtime/common/src/weights/pallet_universal_dividend.rs diff --git a/Cargo.lock b/Cargo.lock index 1d0fca3fa..8065b66be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -873,6 +873,7 @@ dependencies = [ "pallet-session", "pallet-treasury", "pallet-ud-accounts-storage", + "pallet-universal-dividend", "parity-scale-codec", "scale-info", "serde", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 2c96efe3f..703657399 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -39,6 +39,7 @@ std = [ 'pallet-membership/std', 'pallet-provide-randomness/std', 'pallet-treasury/std', + 'pallet-universal-dividend/std', 'pallet-ud-accounts-storage/std', "serde/std", "serde_derive", @@ -65,6 +66,7 @@ pallet-identity = { path = '../../pallets/identity', default-features = false } pallet-membership = { path = '../../pallets/membership', default-features = false } pallet-provide-randomness = { path = '../../pallets/provide-randomness', default-features = false } pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false } +pallet-universal-dividend = { path = '../../pallets/universal-dividend', default-features = false } sp-membership = { path = '../../primitives/membership', default-features = false } # Crates.io diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 734ecb9a3..b1e618f52 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -385,6 +385,7 @@ macro_rules! pallets_config { type UdCreationPeriod = UdCreationPeriod; type UdReevalPeriod = UdReevalPeriod; type UnitsPerUd = frame_support::traits::ConstU64<1_000>; + type WeightInfo = common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>; } impl pallet_ud_accounts_storage::Config for Runtime {} diff --git a/runtime/common/src/weights.rs b/runtime/common/src/weights.rs index 67dca2777..09779a432 100644 --- a/runtime/common/src/weights.rs +++ b/runtime/common/src/weights.rs @@ -18,3 +18,4 @@ pub mod frame_system; pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_grandpa; +pub mod pallet_universal_dividend; diff --git a/runtime/common/src/weights/pallet_universal_dividend.rs b/runtime/common/src/weights/pallet_universal_dividend.rs new file mode 100644 index 000000000..570bf073c --- /dev/null +++ b/runtime/common/src/weights/pallet_universal_dividend.rs @@ -0,0 +1,68 @@ +// Copyright 2021-2022 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/>. + +//! Autogenerated weights for `pallet_universal_dividend` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-06-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Interpreted, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ./duniter +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_universal_dividend +// --extrinsic=* +// --execution=wasm +// --wasm-execution=interpreted-i-know-what-i-do +// --heap-pages=4096 +// --header=./file_header.txt +// --output=. + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_universal_dividend`. +pub struct WeightInfo<T>(PhantomData<T>); +impl<T: frame_system::Config> pallet_universal_dividend::WeightInfo for WeightInfo<T> { + // Storage: Parameters ParametersStorage (r:1 w:0) + fn on_initialize() -> Weight { + (104_055_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: UniversalDividend CurrentUd (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Account PendingNewAccounts (r:0 w:1) + fn transfer_ud() -> Weight { + (2_468_842_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: UniversalDividend CurrentUd (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Account PendingNewAccounts (r:0 w:1) + fn transfer_ud_keep_alive() -> Weight { + (1_442_150_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} -- GitLab