Skip to content

Commit a73292f

Browse files
committed
configurable stablecoin addresses, update simtest, and add per-entry linear benchmarking
1 parent ef25136 commit a73292f

9 files changed

Lines changed: 126 additions & 90 deletions

File tree

modules/pallets/intents-coprocessor/src/benchmarking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ mod benchmarks {
201201
}
202202

203203
#[benchmark]
204-
fn submit_pair_price() {
204+
fn submit_pair_price(n: Linear<1, 100>) {
205205
let caller: T::AccountId = whitelisted_caller();
206206
let pair_id = H256::repeat_byte(0xaa);
207207

@@ -215,9 +215,9 @@ mod benchmarks {
215215
PriceDepositLockDuration::<T>::put(BlockNumberFor::<T>::from(10u32));
216216
PriceWindowDurationValue::<T>::put(86_400_000u64);
217217

218-
let max = T::MaxPriceEntries::get();
218+
let count = n.min(T::MaxPriceEntries::get());
219219
let mut entries_vec = vec![];
220-
for i in 0..max {
220+
for i in 0..count {
221221
entries_vec
222222
.push(PriceInput { amount: U256::from(i * 1000), price: U256::from(2000 + i) });
223223
}

modules/pallets/intents-coprocessor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ pub mod pallet {
580580
/// Each entry in `entries` specifies a base token amount range and the
581581
/// corresponding price of the base token in terms of the quote token.
582582
#[pallet::call_index(7)]
583-
#[pallet::weight(T::WeightInfo::submit_pair_price())]
583+
#[pallet::weight(T::WeightInfo::submit_pair_price(entries.len() as u32))]
584584
pub fn submit_pair_price(
585585
origin: OriginFor<T>,
586586
pair_id: H256,

modules/pallets/intents-coprocessor/src/weights.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub trait WeightInfo {
4242
fn sweep_dust() -> Weight;
4343
fn update_token_decimals() -> Weight;
4444
fn set_storage_deposit_fee() -> Weight;
45-
fn submit_pair_price() -> Weight;
45+
fn submit_pair_price(n: u32) -> Weight;
4646
fn add_recognized_pair() -> Weight;
4747
fn remove_recognized_pair() -> Weight;
4848
fn set_price_window_duration() -> Weight;
@@ -122,9 +122,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
122122

123123
/// Storage: RecognizedPairs (r:1 w:0), PriceDepositAmount (r:1 w:0),
124124
/// PriceDeposits (r:1 w:1), PricesClearedThisWindow (r:1 w:1), Prices (r:1 w:1)
125-
fn submit_pair_price() -> Weight {
125+
fn submit_pair_price(n: u32) -> Weight {
126126
Weight::from_parts(100_000_000, 0)
127127
.saturating_add(Weight::from_parts(0, 5000))
128+
.saturating_add(Weight::from_parts(5_000_000u64.saturating_mul(n as u64), 0))
128129
.saturating_add(T::DbWeight::get().reads(5))
129130
.saturating_add(T::DbWeight::get().writes(4))
130131
}
@@ -193,7 +194,7 @@ impl WeightInfo for () {
193194
fn set_storage_deposit_fee() -> Weight {
194195
Weight::from_parts(10_000_000, 0)
195196
}
196-
fn submit_pair_price() -> Weight {
197+
fn submit_pair_price(_n: u32) -> Weight {
197198
Weight::from_parts(100_000_000, 0)
198199
}
199200
fn add_recognized_pair() -> Weight {

parachain/runtimes/gargantua/src/weights/pallet_intents_coprocessor.rs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Autogenerated weights for `pallet_intents_coprocessor`
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 53.0.0
20-
//! DATE: 2026-03-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
20+
//! DATE: 2026-03-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
2121
//! WORST CASE MAP SIZE: `1000000`
2222
//! HOSTNAME: `polytope-labs`, CPU: `AMD Ryzen Threadripper PRO 5995WX 64-Cores`
2323
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
@@ -60,8 +60,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
6060
// Proof Size summary in bytes:
6161
// Measured: `109`
6262
// Estimated: `3574`
63-
// Minimum execution time: 39_204_000 picoseconds.
64-
Weight::from_parts(40_847_000, 0)
63+
// Minimum execution time: 35_748_000 picoseconds.
64+
Weight::from_parts(36_820_000, 0)
6565
.saturating_add(Weight::from_parts(0, 3574))
6666
.saturating_add(T::DbWeight::get().reads(2))
6767
.saturating_add(T::DbWeight::get().writes(1))
@@ -72,8 +72,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
7272
// Proof Size summary in bytes:
7373
// Measured: `247`
7474
// Estimated: `3712`
75-
// Minimum execution time: 38_373_000 picoseconds.
76-
Weight::from_parts(38_974_000, 0)
75+
// Minimum execution time: 34_355_000 picoseconds.
76+
Weight::from_parts(35_007_000, 0)
7777
.saturating_add(Weight::from_parts(0, 3712))
7878
.saturating_add(T::DbWeight::get().reads(1))
7979
.saturating_add(T::DbWeight::get().writes(1))
@@ -84,8 +84,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
8484
// Proof Size summary in bytes:
8585
// Measured: `113`
8686
// Estimated: `6053`
87-
// Minimum execution time: 22_022_000 picoseconds.
88-
Weight::from_parts(22_833_000, 0)
87+
// Minimum execution time: 22_532_000 picoseconds.
88+
Weight::from_parts(23_003_000, 0)
8989
.saturating_add(Weight::from_parts(0, 6053))
9090
.saturating_add(T::DbWeight::get().reads(2))
9191
.saturating_add(T::DbWeight::get().writes(1))
@@ -108,8 +108,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
108108
// Proof Size summary in bytes:
109109
// Measured: `700`
110110
// Estimated: `4165`
111-
// Minimum execution time: 73_429_000 picoseconds.
112-
Weight::from_parts(74_331_000, 0)
111+
// Minimum execution time: 73_309_000 picoseconds.
112+
Weight::from_parts(74_632_000, 0)
113113
.saturating_add(Weight::from_parts(0, 4165))
114114
.saturating_add(T::DbWeight::get().reads(7))
115115
.saturating_add(T::DbWeight::get().writes(5))
@@ -132,8 +132,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
132132
// Proof Size summary in bytes:
133133
// Measured: `700`
134134
// Estimated: `4165`
135-
// Minimum execution time: 64_051_000 picoseconds.
136-
Weight::from_parts(65_424_000, 0)
135+
// Minimum execution time: 57_348_000 picoseconds.
136+
Weight::from_parts(65_745_000, 0)
137137
.saturating_add(Weight::from_parts(0, 4165))
138138
.saturating_add(T::DbWeight::get().reads(7))
139139
.saturating_add(T::DbWeight::get().writes(4))
@@ -156,8 +156,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
156156
// Proof Size summary in bytes:
157157
// Measured: `700`
158158
// Estimated: `4165`
159-
// Minimum execution time: 68_550_000 picoseconds.
160-
Weight::from_parts(69_231_000, 0)
159+
// Minimum execution time: 60_615_000 picoseconds.
160+
Weight::from_parts(69_401_000, 0)
161161
.saturating_add(Weight::from_parts(0, 4165))
162162
.saturating_add(T::DbWeight::get().reads(7))
163163
.saturating_add(T::DbWeight::get().writes(4))
@@ -168,8 +168,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
168168
// Proof Size summary in bytes:
169169
// Measured: `0`
170170
// Estimated: `0`
171-
// Minimum execution time: 8_165_000 picoseconds.
172-
Weight::from_parts(8_526_000, 0)
171+
// Minimum execution time: 7_374_000 picoseconds.
172+
Weight::from_parts(8_486_000, 0)
173173
.saturating_add(Weight::from_parts(0, 0))
174174
.saturating_add(T::DbWeight::get().writes(1))
175175
}
@@ -185,13 +185,16 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
185185
/// Proof: `IntentsCoprocessor::Prices` (`max_values`: None, `max_size`: None, mode: `Measured`)
186186
/// Storage: `IntentsCoprocessor::CounterForPrices` (r:1 w:1)
187187
/// Proof: `IntentsCoprocessor::CounterForPrices` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
188-
fn submit_pair_price() -> Weight {
188+
/// The range of component `n` is `[1, 100]`.
189+
fn submit_pair_price(n: u32, ) -> Weight {
189190
// Proof Size summary in bytes:
190191
// Measured: `271`
191192
// Estimated: `3736`
192-
// Minimum execution time: 71_406_000 picoseconds.
193-
Weight::from_parts(72_077_000, 0)
193+
// Minimum execution time: 57_349_000 picoseconds.
194+
Weight::from_parts(64_579_050, 0)
194195
.saturating_add(Weight::from_parts(0, 3736))
196+
// Standard Error: 5_521
197+
.saturating_add(Weight::from_parts(15_669, 0).saturating_mul(n.into()))
195198
.saturating_add(T::DbWeight::get().reads(6))
196199
.saturating_add(T::DbWeight::get().writes(4))
197200
}
@@ -201,8 +204,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
201204
// Proof Size summary in bytes:
202205
// Measured: `109`
203206
// Estimated: `3574`
204-
// Minimum execution time: 15_891_000 picoseconds.
205-
Weight::from_parts(16_141_000, 0)
207+
// Minimum execution time: 13_807_000 picoseconds.
208+
Weight::from_parts(14_177_000, 0)
206209
.saturating_add(Weight::from_parts(0, 3574))
207210
.saturating_add(T::DbWeight::get().reads(1))
208211
.saturating_add(T::DbWeight::get().writes(1))
@@ -215,8 +218,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
215218
// Proof Size summary in bytes:
216219
// Measured: `184`
217220
// Estimated: `3649`
218-
// Minimum execution time: 22_232_000 picoseconds.
219-
Weight::from_parts(22_973_000, 0)
221+
// Minimum execution time: 19_698_000 picoseconds.
222+
Weight::from_parts(20_279_000, 0)
220223
.saturating_add(Weight::from_parts(0, 3649))
221224
.saturating_add(T::DbWeight::get().reads(2))
222225
.saturating_add(T::DbWeight::get().writes(2))
@@ -227,8 +230,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
227230
// Proof Size summary in bytes:
228231
// Measured: `0`
229232
// Estimated: `0`
230-
// Minimum execution time: 8_476_000 picoseconds.
231-
Weight::from_parts(8_777_000, 0)
233+
// Minimum execution time: 7_174_000 picoseconds.
234+
Weight::from_parts(7_424_000, 0)
232235
.saturating_add(Weight::from_parts(0, 0))
233236
.saturating_add(T::DbWeight::get().writes(1))
234237
}
@@ -238,8 +241,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
238241
// Proof Size summary in bytes:
239242
// Measured: `0`
240243
// Estimated: `0`
241-
// Minimum execution time: 8_546_000 picoseconds.
242-
Weight::from_parts(8_756_000, 0)
244+
// Minimum execution time: 7_314_000 picoseconds.
245+
Weight::from_parts(7_485_000, 0)
243246
.saturating_add(Weight::from_parts(0, 0))
244247
.saturating_add(T::DbWeight::get().writes(1))
245248
}
@@ -249,8 +252,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
249252
// Proof Size summary in bytes:
250253
// Measured: `0`
251254
// Estimated: `0`
252-
// Minimum execution time: 8_476_000 picoseconds.
253-
Weight::from_parts(8_727_000, 0)
255+
// Minimum execution time: 7_364_000 picoseconds.
256+
Weight::from_parts(7_575_000, 0)
254257
.saturating_add(Weight::from_parts(0, 0))
255258
.saturating_add(T::DbWeight::get().writes(1))
256259
}
@@ -260,8 +263,8 @@ impl<T: frame_system::Config> pallet_intents_coprocessor::WeightInfo for WeightI
260263
// Proof Size summary in bytes:
261264
// Measured: `438`
262265
// Estimated: `3903`
263-
// Minimum execution time: 39_775_000 picoseconds.
264-
Weight::from_parts(40_557_000, 0)
266+
// Minimum execution time: 35_157_000 picoseconds.
267+
Weight::from_parts(35_488_000, 0)
265268
.saturating_add(Weight::from_parts(0, 3903))
266269
.saturating_add(T::DbWeight::get().reads(1))
267270
.saturating_add(T::DbWeight::get().writes(1))

0 commit comments

Comments
 (0)