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
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
18
//! DATE: 2024-04-27 (Y/M/D)
19
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
20
//!
21
//! DATABASE: `RocksDb`, RUNTIME: `Moonbeam`
22
//! BLOCK-NUM: `BlockId::Number(5962022)`
23
//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
24
//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: ``
25
//! WEIGHT-PATH: `/home/ubuntu/projects/moonbeam/weights-rocksdb-moonbeam.rs`
26
//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`
27

            
28
// Executed Command:
29
//   /home/ubuntu/projects/moonbeam/target/release/moonbeam
30
//   benchmark
31
//   storage
32
//   --db=rocksdb
33
//   --state-version=0
34
//   --mul=1.1
35
//   --weight-path
36
//   /home/ubuntu/projects/moonbeam/weights-rocksdb-moonbeam.rs
37
//   --chain
38
//   moonbeam
39
//   --base-path
40
//   /var/lib/rocksdb-moonbeam-data
41
//   --keys-limit
42
//   10000000
43
//   --random-seed
44
//   1024
45

            
46
/// Storage DB weights for the `Moonbeam` runtime and `RocksDb`.
47
pub mod constants {
48
	use frame_support::weights::{constants, RuntimeDbWeight};
49
	use sp_core::parameter_types;
50

            
51
	parameter_types! {
52
		/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
53
		/// the runtime.
54
		pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
55
			// Time to read one storage item.
56
			// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
57
			//
58
			// Stats nanoseconds:
59
			//   Min, Max: 2_300, 2_841_169
60
			//   Average:  37_947
61
			//   Median:   38_669
62
			//   Std-Dev:  7331.86
63
			//
64
			// Percentiles nanoseconds:
65
			//   99th: 55_974
66
			//   95th: 49_824
67
			//   75th: 42_570
68
			read: 41_742 * constants::WEIGHT_REF_TIME_PER_NANOS,
69

            
70
			// Time to write one storage item.
71
			// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
72
			//
73
			// Stats nanoseconds:
74
			//   Min, Max: 18_981, 16_772_373
75
			//   Average:  73_893
76
			//   Median:   72_807
77
			//   Std-Dev:  24543.58
78
			//
79
			// Percentiles nanoseconds:
80
			//   99th: 97_152
81
			//   95th: 85_751
82
			//   75th: 77_392
83
			write: 81_283 * constants::WEIGHT_REF_TIME_PER_NANOS,
84
		};
85
	}
86

            
87
	#[cfg(test)]
88
	mod test_db_weights {
89
		use super::constants::RocksDbWeight as W;
90
		use frame_support::weights::constants;
91

            
92
		/// Checks that all weights exist and have sane values.
93
		// NOTE: If this test fails but you are sure that the generated values are fine,
94
		// you can delete it.
95
		#[test]
96
1
		fn bound() {
97
1
			// At least 1 µs.
98
1
			assert!(
99
1
				W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
100
				"Read weight should be at least 1 µs."
101
			);
102
1
			assert!(
103
1
				W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
104
				"Write weight should be at least 1 µs."
105
			);
106
			// At most 1 ms.
107
1
			assert!(
108
1
				W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
109
				"Read weight should be at most 1 ms."
110
			);
111
1
			assert!(
112
1
				W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
113
				"Write weight should be at most 1 ms."
114
			);
115
1
		}
116
	}
117
}