pallet_asset_conversion/weights.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18// This file is part of Substrate.
19
20// Copyright (C) Parity Technologies (UK) Ltd.
21// SPDX-License-Identifier: Apache-2.0
22
23// Licensed under the Apache License, Version 2.0 (the "License");
24// you may not use this file except in compliance with the License.
25// You may obtain a copy of the License at
26//
27// http://www.apache.org/licenses/LICENSE-2.0
28//
29// Unless required by applicable law or agreed to in writing, software
30// distributed under the License is distributed on an "AS IS" BASIS,
31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32// See the License for the specific language governing permissions and
33// limitations under the License.
34
35//! Autogenerated weights for `pallet_asset_conversion`
36//!
37//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
38//! DATE: 2026-04-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
39//! WORST CASE MAP SIZE: `1000000`
40//! HOSTNAME: `2e2073941e5c`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
41//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024`
42
43// Executed Command:
44// frame-omni-bencher
45// v1
46// benchmark
47// pallet
48// --extrinsic=*
49// --runtime=target/production/wbuild/kitchensink-runtime/kitchensink_runtime.wasm
50// --pallet=pallet_asset_conversion
51// --header=/__w/polkadot-sdk/polkadot-sdk/substrate/HEADER-APACHE2
52// --output=/__w/polkadot-sdk/polkadot-sdk/substrate/frame/asset-conversion/src/weights.rs
53// --wasm-execution=compiled
54// --steps=50
55// --repeat=20
56// --heap-pages=4096
57// --template=substrate/.maintain/frame-weight-template.hbs
58// --no-storage-info
59// --no-min-squares
60// --no-median-slopes
61// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage
62
63#![cfg_attr(rustfmt, rustfmt_skip)]
64#![allow(unused_parens)]
65#![allow(unused_imports)]
66#![allow(missing_docs)]
67#![allow(dead_code)]
68
69use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
70use core::marker::PhantomData;
71
72/// Weight functions needed for `pallet_asset_conversion`.
73pub trait WeightInfo {
74 fn create_pool() -> Weight;
75 fn add_liquidity() -> Weight;
76 fn remove_liquidity() -> Weight;
77 fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight;
78 fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight;
79 fn touch(n: u32, ) -> Weight;
80 fn get_reserves() -> Weight;
81}
82
83/// Weights for `pallet_asset_conversion` using the Substrate node and recommended hardware.
84pub struct SubstrateWeight<T>(PhantomData<T>);
85impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
86 /// Storage: `AssetConversion::Pools` (r:1 w:1)
87 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
88 /// Storage: `System::Account` (r:2 w:1)
89 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
90 /// Storage: `Assets::Asset` (r:2 w:0)
91 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
92 /// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
93 /// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
94 /// Storage: `PoolAssets::Asset` (r:1 w:1)
95 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
96 /// Storage: `PoolAssets::NextAssetId` (r:1 w:0)
97 /// Proof: `PoolAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
98 /// Storage: `PoolAssets::Account` (r:1 w:1)
99 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
100 fn create_pool() -> Weight {
101 // Proof Size summary in bytes:
102 // Measured: `1015`
103 // Estimated: `6360`
104 // Minimum execution time: 103_128_000 picoseconds.
105 Weight::from_parts(107_814_000, 6360)
106 .saturating_add(T::DbWeight::get().reads(9_u64))
107 .saturating_add(T::DbWeight::get().writes(5_u64))
108 }
109 /// Storage: `AssetConversion::Pools` (r:1 w:0)
110 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
111 /// Storage: `Assets::Asset` (r:2 w:2)
112 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
113 /// Storage: `Assets::Account` (r:4 w:4)
114 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
115 /// Storage: `System::Account` (r:1 w:1)
116 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
117 /// Storage: `PoolAssets::Asset` (r:1 w:1)
118 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
119 /// Storage: `PoolAssets::Account` (r:2 w:2)
120 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
121 fn add_liquidity() -> Weight {
122 // Proof Size summary in bytes:
123 // Measured: `1612`
124 // Estimated: `11426`
125 // Minimum execution time: 158_805_000 picoseconds.
126 Weight::from_parts(166_146_000, 11426)
127 .saturating_add(T::DbWeight::get().reads(11_u64))
128 .saturating_add(T::DbWeight::get().writes(10_u64))
129 }
130 /// Storage: `AssetConversion::Pools` (r:1 w:0)
131 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
132 /// Storage: `Assets::Asset` (r:2 w:2)
133 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
134 /// Storage: `Assets::Account` (r:4 w:4)
135 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
136 /// Storage: `PoolAssets::Asset` (r:1 w:1)
137 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
138 /// Storage: `PoolAssets::Account` (r:1 w:1)
139 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
140 fn remove_liquidity() -> Weight {
141 // Proof Size summary in bytes:
142 // Measured: `1716`
143 // Estimated: `11426`
144 // Minimum execution time: 142_436_000 picoseconds.
145 Weight::from_parts(148_314_000, 11426)
146 .saturating_add(T::DbWeight::get().reads(9_u64))
147 .saturating_add(T::DbWeight::get().writes(8_u64))
148 }
149 /// Storage: `Assets::Asset` (r:4 w:4)
150 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
151 /// Storage: `Assets::Account` (r:8 w:8)
152 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
153 /// The range of component `n` is `[2, 4]`.
154 fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight {
155 // Proof Size summary in bytes:
156 // Measured: `155 + n * (419 ±0)`
157 // Estimated: `990 + n * (5218 ±0)`
158 // Minimum execution time: 97_583_000 picoseconds.
159 Weight::from_parts(100_654_000, 990)
160 // Standard Error: 119_944
161 .saturating_add(Weight::from_parts(13_196_089, 0).saturating_mul(n.into()))
162 .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
163 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into())))
164 .saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
165 }
166 /// Storage: `Assets::Asset` (r:4 w:4)
167 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
168 /// Storage: `Assets::Account` (r:8 w:8)
169 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
170 /// The range of component `n` is `[2, 4]`.
171 fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight {
172 // Proof Size summary in bytes:
173 // Measured: `155 + n * (419 ±0)`
174 // Estimated: `990 + n * (5218 ±0)`
175 // Minimum execution time: 97_799_000 picoseconds.
176 Weight::from_parts(100_557_000, 990)
177 // Standard Error: 119_435
178 .saturating_add(Weight::from_parts(13_110_353, 0).saturating_mul(n.into()))
179 .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
180 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into())))
181 .saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
182 }
183 /// Storage: `AssetConversion::Pools` (r:1 w:0)
184 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
185 /// Storage: `Assets::Asset` (r:2 w:2)
186 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
187 /// Storage: `System::Account` (r:1 w:0)
188 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
189 /// Storage: `Assets::Account` (r:2 w:2)
190 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
191 /// Storage: `PoolAssets::Asset` (r:1 w:1)
192 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
193 /// Storage: `PoolAssets::Account` (r:1 w:1)
194 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
195 /// The range of component `n` is `[0, 3]`.
196 fn touch(n: u32, ) -> Weight {
197 // Proof Size summary in bytes:
198 // Measured: `1676`
199 // Estimated: `6360`
200 // Minimum execution time: 53_689_000 picoseconds.
201 Weight::from_parts(57_471_161, 6360)
202 // Standard Error: 21_268
203 .saturating_add(Weight::from_parts(21_853_452, 0).saturating_mul(n.into()))
204 .saturating_add(T::DbWeight::get().reads(8_u64))
205 .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
206 }
207 /// Storage: `Assets::Asset` (r:2 w:0)
208 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
209 /// Storage: `Assets::Account` (r:2 w:0)
210 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
211 fn get_reserves() -> Weight {
212 // Proof Size summary in bytes:
213 // Measured: `915`
214 // Estimated: `6360`
215 // Minimum execution time: 23_562_000 picoseconds.
216 Weight::from_parts(25_131_000, 6360)
217 .saturating_add(T::DbWeight::get().reads(4_u64))
218 }
219}
220
221// For backwards compatibility and tests.
222impl WeightInfo for () {
223 /// Storage: `AssetConversion::Pools` (r:1 w:1)
224 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
225 /// Storage: `System::Account` (r:2 w:1)
226 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
227 /// Storage: `Assets::Asset` (r:2 w:0)
228 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
229 /// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
230 /// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
231 /// Storage: `PoolAssets::Asset` (r:1 w:1)
232 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
233 /// Storage: `PoolAssets::NextAssetId` (r:1 w:0)
234 /// Proof: `PoolAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
235 /// Storage: `PoolAssets::Account` (r:1 w:1)
236 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
237 fn create_pool() -> Weight {
238 // Proof Size summary in bytes:
239 // Measured: `1015`
240 // Estimated: `6360`
241 // Minimum execution time: 103_128_000 picoseconds.
242 Weight::from_parts(107_814_000, 6360)
243 .saturating_add(RocksDbWeight::get().reads(9_u64))
244 .saturating_add(RocksDbWeight::get().writes(5_u64))
245 }
246 /// Storage: `AssetConversion::Pools` (r:1 w:0)
247 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
248 /// Storage: `Assets::Asset` (r:2 w:2)
249 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
250 /// Storage: `Assets::Account` (r:4 w:4)
251 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
252 /// Storage: `System::Account` (r:1 w:1)
253 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
254 /// Storage: `PoolAssets::Asset` (r:1 w:1)
255 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
256 /// Storage: `PoolAssets::Account` (r:2 w:2)
257 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
258 fn add_liquidity() -> Weight {
259 // Proof Size summary in bytes:
260 // Measured: `1612`
261 // Estimated: `11426`
262 // Minimum execution time: 158_805_000 picoseconds.
263 Weight::from_parts(166_146_000, 11426)
264 .saturating_add(RocksDbWeight::get().reads(11_u64))
265 .saturating_add(RocksDbWeight::get().writes(10_u64))
266 }
267 /// Storage: `AssetConversion::Pools` (r:1 w:0)
268 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
269 /// Storage: `Assets::Asset` (r:2 w:2)
270 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
271 /// Storage: `Assets::Account` (r:4 w:4)
272 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
273 /// Storage: `PoolAssets::Asset` (r:1 w:1)
274 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
275 /// Storage: `PoolAssets::Account` (r:1 w:1)
276 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
277 fn remove_liquidity() -> Weight {
278 // Proof Size summary in bytes:
279 // Measured: `1716`
280 // Estimated: `11426`
281 // Minimum execution time: 142_436_000 picoseconds.
282 Weight::from_parts(148_314_000, 11426)
283 .saturating_add(RocksDbWeight::get().reads(9_u64))
284 .saturating_add(RocksDbWeight::get().writes(8_u64))
285 }
286 /// Storage: `Assets::Asset` (r:4 w:4)
287 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
288 /// Storage: `Assets::Account` (r:8 w:8)
289 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
290 /// The range of component `n` is `[2, 4]`.
291 fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight {
292 // Proof Size summary in bytes:
293 // Measured: `155 + n * (419 ±0)`
294 // Estimated: `990 + n * (5218 ±0)`
295 // Minimum execution time: 97_583_000 picoseconds.
296 Weight::from_parts(100_654_000, 990)
297 // Standard Error: 119_944
298 .saturating_add(Weight::from_parts(13_196_089, 0).saturating_mul(n.into()))
299 .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
300 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
301 .saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
302 }
303 /// Storage: `Assets::Asset` (r:4 w:4)
304 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
305 /// Storage: `Assets::Account` (r:8 w:8)
306 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
307 /// The range of component `n` is `[2, 4]`.
308 fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight {
309 // Proof Size summary in bytes:
310 // Measured: `155 + n * (419 ±0)`
311 // Estimated: `990 + n * (5218 ±0)`
312 // Minimum execution time: 97_799_000 picoseconds.
313 Weight::from_parts(100_557_000, 990)
314 // Standard Error: 119_435
315 .saturating_add(Weight::from_parts(13_110_353, 0).saturating_mul(n.into()))
316 .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
317 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
318 .saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
319 }
320 /// Storage: `AssetConversion::Pools` (r:1 w:0)
321 /// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
322 /// Storage: `Assets::Asset` (r:2 w:2)
323 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
324 /// Storage: `System::Account` (r:1 w:0)
325 /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
326 /// Storage: `Assets::Account` (r:2 w:2)
327 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
328 /// Storage: `PoolAssets::Asset` (r:1 w:1)
329 /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
330 /// Storage: `PoolAssets::Account` (r:1 w:1)
331 /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
332 /// The range of component `n` is `[0, 3]`.
333 fn touch(n: u32, ) -> Weight {
334 // Proof Size summary in bytes:
335 // Measured: `1676`
336 // Estimated: `6360`
337 // Minimum execution time: 53_689_000 picoseconds.
338 Weight::from_parts(57_471_161, 6360)
339 // Standard Error: 21_268
340 .saturating_add(Weight::from_parts(21_853_452, 0).saturating_mul(n.into()))
341 .saturating_add(RocksDbWeight::get().reads(8_u64))
342 .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(n.into())))
343 }
344 /// Storage: `Assets::Asset` (r:2 w:0)
345 /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
346 /// Storage: `Assets::Account` (r:2 w:0)
347 /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
348 fn get_reserves() -> Weight {
349 // Proof Size summary in bytes:
350 // Measured: `915`
351 // Estimated: `6360`
352 // Minimum execution time: 23_562_000 picoseconds.
353 Weight::from_parts(25_131_000, 6360)
354 .saturating_add(RocksDbWeight::get().reads(4_u64))
355 }
356}