1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>
16

            
17

            
18
//! Autogenerated weights for pallet_external_validator_slashes
19
//!
20
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0
21
//! DATE: 2024-10-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
22
//! WORST CASE MAP SIZE: `1000000`
23
//! HOSTNAME: `girazoki-XPS-15-9530`, CPU: `13th Gen Intel(R) Core(TM) i9-13900H`
24
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
25

            
26
// Executed Command:
27
// target/release/tanssi-relay
28
// benchmark
29
// pallet
30
// --execution=wasm
31
// --wasm-execution=compiled
32
// --pallet
33
// pallet_external_validator_slashes
34
// --extrinsic
35
// *
36
// --chain=dev
37
// --steps
38
// 50
39
// --repeat
40
// 20
41
// --template=./benchmarking/frame-weight-pallet-template.hbs
42
// --json-file
43
// raw.json
44
// --output
45
// tmp/pallet_external_validator_slashes.rs
46

            
47
#![cfg_attr(rustfmt, rustfmt_skip)]
48
#![allow(unused_parens)]
49
#![allow(unused_imports)]
50

            
51
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
52
use sp_std::marker::PhantomData;
53

            
54
/// Weight functions needed for pallet_external_validator_slashes.
55
pub trait WeightInfo {
56
	fn cancel_deferred_slash(s: u32, ) -> Weight;
57
	fn force_inject_slash() -> Weight;
58
	fn root_test_send_msg_to_eth() -> Weight;
59
	fn process_slashes_queue(s: u32, ) -> Weight;
60
	fn set_slashing_mode() -> Weight;
61
}
62

            
63
/// Weights for pallet_external_validator_slashes using the Substrate node and recommended hardware.
64
pub struct SubstrateWeight<T>(PhantomData<T>);
65
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
66
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
67
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
68
	/// Storage: `ExternalValidatorSlashes::Slashes` (r:1 w:1)
69
	/// Proof: `ExternalValidatorSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
70
	/// The range of component `s` is `[1, 1000]`.
71
	fn cancel_deferred_slash(s: u32, ) -> Weight {
72
		// Proof Size summary in bytes:
73
		//  Measured:  `42194`
74
		//  Estimated: `45659`
75
		// Minimum execution time: 69_654_000 picoseconds.
76
		Weight::from_parts(430_467_141, 45659)
77
			// Standard Error: 25_862
78
			.saturating_add(Weight::from_parts(2_233_402, 0).saturating_mul(s.into()))
79
			.saturating_add(T::DbWeight::get().reads(2_u64))
80
			.saturating_add(T::DbWeight::get().writes(1_u64))
81
	}
82
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
83
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
84
	/// Storage: `ExternalValidatorSlashes::NextSlashId` (r:1 w:1)
85
	/// Proof: `ExternalValidatorSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
86
	/// Storage: `ExternalValidatorSlashes::Slashes` (r:1 w:1)
87
	/// Proof: `ExternalValidatorSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
88
	fn force_inject_slash() -> Weight {
89
		// Proof Size summary in bytes:
90
		//  Measured:  `151`
91
		//  Estimated: `3616`
92
		// Minimum execution time: 7_086_000 picoseconds.
93
		Weight::from_parts(7_402_000, 3616)
94
			.saturating_add(T::DbWeight::get().reads(3_u64))
95
			.saturating_add(T::DbWeight::get().writes(2_u64))
96
	}
97

            
98
	fn root_test_send_msg_to_eth() -> Weight {
99
		// Proof Size summary in bytes:
100
		//  Measured:  `322`
101
		//  Estimated: `3601`
102
		// Minimum execution time: 994_654_000 picoseconds.
103
		Weight::from_parts(1_015_195_000, 3601)
104
			.saturating_add(T::DbWeight::get().reads(3_u64))
105
			.saturating_add(T::DbWeight::get().writes(5_u64))
106
	}
107
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
108
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
109
	/// Storage: `ExternalValidatorSlashes::UnreportedSlashesQueue` (r:1 w:1)
110
	/// Proof: `ExternalValidatorSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
111
	/// Storage: `Timestamp::Now` (r:1 w:0)
112
	/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
113
	/// Storage: `EthereumSystem::Channels` (r:1 w:0)
114
	/// Proof: `EthereumSystem::Channels` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`)
115
	/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
116
	/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`)
117
	/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
118
	/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
119
	/// Storage: UNKNOWN KEY `0x3a72656c61795f64697370617463685f71756575655f72656d61696e696e675f` (r:0 w:1)
120
	/// Proof: UNKNOWN KEY `0x3a72656c61795f64697370617463685f71756575655f72656d61696e696e675f` (r:0 w:1)
121
	/// Storage: `MessageQueue::Pages` (r:0 w:1)
122
	/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`)
123
	/// Storage: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
124
	/// Proof: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
125
	/// The range of component `s` is `[1, 200]`.
