common_runtime/weights/
pallet_transaction_payment.rs1#![cfg_attr(rustfmt, rustfmt_skip)]
26#![allow(unused_parens)]
27#![allow(unused_imports)]
28#![allow(missing_docs)]
29
30use frame_support::{traits::Get, weights::Weight};
31use core::marker::PhantomData;
32
33pub struct SubstrateWeight<T>(PhantomData<T>);
35impl<T: frame_system::Config> pallet_transaction_payment::WeightInfo for SubstrateWeight<T> {
36 fn charge_transaction_payment() -> Weight {
39 Weight::from_parts(30_716_000, 4088)
44 .saturating_add(T::DbWeight::get().reads(1_u64))
45 .saturating_add(T::DbWeight::get().writes(1_u64))
46 }
47}
48
49
50#[cfg(test)]
51mod tests {
52 use frame_support::{traits::Get, weights::Weight, dispatch::DispatchClass};
53 use crate::constants::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
54 use crate::weights::extrinsic_weights::ExtrinsicBaseWeight;
55
56 #[allow(dead_code)]
57 struct BlockWeights;
58 impl Get<frame_system::limits::BlockWeights> for BlockWeights {
59 fn get() -> frame_system::limits::BlockWeights {
60 frame_system::limits::BlockWeights::builder()
61 .base_block(Weight::zero())
62 .for_class(DispatchClass::all(), |weights| {
63 weights.base_extrinsic = ExtrinsicBaseWeight::get();
64 })
65 .for_class(DispatchClass::non_mandatory(), |weights| {
66 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
67 })
68 .build_or_panic()
69 }
70 }
71
72 #[test]
73 fn test_charge_transaction_payment() {
74 assert!(
75 BlockWeights::get()
76 .per_class
77 .get(frame_support::dispatch::DispatchClass::Normal)
78 .max_extrinsic
79 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
80 .proof_size()
81 > 4088
82 );
83 }
84}