referrerpolicy=no-referrer-when-downgrade

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: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
39//! WORST CASE MAP SIZE: `1000000`
40//! HOSTNAME: `4563561839a5`, 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// --genesis-builder-policy=none
62// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage,pallet_election_provider_multi_block,pallet_election_provider_multi_block::signed,pallet_election_provider_multi_block::unsigned,pallet_election_provider_multi_block::verifier
63
64#![cfg_attr(rustfmt, rustfmt_skip)]
65#![allow(unused_parens)]
66#![allow(unused_imports)]
67#![allow(missing_docs)]
68#![allow(dead_code)]
69
70use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
71use core::marker::PhantomData;
72
73/// Weight functions needed for `pallet_asset_conversion`.
74pub trait WeightInfo {
75	fn create_pool() -> Weight;
76	fn add_liquidity() -> Weight;
77	fn remove_liquidity() -> Weight;
78	fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight;
79	fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight;
80	fn touch(n: u32, ) -> 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:  `476`
103		//  Estimated: `6360`
104		// Minimum execution time: 81_898_000 picoseconds.
105		Weight::from_parts(83_910_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:  `1090`
124		//  Estimated: `11426`
125		// Minimum execution time: 138_751_000 picoseconds.
126		Weight::from_parts(141_390_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:  `1233`
143		//  Estimated: `11426`
144		// Minimum execution time: 124_722_000 picoseconds.
145		Weight::from_parts(128_644_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:  `0 + n * (419 ±0)`
157		//  Estimated: `990 + n * (5218 ±0)`
158		// Minimum execution time: 88_884_000 picoseconds.
159		Weight::from_parts(91_036_000, 990)
160			// Standard Error: 337_841
161			.saturating_add(Weight::from_parts(11_478_919, 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:  `0 + n * (419 ±0)`
174		//  Estimated: `990 + n * (5218 ±0)`
175		// Minimum execution time: 89_080_000 picoseconds.
176		Weight::from_parts(90_913_000, 990)
177			// Standard Error: 340_609
178			.saturating_add(Weight::from_parts(11_562_623, 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:  `1154`
199		//  Estimated: `6360`
200		// Minimum execution time: 43_815_000 picoseconds.
201		Weight::from_parts(46_005_208, 6360)
202			// Standard Error: 68_937
203			.saturating_add(Weight::from_parts(19_974_807, 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}
208
209// For backwards compatibility and tests.
210impl WeightInfo for () {
211	/// Storage: `AssetConversion::Pools` (r:1 w:1)
212	/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
213	/// Storage: `System::Account` (r:2 w:1)
214	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
215	/// Storage: `Assets::Asset` (r:2 w:0)
216	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
217	/// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
218	/// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
219	/// Storage: `PoolAssets::Asset` (r:1 w:1)
220	/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
221	/// Storage: `PoolAssets::NextAssetId` (r:1 w:0)
222	/// Proof: `PoolAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
223	/// Storage: `PoolAssets::Account` (r:1 w:1)
224	/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
225	fn create_pool() -> Weight {
226		// Proof Size summary in bytes:
227		//  Measured:  `476`
228		//  Estimated: `6360`
229		// Minimum execution time: 81_898_000 picoseconds.
230		Weight::from_parts(83_910_000, 6360)
231			.saturating_add(RocksDbWeight::get().reads(9_u64))
232			.saturating_add(RocksDbWeight::get().writes(5_u64))
233	}
234	/// Storage: `AssetConversion::Pools` (r:1 w:0)
235	/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
236	/// Storage: `Assets::Asset` (r:2 w:2)
237	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
238	/// Storage: `Assets::Account` (r:4 w:4)
239	/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
240	/// Storage: `System::Account` (r:1 w:1)
241	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
242	/// Storage: `PoolAssets::Asset` (r:1 w:1)
243	/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
244	/// Storage: `PoolAssets::Account` (r:2 w:2)
245	/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
246	fn add_liquidity() -> Weight {
247		// Proof Size summary in bytes:
248		//  Measured:  `1090`
249		//  Estimated: `11426`
250		// Minimum execution time: 138_751_000 picoseconds.
251		Weight::from_parts(141_390_000, 11426)
252			.saturating_add(RocksDbWeight::get().reads(11_u64))
253			.saturating_add(RocksDbWeight::get().writes(10_u64))
254	}
255	/// Storage: `AssetConversion::Pools` (r:1 w:0)
256	/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
257	/// Storage: `Assets::Asset` (r:2 w:2)
258	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
259	/// Storage: `Assets::Account` (r:4 w:4)
260	/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
261	/// Storage: `PoolAssets::Asset` (r:1 w:1)
262	/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
263	/// Storage: `PoolAssets::Account` (r:1 w:1)
264	/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
265	fn remove_liquidity() -> Weight {
266		// Proof Size summary in bytes:
267		//  Measured:  `1233`
268		//  Estimated: `11426`
269		// Minimum execution time: 124_722_000 picoseconds.
270		Weight::from_parts(128_644_000, 11426)
271			.saturating_add(RocksDbWeight::get().reads(9_u64))
272			.saturating_add(RocksDbWeight::get().writes(8_u64))
273	}
274	/// Storage: `Assets::Asset` (r:4 w:4)
275	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
276	/// Storage: `Assets::Account` (r:8 w:8)
277	/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
278	/// The range of component `n` is `[2, 4]`.
279	fn swap_exact_tokens_for_tokens(n: u32, ) -> Weight {
280		// Proof Size summary in bytes:
281		//  Measured:  `0 + n * (419 ±0)`
282		//  Estimated: `990 + n * (5218 ±0)`
283		// Minimum execution time: 88_884_000 picoseconds.
284		Weight::from_parts(91_036_000, 990)
285			// Standard Error: 337_841
286			.saturating_add(Weight::from_parts(11_478_919, 0).saturating_mul(n.into()))
287			.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
288			.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
289			.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
290	}
291	/// Storage: `Assets::Asset` (r:4 w:4)
292	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
293	/// Storage: `Assets::Account` (r:8 w:8)
294	/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
295	/// The range of component `n` is `[2, 4]`.
296	fn swap_tokens_for_exact_tokens(n: u32, ) -> Weight {
297		// Proof Size summary in bytes:
298		//  Measured:  `0 + n * (419 ±0)`
299		//  Estimated: `990 + n * (5218 ±0)`
300		// Minimum execution time: 89_080_000 picoseconds.
301		Weight::from_parts(90_913_000, 990)
302			// Standard Error: 340_609
303			.saturating_add(Weight::from_parts(11_562_623, 0).saturating_mul(n.into()))
304			.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into())))
305			.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into())))
306			.saturating_add(Weight::from_parts(0, 5218).saturating_mul(n.into()))
307	}
308	/// Storage: `AssetConversion::Pools` (r:1 w:0)
309	/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`)
310	/// Storage: `Assets::Asset` (r:2 w:2)
311	/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
312	/// Storage: `System::Account` (r:1 w:0)
313	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
314	/// Storage: `Assets::Account` (r:2 w:2)
315	/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
316	/// Storage: `PoolAssets::Asset` (r:1 w:1)
317	/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
318	/// Storage: `PoolAssets::Account` (r:1 w:1)
319	/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
320	/// The range of component `n` is `[0, 3]`.
321	fn touch(n: u32, ) -> Weight {
322		// Proof Size summary in bytes:
323		//  Measured:  `1154`
324		//  Estimated: `6360`
325		// Minimum execution time: 43_815_000 picoseconds.
326		Weight::from_parts(46_005_208, 6360)
327			// Standard Error: 68_937
328			.saturating_add(Weight::from_parts(19_974_807, 0).saturating_mul(n.into()))
329			.saturating_add(RocksDbWeight::get().reads(8_u64))
330			.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(n.into())))
331	}
332}