pallet_messenger/extensions/
weights.rs1use core::marker::PhantomData;
4use frame_support::pallet_prelude::Weight;
5
6pub trait WeightInfo: FromConsensusWeightInfo + FromDomainWeightInfo {
8 fn mmr_proof_verification_on_consensus() -> Weight;
9 fn mmr_proof_verification_on_domain() -> Weight;
10}
11
12pub trait FromConsensusWeightInfo {
13 fn from_consensus_relay_message_channel_open() -> Weight;
14 fn from_consensus_relay_message() -> Weight;
15 fn from_consensus_relay_message_response() -> Weight;
16}
17
18impl FromConsensusWeightInfo for () {
19 fn from_consensus_relay_message_channel_open() -> Weight {
20 Weight::zero()
21 }
22 fn from_consensus_relay_message() -> Weight {
23 Weight::zero()
24 }
25 fn from_consensus_relay_message_response() -> Weight {
26 Weight::zero()
27 }
28}
29
30pub trait FromDomainWeightInfo {
31 fn from_domains_relay_message_channel_open() -> Weight;
32 fn from_domains_relay_message() -> Weight;
33 fn from_domains_relay_message_response() -> Weight;
34}
35
36impl FromDomainWeightInfo for () {
37 fn from_domains_relay_message_channel_open() -> Weight {
38 Weight::zero()
39 }
40 fn from_domains_relay_message() -> Weight {
41 Weight::zero()
42 }
43 fn from_domains_relay_message_response() -> Weight {
44 Weight::zero()
45 }
46}
47
48pub struct SubstrateWeight<T, C, D>(PhantomData<(T, C, D)>);
50
51impl<T: frame_system::Config, C: FromConsensusWeightInfo, D> FromConsensusWeightInfo
52 for SubstrateWeight<T, C, D>
53{
54 fn from_consensus_relay_message_channel_open() -> Weight {
55 C::from_consensus_relay_message_channel_open()
56 }
57
58 fn from_consensus_relay_message() -> Weight {
59 C::from_consensus_relay_message()
60 }
61
62 fn from_consensus_relay_message_response() -> Weight {
63 C::from_consensus_relay_message_response()
64 }
65}
66
67impl<T: frame_system::Config, C, D: FromDomainWeightInfo> FromDomainWeightInfo
68 for SubstrateWeight<T, C, D>
69{
70 fn from_domains_relay_message_channel_open() -> Weight {
71 D::from_domains_relay_message_channel_open()
72 }
73
74 fn from_domains_relay_message() -> Weight {
75 D::from_domains_relay_message()
76 }
77
78 fn from_domains_relay_message_response() -> Weight {
79 D::from_domains_relay_message_response()
80 }
81}
82
83impl<T: frame_system::Config, C: FromConsensusWeightInfo, D: FromDomainWeightInfo> WeightInfo
84 for SubstrateWeight<T, C, D>
85{
86 fn mmr_proof_verification_on_consensus() -> Weight {
87 Weight::from_parts(153_000_000, 0)
90 }
91
92 fn mmr_proof_verification_on_domain() -> Weight {
93 Weight::from_parts(595_000_000, 0)
96 }
97}