bridge_hub_rococo_runtime/weights/block_weights.rs
1// This file is part of Cumulus.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18pub mod constants {
19 use frame_support::{
20 parameter_types,
21 weights::{constants, Weight},
22 };
23
24 parameter_types! {
25 /// Importing a block with 0 Extrinsics.
26 pub const BlockExecutionWeight: Weight =
27 Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0);
28 }
29
30 #[cfg(test)]
31 mod test_weights {
32 use frame_support::weights::constants;
33
34 /// Checks that the weight exists and is sane.
35 // NOTE: If this test fails but you are sure that the generated values are fine,
36 // you can delete it.
37 #[test]
38 fn sane() {
39 let w = super::constants::BlockExecutionWeight::get();
40
41 // At least 100 µs.
42 assert!(
43 w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
44 "Weight should be at least 100 µs."
45 );
46 // At most 50 ms.
47 assert!(
48 w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
49 "Weight should be at most 50 ms."
50 );
51 }
52 }
53}