mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 05:31:02 +00:00
Recovery Pallet benchmarking (#11176)
* Created benchmarks * Added recovery benchmarks * benchmark for `create_recovery` * benchmark for `initiate_recovery` * benchmark for `vouch_recovery` * benchmark for `claim_recovery` * benchmark for `close_recovery` * benchmark for `remove_recovery` * benchmark for `cancel_recovered` * benchmark for `as_recovered` * Some refactoring * Some refactoring * Fix create_recovery benchmark * fix close_recovery benchmark test * fixed issues with failing tests * Update frame/recovery/src/benchmarking.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * removed repetitive code * create weights file * Used weights to annotate extrinsics * Added WeightInfo implementation to mock * Beauty fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/recovery/src/benchmarking.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/recovery/src/benchmarking.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Set vec to be mut * set delay_period to use non-zero amount * set delay default * Add weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Autogenerated weights for pallet_recovery
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-04-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/production/substrate
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet-recovery
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --output=./frame/recovery/src/weights.rs
|
||||
// --template=.maintain/frame-weight-template.hbs
|
||||
// --header=HEADER-APACHE2
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for pallet_recovery.
|
||||
pub trait WeightInfo {
|
||||
fn as_recovered() -> Weight;
|
||||
fn set_recovered() -> Weight;
|
||||
fn create_recovery(n: u32, ) -> Weight;
|
||||
fn initiate_recovery() -> Weight;
|
||||
fn vouch_recovery(n: u32, ) -> Weight;
|
||||
fn claim_recovery(n: u32, ) -> Weight;
|
||||
fn close_recovery(n: u32, ) -> Weight;
|
||||
fn remove_recovery(n: u32, ) -> Weight;
|
||||
fn cancel_recovered() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for pallet_recovery using the Substrate node and recommended hardware.
|
||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Recovery Proxy (r:1 w:0)
|
||||
fn as_recovered() -> Weight {
|
||||
(3_667_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Proxy (r:0 w:1)
|
||||
fn set_recovered() -> Weight {
|
||||
(10_149_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:1)
|
||||
fn create_recovery(n: u32, ) -> Weight {
|
||||
(23_154_000 as Weight)
|
||||
// Standard Error: 16_000
|
||||
.saturating_add((235_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
fn initiate_recovery() -> Weight {
|
||||
(28_857_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
fn vouch_recovery(n: u32, ) -> Weight {
|
||||
(17_841_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((349_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:0)
|
||||
// Storage: Recovery Proxy (r:1 w:1)
|
||||
fn claim_recovery(n: u32, ) -> Weight {
|
||||
(24_927_000 as Weight)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((222_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn close_recovery(n: u32, ) -> Weight {
|
||||
(28_201_000 as Weight)
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((272_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:0)
|
||||
// Storage: Recovery Recoverable (r:1 w:1)
|
||||
fn remove_recovery(n: u32, ) -> Weight {
|
||||
(27_531_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((218_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Proxy (r:1 w:1)
|
||||
fn cancel_recovered() -> Weight {
|
||||
(9_015_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests
|
||||
impl WeightInfo for () {
|
||||
// Storage: Recovery Proxy (r:1 w:0)
|
||||
fn as_recovered() -> Weight {
|
||||
(3_667_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Proxy (r:0 w:1)
|
||||
fn set_recovered() -> Weight {
|
||||
(10_149_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:1)
|
||||
fn create_recovery(n: u32, ) -> Weight {
|
||||
(23_154_000 as Weight)
|
||||
// Standard Error: 16_000
|
||||
.saturating_add((235_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
fn initiate_recovery() -> Weight {
|
||||
(28_857_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
fn vouch_recovery(n: u32, ) -> Weight {
|
||||
(17_841_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((349_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Recoverable (r:1 w:0)
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:0)
|
||||
// Storage: Recovery Proxy (r:1 w:1)
|
||||
fn claim_recovery(n: u32, ) -> Weight {
|
||||
(24_927_000 as Weight)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((222_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn close_recovery(n: u32, ) -> Weight {
|
||||
(28_201_000 as Weight)
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((272_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Recovery ActiveRecoveries (r:1 w:0)
|
||||
// Storage: Recovery Recoverable (r:1 w:1)
|
||||
fn remove_recovery(n: u32, ) -> Weight {
|
||||
(27_531_000 as Weight)
|
||||
// Standard Error: 10_000
|
||||
.saturating_add((218_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Recovery Proxy (r:1 w:1)
|
||||
fn cancel_recovered() -> Weight {
|
||||
(9_015_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user