1
// Copyright 2024 Moonbeam foundation
2
// This file is part of Moonbeam.
3

            
4
// Moonbeam 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
// Moonbeam 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 Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
#![cfg_attr(rustfmt, rustfmt_skip)]
18
#![allow(unused_parens)]
19
#![allow(unused_imports)]
20

            
21
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
22
use sp_std::marker::PhantomData;
23

            
24
/// Weight functions needed for pallet_moonbeam_lazy_migrations.
25
pub trait WeightInfo {
26
	fn clear_suicided_storage(a: u32, l: u32, ) -> Weight;
27
}
28

            
29
/// Weights for pallet_moonbeam_lazy_migrations using the Substrate node and recommended hardware.
30
pub struct SubstrateWeight<T>(PhantomData<T>);
31
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
32
	/// Storage: `EVM::AccountCodes` (r:1000 w:0)
33
	/// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`)
34
	/// Storage: `EVM::AccountStorages` (r:33000 w:32000)
35
	/// Proof: `EVM::AccountStorages` (`max_values`: None, `max_size`: None, mode: `Measured`)
36
	/// The range of component `a` is `[0, 1000]`.
37
	/// The range of component `l` is `[0, 32500]`.
38
	fn clear_suicided_storage(a: u32, l: u32, ) -> Weight {
39
		// Proof Size summary in bytes:
40
		//  Measured:  `0 + a * (2 ±0) + l * (87 ±0)`
41
		//  Estimated: `7953 + a * (2352 ±14) + l * (2564 ±0)`
42
		// Minimum execution time: 1_850_000 picoseconds.
43
		Weight::from_parts(1_900_000, 7953)
44
			// Standard Error: 1_276_197
45
			.saturating_add(Weight::from_parts(18_091_220, 0).saturating_mul(a.into()))
46
			// Standard Error: 39_260
47
			.saturating_add(Weight::from_parts(5_558_165, 0).saturating_mul(l.into()))
48
			.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into())))
49
			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(l.into())))
50
			.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(l.into())))
51
			.saturating_add(Weight::from_parts(0, 2352).saturating_mul(a.into()))
52
			.saturating_add(Weight::from_parts(0, 2564).saturating_mul(l.into()))
53
	}
54
}
55

            
56
// For backwards compatibility and tests
57
impl WeightInfo for () {
58
	/// Storage: `EVM::AccountCodes` (r:1000 w:0)
59
	/// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`)
60
	/// Storage: `EVM::AccountStorages` (r:33000 w:32000)
61
	/// Proof: `EVM::AccountStorages` (`max_values`: None, `max_size`: None, mode: `Measured`)
62
	/// The range of component `a` is `[0, 1000]`.
63
	/// The range of component `l` is `[0, 32500]`.
64
	fn clear_suicided_storage(a: u32, l: u32, ) -> Weight {
65
		// Proof Size summary in bytes:
66
		//  Measured:  `0 + a * (2 ±0) + l * (87 ±0)`
67
		//  Estimated: `7953 + a * (2352 ±14) + l * (2564 ±0)`
68
		// Minimum execution time: 1_850_000 picoseconds.
69
		Weight::from_parts(1_900_000, 7953)
70
			// Standard Error: 1_276_197
71
			.saturating_add(Weight::from_parts(18_091_220, 0).saturating_mul(a.into()))
72
			// Standard Error: 39_260
73
			.saturating_add(Weight::from_parts(5_558_165, 0).saturating_mul(l.into()))
74
			.saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(a.into())))
75
			.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(l.into())))
76
			.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(l.into())))
77
			.saturating_add(Weight::from_parts(0, 2352).saturating_mul(a.into()))
78
			.saturating_add(Weight::from_parts(0, 2564).saturating_mul(l.into()))
79
	}
80
}