common_runtime/weights/
pallet_balances.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_balances::WeightInfo for SubstrateWeight<T> {
36 fn transfer_allow_death() -> Weight {
39 Weight::from_parts(49_690_000, 4088)
44 .saturating_add(T::DbWeight::get().reads(1_u64))
45 .saturating_add(T::DbWeight::get().writes(1_u64))
46 }
47 fn transfer_keep_alive() -> Weight {
50 Weight::from_parts(39_927_000, 4088)
55 .saturating_add(T::DbWeight::get().reads(1_u64))
56 .saturating_add(T::DbWeight::get().writes(1_u64))
57 }
58 fn force_set_balance_creating() -> Weight {
61 Weight::from_parts(22_496_000, 4088)
66 .saturating_add(T::DbWeight::get().reads(1_u64))
67 .saturating_add(T::DbWeight::get().writes(1_u64))
68 }
69 fn force_set_balance_killing() -> Weight {
72 Weight::from_parts(22_672_000, 4088)
77 .saturating_add(T::DbWeight::get().reads(1_u64))
78 .saturating_add(T::DbWeight::get().writes(1_u64))
79 }
80 fn force_transfer() -> Weight {
83 Weight::from_parts(52_579_000, 6691)
88 .saturating_add(T::DbWeight::get().reads(2_u64))
89 .saturating_add(T::DbWeight::get().writes(2_u64))
90 }
91 fn transfer_all() -> Weight {
94 Weight::from_parts(49_746_000, 4088)
99 .saturating_add(T::DbWeight::get().reads(1_u64))
100 .saturating_add(T::DbWeight::get().writes(1_u64))
101 }
102 fn force_unreserve() -> Weight {
105 Weight::from_parts(18_737_000, 4088)
110 .saturating_add(T::DbWeight::get().reads(1_u64))
111 .saturating_add(T::DbWeight::get().writes(1_u64))
112 }
113 fn upgrade_accounts(u: u32, ) -> Weight {
117 Weight::from_parts(17_279_000, 1485)
122 .saturating_add(Weight::from_parts(14_453_415, 0).saturating_mul(u.into()))
124 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
125 .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
126 .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
127 }
128 fn force_adjust_total_issuance() -> Weight {
129 Weight::from_parts(6_459_000, 0)
134 }
135 fn burn_allow_death() -> Weight {
136 Weight::from_parts(31_642_000, 0)
141 }
142 fn burn_keep_alive() -> Weight {
143 Weight::from_parts(22_107_000, 0)
148 }
149}
150
151
152#[cfg(test)]
153mod tests {
154 use frame_support::{traits::Get, weights::Weight, dispatch::DispatchClass};
155 use crate::constants::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
156 use crate::weights::extrinsic_weights::ExtrinsicBaseWeight;
157
158 #[allow(dead_code)]
159 struct BlockWeights;
160 impl Get<frame_system::limits::BlockWeights> for BlockWeights {
161 fn get() -> frame_system::limits::BlockWeights {
162 frame_system::limits::BlockWeights::builder()
163 .base_block(Weight::zero())
164 .for_class(DispatchClass::all(), |weights| {
165 weights.base_extrinsic = ExtrinsicBaseWeight::get();
166 })
167 .for_class(DispatchClass::non_mandatory(), |weights| {
168 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
169 })
170 .build_or_panic()
171 }
172 }
173
174 #[test]
175 fn test_transfer_allow_death() {
176 assert!(
177 BlockWeights::get()
178 .per_class
179 .get(frame_support::dispatch::DispatchClass::Normal)
180 .max_extrinsic
181 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
182 .proof_size()
183 > 4088
184 );
185 }
186 #[test]
187 fn test_transfer_keep_alive() {
188 assert!(
189 BlockWeights::get()
190 .per_class
191 .get(frame_support::dispatch::DispatchClass::Normal)
192 .max_extrinsic
193 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
194 .proof_size()
195 > 4088
196 );
197 }
198 #[test]
199 fn test_force_set_balance_creating() {
200 assert!(
201 BlockWeights::get()
202 .per_class
203 .get(frame_support::dispatch::DispatchClass::Normal)
204 .max_extrinsic
205 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
206 .proof_size()
207 > 4088
208 );
209 }
210 #[test]
211 fn test_force_set_balance_killing() {
212 assert!(
213 BlockWeights::get()
214 .per_class
215 .get(frame_support::dispatch::DispatchClass::Normal)
216 .max_extrinsic
217 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
218 .proof_size()
219 > 4088
220 );
221 }
222 #[test]
223 fn test_force_transfer() {
224 assert!(
225 BlockWeights::get()
226 .per_class
227 .get(frame_support::dispatch::DispatchClass::Normal)
228 .max_extrinsic
229 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
230 .proof_size()
231 > 6691
232 );
233 }
234 #[test]
235 fn test_transfer_all() {
236 assert!(
237 BlockWeights::get()
238 .per_class
239 .get(frame_support::dispatch::DispatchClass::Normal)
240 .max_extrinsic
241 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
242 .proof_size()
243 > 4088
244 );
245 }
246 #[test]
247 fn test_force_unreserve() {
248 assert!(
249 BlockWeights::get()
250 .per_class
251 .get(frame_support::dispatch::DispatchClass::Normal)
252 .max_extrinsic
253 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
254 .proof_size()
255 > 4088
256 );
257 }
258 #[test]
259 fn test_upgrade_accounts() {
260 assert!(
261 BlockWeights::get()
262 .per_class
263 .get(frame_support::dispatch::DispatchClass::Normal)
264 .max_extrinsic
265 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
266 .proof_size()
267 > 1485
268 );
269 }
270}