29
29
#![allow(unused_parens)]
30
30
#![allow(unused_imports)]
31
31
32
- use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
33
- use sp_std::marker::PhantomData;
34
-
35
- /// Weight functions needed for {{ pallet }} .
36
- pub trait WeightInfo {
37
- {{ ~#each benchmarks as |benchmark |}}
38
- fn {{ benchmark.name ~}}
39
- (
40
- {{ ~#each benchmark.components as |c | ~}}
41
- {{ c.name }} : u32, {{ /each ~}}
42
- ) -> Weight;
43
- {{ ~/each }}
44
- }
32
+ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight};
45
33
46
34
/// Weights for {{ pallet }} using the Substrate node and recommended hardware.
47
- pub struct SubstrateWeight<T >(PhantomData<T >);
48
- impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T > {
49
- {{ ~#each benchmarks as |benchmark |}}
50
- fn {{ benchmark.name ~}}
51
- (
52
- {{ ~#each benchmark.components as |c | ~}}
53
- {{ ~#if (not c.is_used )}} _{{ /if }} {{ c.name }} : u32, {{ /each ~}}
54
- ) -> Weight {
55
- ({{ underscore benchmark.base_weight }} as Weight)
56
- {{ ~#each benchmark.component_weight as |cw |}}
57
- // Standard Error: {{ underscore cw.error }}
58
- .saturating_add(({{ underscore cw.slope }} as Weight).saturating_mul({{ cw.name }} as Weight))
59
- {{ ~/each }}
60
- {{ ~#if (ne benchmark.base_reads " 0" )}}
61
- .saturating_add(T::DbWeight::get().reads({{ benchmark.base_reads }} as Weight))
62
- {{ ~/if }}
63
- {{ ~#each benchmark.component_reads as |cr |}}
64
- .saturating_add(T::DbWeight::get().reads(({{ cr.slope }} as Weight).saturating_mul({{ cr.name }} as Weight)))
65
- {{ ~/each }}
66
- {{ ~#if (ne benchmark.base_writes " 0" )}}
67
- .saturating_add(T::DbWeight::get().writes({{ benchmark.base_writes }} as Weight))
68
- {{ ~/if }}
69
- {{ ~#each benchmark.component_writes as |cw |}}
70
- .saturating_add(T::DbWeight::get().writes(({{ cw.slope }} as Weight).saturating_mul({{ cw.name }} as Weight)))
71
- {{ ~/each }}
72
- }
73
- {{ ~/each }}
74
- }
75
-
76
- // For backwards compatibility and tests
77
- impl WeightInfo for () {
35
+ pub struct WeightInfo;
36
+ impl {{ pallet }} ::WeightInfo for WeightInfo {
78
37
{{ ~#each benchmarks as |benchmark |}}
79
38
fn {{ benchmark.name ~}}
80
39
(
@@ -87,16 +46,16 @@ impl WeightInfo for () {
87
46
.saturating_add(({{ underscore cw.slope }} as Weight).saturating_mul({{ cw.name }} as Weight))
88
47
{{ ~/each }}
89
48
{{ ~#if (ne benchmark.base_reads " 0" )}}
90
- .saturating_add(RocksDbWeight ::get().reads({{ benchmark.base_reads }} as Weight))
49
+ .saturating_add(DbWeight ::get().reads({{ benchmark.base_reads }} as Weight))
91
50
{{ ~/if }}
92
51
{{ ~#each benchmark.component_reads as |cr |}}
93
- .saturating_add(RocksDbWeight ::get().reads(({{ cr.slope }} as Weight).saturating_mul({{ cr.name }} as Weight)))
52
+ .saturating_add(DbWeight ::get().reads(({{ cr.slope }} as Weight).saturating_mul({{ cr.name }} as Weight)))
94
53
{{ ~/each }}
95
54
{{ ~#if (ne benchmark.base_writes " 0" )}}
96
- .saturating_add(RocksDbWeight ::get().writes({{ benchmark.base_writes }} as Weight))
55
+ .saturating_add(DbWeight ::get().writes({{ benchmark.base_writes }} as Weight))
97
56
{{ ~/if }}
98
57
{{ ~#each benchmark.component_writes as |cw |}}
99
- .saturating_add(RocksDbWeight ::get().writes(({{ cw.slope }} as Weight).saturating_mul({{ cw.name }} as Weight)))
58
+ .saturating_add(DbWeight ::get().writes(({{ cw.slope }} as Weight).saturating_mul({{ cw.name }} as Weight)))
100
59
{{ ~/each }}
101
60
}
102
61
{{ ~/each }}
0 commit comments