126
	fn process_slashes_queue(s: u32, ) -> Weight {
127
		// Proof Size summary in bytes:
128
		//  Measured:  `393 + s * (42 ±0)`
129
		//  Estimated: `3601 + s * (42 ±0)`
130
		// Minimum execution time: 46_622_000 picoseconds.
131
		Weight::from_parts(72_326_163, 3601)
132
			// Standard Error: 58_929
133
			.saturating_add(Weight::from_parts(2_894_084, 0).saturating_mul(s.into()))
134
			.saturating_add(T::DbWeight::get().reads(4_u64))
135
			.saturating_add(T::DbWeight::get().writes(2_u64))
136
			.saturating_add(Weight::from_parts(0, 42).saturating_mul(s.into()))
137
	}
138

            
139
	fn set_slashing_mode() -> Weight {
140
		Weight::from_parts(7_402_000, 3601)
141
			.saturating_add(T::DbWeight::get().reads(1_u64))
142
			.saturating_add(T::DbWeight::get().writes(1_u64))
143
	}
144

            
145
}
146

            
147
// For backwards compatibility and tests
148
impl WeightInfo for () {
149
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
150
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
151
	/// Storage: `ExternalValidatorSlashes::Slashes` (r:1 w:1)
152
	/// Proof: `ExternalValidatorSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
153
	/// The range of component `s` is `[1, 1000]`.
154
	fn cancel_deferred_slash(s: u32, ) -> Weight {
155
		// Proof Size summary in bytes:
156
		//  Measured:  `42194`
157
		//  Estimated: `45659`
158
		// Minimum execution time: 69_654_000 picoseconds.
159
		Weight::from_parts(430_467_141, 45659)
160
			// Standard Error: 25_862
161
			.saturating_add(Weight::from_parts(2_233_402, 0).saturating_mul(s.into()))
162
			.saturating_add(RocksDbWeight::get().reads(2_u64))
163
			.saturating_add(RocksDbWeight::get().writes(1_u64))
164
	}
165
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
166
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
167
	/// Storage: `ExternalValidatorSlashes::NextSlashId` (r:1 w:1)
168
	/// Proof: `ExternalValidatorSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
169
	/// Storage: `ExternalValidatorSlashes::Slashes` (r:1 w:1)
170
	/// Proof: `ExternalValidatorSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
171
	fn force_inject_slash() -> Weight {
172
		// Proof Size summary in bytes:
173
		//  Measured:  `151`
174
		//  Estimated: `3616`
175
		// Minimum execution time: 7_086_000 picoseconds.
176
		Weight::from_parts(7_402_000, 3616)
177
			.saturating_add(RocksDbWeight::get().reads(3_u64))
178
			.saturating_add(RocksDbWeight::get().writes(2_u64))
179
	}
180

            
181
	fn root_test_send_msg_to_eth() -> Weight {
182
		// Proof Size summary in bytes:
183
		//  Measured:  `322`
184
		//  Estimated: `3601`
185
		// Minimum execution time: 994_654_000 picoseconds.
186
		Weight::from_parts(1_015_195_000, 3601)
187
			.saturating_add(RocksDbWeight::get().reads(3_u64))
188
			.saturating_add(RocksDbWeight::get().writes(5_u64))
189
	}
190

            
191

            
192
	/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
193
	/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
194
	/// Storage: `ExternalValidatorSlashes::UnreportedSlashesQueue` (r:1 w:1)
195
	/// Proof: `ExternalValidatorSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
196
	/// Storage: `Timestamp::Now` (r:1 w:0)
197
	/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
198
	/// Storage: `EthereumSystem::Channels` (r:1 w:0)
199
	/// Proof: `EthereumSystem::Channels` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`)
200
	/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
201
	/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`)
202
	/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
203
	/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
204
	/// Storage: UNKNOWN KEY `0x3a72656c61795f64697370617463685f71756575655f72656d61696e696e675f` (r:0 w:1)
205
	/// Proof: UNKNOWN KEY `0x3a72656c61795f64697370617463685f71756575655f72656d61696e696e675f` (r:0 w:1)
206
	/// Storage: `MessageQueue::Pages` (r:0 w:1)
207
	/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`)
208
	/// Storage: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
209
	/// Proof: UNKNOWN KEY `0xf5207f03cfdce586301014700e2c2593fad157e461d71fd4c1f936839a5f1f3e` (r:0 w:1)
210
	/// The range of component `s` is `[1, 200]`.
211
7
	fn process_slashes_queue(s: u32, ) -> Weight {
212
7
		// Proof Size summary in bytes:
213
7
		//  Measured:  `393 + s * (42 ±0)`
214
7
		//  Estimated: `3601 + s * (42 ±0)`
215
7
		// Minimum execution time: 46_622_000 picoseconds.
216
7
		Weight::from_parts(72_326_163, 3601)
217
7
			// Standard Error: 58_929
218
7
			.saturating_add(Weight::from_parts(2_894_084, 0).saturating_mul(s.into()))
219
7
			.saturating_add(RocksDbWeight::get().reads(4_u64))
220
7
			.saturating_add(RocksDbWeight::get().writes(2_u64))
221
7
			.saturating_add(Weight::from_parts(0, 42).saturating_mul(s.into()))
222
7
	}
223

            
224
	fn set_slashing_mode() -> Weight {
225
		Weight::from_parts(7_402_000, 3601)
226
			.saturating_add(RocksDbWeight::get().reads(1_u64))
227
			.saturating_add(RocksDbWeight::get().writes(1_u64))
228
	}
229
}