moonbeam_runtime/weights/db/
rocksdb.rs

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 48.0.0
18//! DATE: 2025-09-22 (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(12630729)`
23//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
24//! STATE-VERSION: `V1`, STATE-CACHE-SIZE: ``
25//! WEIGHT-PATH: `./benchmarks/storage/20250922-082315/disk-weights-rocksdb-moonbeam.rs`
26//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`
27
28// Executed Command:
29//   ./moonbeam
30//   benchmark
31//   storage
32//   --db=rocksdb
33//   --state-version=1
34//   --mul=1.1
35//   --weight-path
36//   ./benchmarks/storage/20250922-082315/disk-weights-rocksdb-moonbeam.rs
37//   --chain
38//   moonbeam
39//   --base-path
40//   /mnt/disk3-6000-256/rocksdb-moonbeam-data
41//   --keys-limit
42//   50000000
43//   --random-seed
44//   1024
45
46/// Storage DB weights for the `Moonbeam` runtime and `RocksDb`.
47pub mod constants {
48	use frame_support::weights::constants;
49	use sp_core::parameter_types;
50	use sp_weights::RuntimeDbWeight;
51
52	parameter_types! {
53		/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
54		/// the runtime.
55		pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
56			// Time to read one storage item.
57			// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
58			//
59			// Stats nanoseconds:
60			//   Min, Max: 1_774, 4_131_758
61			//   Average:  53_833
62			//   Median:   47_991
63			//   Std-Dev:  44586.1
64			//
65			// Percentiles nanoseconds:
66			//   99th: 236_090
67			//   95th: 67_897
68			//   75th: 54_501
69			read: 59_217 * constants::WEIGHT_REF_TIME_PER_NANOS,
70
71			// Time to write one storage item.
72			// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
73			//
74			// Stats nanoseconds:
75			//   Min, Max: 10_807, 13_782_646
76			//   Average:  87_559
77			//   Median:   73_293
78			//   Std-Dev:  191482.81
79			//
80			// Percentiles nanoseconds:
81			//   99th: 212_681
82			//   95th: 111_877
83			//   75th: 82_079
84			write: 96_315 * constants::WEIGHT_REF_TIME_PER_NANOS,
85		};
86	}
87
88	#[cfg(test)]
89	mod test_db_weights {
90		use super::constants::RocksDbWeight as W;
91		use sp_weights::constants;
92
93		/// Checks that all weights exist and have sane values.
94		// NOTE: If this test fails but you are sure that the generated values are fine,
95		// you can delete it.
96		#[test]
97		fn bound() {
98			// At least 1 µs.
99			assert!(
100				W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
101				"Read weight should be at least 1 µs."
102			);
103			assert!(
104				W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
105				"Write weight should be at least 1 µs."
106			);
107			// At most 1 ms.
108			assert!(
109				W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
110				"Read weight should be at most 1 ms."
111			);
112			assert!(
113				W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
114				"Write weight should be at most 1 ms."
115			);
116		}
117	}
118}