referrerpolicy=no-referrer-when-downgrade

penpal_runtime/weights/
block_weights.rs

1// This file is part of Cumulus.
2// SPDX-License-Identifier: Unlicense
3
4// This is free and unencumbered software released into the public domain.
5
6// Anyone is free to copy, modify, publish, use, compile, sell, or
7// distribute this software, either in source code form or as a compiled
8// binary, for any purpose, commercial or non-commercial, and by any
9// means.
10
11// In jurisdictions that recognize copyright laws, the author or authors
12// of this software dedicate any and all copyright interest in the
13// software to the public domain. We make this dedication for the benefit
14// of the public at large and to the detriment of our heirs and
15// successors. We intend this dedication to be an overt act of
16// relinquishment in perpetuity of all present and future rights to this
17// software under copyright law.
18
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25// OTHER DEALINGS IN THE SOFTWARE.
26
27// For more information, please refer to <http://unlicense.org/>
28
29pub mod constants {
30	use frame_support::{
31		parameter_types,
32		weights::{constants, Weight},
33	};
34
35	parameter_types! {
36		/// Importing a block with 0 Extrinsics.
37		pub const BlockExecutionWeight: Weight =
38			Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0);
39	}
40
41	#[cfg(test)]
42	mod test_weights {
43		use frame_support::weights::constants;
44
45		/// Checks that the weight exists and is sane.
46		// NOTE: If this test fails but you are sure that the generated values are fine,
47		// you can delete it.
48		#[test]
49		fn sane() {
50			let w = super::constants::BlockExecutionWeight::get();
51
52			// At least 100 µs.
53			assert!(
54				w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
55				"Weight should be at least 100 µs."
56			);
57			// At most 50 ms.
58			assert!(
59				w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
60				"Weight should be at most 50 ms."
61			);
62		}
63	}
64}