pallet_validator_collators/weights.rs
1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Default weights for `pallet_validator_collators`.
17//!
18//! Runtimes should use their own benchmarked weights.
19
20#![allow(unused_parens)]
21#![allow(unused_imports)]
22
23use core::marker::PhantomData;
24use frame_support::{
25 traits::Get,
26 weights::{constants::RocksDbWeight, Weight},
27};
28
29/// Weight functions needed for `pallet_validator_collators`.
30pub trait WeightInfo {
31 fn set_validators(n: u32) -> Weight;
32 fn set_max_collators() -> Weight;
33}
34
35/// Default weights for `pallet_validator_collators`, see the module doc for their source.
36pub struct SubstrateWeight<T>(PhantomData<T>);
37impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
38 /// Storage: `ValidatorCollators::ValidatorSet` (r:1 w:1)
39 /// Proof: `ValidatorCollators::ValidatorSet` (`max_values`: Some(1), `max_size`: Some(32006),
40 /// added: 32501, mode: `MaxEncodedLen`)
41 /// Storage: `ValidatorCollators::PendingRotation` (r:0 w:1)
42 /// Proof: `ValidatorCollators::PendingRotation` (`max_values`: Some(1), `max_size`: Some(1),
43 /// added: 496, mode: `MaxEncodedLen`)
44 /// The range of component `n` is `[1, 1000]`.
45 fn set_validators(n: u32) -> Weight {
46 Weight::from_parts(21_223_720, 33_491)
47 .saturating_add(Weight::from_parts(134_848, 0).saturating_mul(n.into()))
48 .saturating_add(T::DbWeight::get().reads(1_u64))
49 .saturating_add(T::DbWeight::get().writes(2_u64))
50 }
51 /// Storage: `ValidatorCollators::MaxCollators` (r:0 w:1)
52 /// Proof: `ValidatorCollators::MaxCollators` (`max_values`: Some(1), `max_size`: Some(4),
53 /// added: 499, mode: `MaxEncodedLen`)
54 fn set_max_collators() -> Weight {
55 Weight::from_parts(5_786_000, 0).saturating_add(T::DbWeight::get().writes(1_u64))
56 }
57}
58
59// For backwards compatibility and tests.
60impl WeightInfo for () {
61 /// Storage: `ValidatorCollators::ValidatorSet` (r:1 w:1)
62 /// Proof: `ValidatorCollators::ValidatorSet` (`max_values`: Some(1), `max_size`: Some(32006),
63 /// added: 32501, mode: `MaxEncodedLen`)
64 /// Storage: `ValidatorCollators::PendingRotation` (r:0 w:1)
65 /// Proof: `ValidatorCollators::PendingRotation` (`max_values`: Some(1), `max_size`: Some(1),
66 /// added: 496, mode: `MaxEncodedLen`)
67 /// The range of component `n` is `[1, 1000]`.
68 fn set_validators(n: u32) -> Weight {
69 Weight::from_parts(21_223_720, 33_491)
70 .saturating_add(Weight::from_parts(134_848, 0).saturating_mul(n.into()))
71 .saturating_add(RocksDbWeight::get().reads(1_u64))
72 .saturating_add(RocksDbWeight::get().writes(2_u64))
73 }
74 /// Storage: `ValidatorCollators::MaxCollators` (r:0 w:1)
75 /// Proof: `ValidatorCollators::MaxCollators` (`max_values`: Some(1), `max_size`: Some(4),
76 /// added: 499, mode: `MaxEncodedLen`)
77 fn set_max_collators() -> Weight {
78 Weight::from_parts(5_786_000, 0).saturating_add(RocksDbWeight::get().writes(1_u64))
79 }
80}