referrerpolicy=no-referrer-when-downgrade

asset_hub_westend_runtime/weights/
inmemorydb_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//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
17//! DATE: 2025-05-25 (Y/M/D)
18//! HOSTNAME: `versi-developer-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
19//!
20//! DATABASE: `InMemoryDb`, RUNTIME: `Polkadot Asset Hub`
21//! BLOCK-NUM: `BlockId::Number(8404035)`
22//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
23//! STATE-VERSION: `V1`, STATE-CACHE-SIZE: ``
24//! WEIGHT-PATH: ``
25//! METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`
26
27// Executed Command:
28//   ./target/production/polkadot-parachain
29//   benchmark
30//   storage
31//   --warmups
32//   1
33//   --state-version
34//   1
35//   --base-path
36//   /opt/local-ssd/polkadot-asset-hub
37//   --chain
38//   cumulus/polkadot-parachain/chain-specs/asset-hub-polkadot.json
39//   --detailed-log-output
40//   --enable-trie-cache
41//   --trie-cache-size
42//   10737418240
43//   --batch-size
44//   10000
45//   --mode
46//   validate-block
47//   --validate-block-rounds
48//   100
49
50/// Storage DB weights for the `Polkadot Asset Hub` runtime and `InMemoryDb`.
51pub mod constants {
52	use frame_support::weights::{constants, RuntimeDbWeight};
53	use sp_core::parameter_types;
54
55	parameter_types! {
56		/// `InMemoryDb` weights are measured in the context of the validation functions.
57		/// To avoid submitting overweight blocks to the relay chain this is the configuration
58		/// parachains should use.
59		pub const InMemoryDbWeight: RuntimeDbWeight = RuntimeDbWeight {
60			// Time to read one storage item.
61			// Calculated by multiplying the *Average* of all values with `1.0` and adding `0`.
62			//
63			// Stats nanoseconds:
64			//   Min, Max: 12_883, 13_516
65			//   Average:  13_036
66			//   Median:   13_031
67			//   Std-Dev:  69.49
68			//
69			// Percentiles nanoseconds:
70			//   99th: 13_242
71			//   95th: 13_152
72			//   75th: 13_070
73			read: 13_036 * constants::WEIGHT_REF_TIME_PER_NANOS,
74
75			// Time to write one storage item.
76			// Calculated by multiplying the *Average* of all values with `1.0` and adding `0`.
77			//
78			// Stats nanoseconds:
79			//   Min, Max: 28_998, 32_249
80			//   Average:  31_215
81			//   Median:   31_667
82			//   Std-Dev:  1047.8
83			//
84			// Percentiles nanoseconds:
85			//   99th: 32_195
86			//   95th: 32_114
87			//   75th: 31_852
88			write: 31_215 * constants::WEIGHT_REF_TIME_PER_NANOS,
89		};
90	}
91
92	#[cfg(test)]
93	mod test_db_weights {
94		use super::InMemoryDbWeight as W;
95		use frame_support::weights::constants;
96
97		/// Checks that all weights exist and have sane values.
98		// NOTE: If this test fails but you are sure that the generated values are fine,
99		// you can delete it.
100		#[test]
101		fn bound() {
102			// At least 1 µs.
103			assert!(
104				W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
105				"Read weight should be at least 1 µs."
106			);
107			assert!(
108				W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
109				"Write weight should be at least 1 µs."
110			);
111			// At most 1 ms.
112			assert!(
113				W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
114				"Read weight should be at most 1 ms."
115			);
116			assert!(
117				W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
118				"Write weight should be at most 1 ms."
119			);
120		}
121	}
122}