parachain_template_runtime/weights/
rocksdb_weights.rs1pub mod constants {
19 use polkadot_sdk::*;
20
21 use frame_support::{
22 parameter_types,
23 weights::{constants, RuntimeDbWeight},
24 };
25
26 parameter_types! {
27 pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
30 read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
31 write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
32 };
33 }
34
35 #[cfg(test)]
36 mod test_db_weights {
37 use polkadot_sdk::*;
38
39 use super::constants::RocksDbWeight as W;
40 use frame_support::weights::constants;
41
42 #[test]
46 fn sane() {
47 assert!(
49 W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
50 "Read weight should be at least 1 µs."
51 );
52 assert!(
53 W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
54 "Write weight should be at least 1 µs."
55 );
56 assert!(
58 W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
59 "Read weight should be at most 1 ms."
60 );
61 assert!(
62 W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
63 "Write weight should be at most 1 ms."
64 );
65 }
66 }
67}