Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

528 make issue pallet benchmarks run successfully on pendulum runtimes #535

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pallets/issue/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ fn deposit_tokens<T: crate::Config>(
account_id: &T::AccountId,
amount: BalanceOf<T>,
) {
assert_ok!(<orml_tokens::Pallet<T>>::deposit(currency_id, account_id, amount));
assert_ok!(<orml_currencies::Pallet<T>>::deposit(currency_id, account_id, amount));
}

fn mint_collateral<T: crate::Config>(account_id: &T::AccountId, amount: BalanceOf<T>) {
deposit_tokens::<T>(get_collateral_currency_id::<T>(), account_id, amount);
deposit_tokens::<T>(get_native_currency_id::<T>(), account_id, amount);
deposit_tokens::<T>(
<T as vault_registry::Config>::GetGriefingCollateralCurrencyId::get(),
account_id,
amount,
);
}

fn get_currency_pair<T: crate::Config>() -> DefaultVaultCurrencyPair<T> {
Expand Down Expand Up @@ -61,8 +66,7 @@ benchmarks! {
request_issue {
let origin: T::AccountId = account("Origin", 0, 0);
let vault_id = get_vault_id::<T>();
let amount = 10_000_000u32.into();
let asset = vault_id.wrapped_currency();
let amount = Issue::<T>::issue_minimum_transfer_amount(vault_id.wrapped_currency()).amount();
let relayer_id: T::AccountId = account("Relayer", 0, 0);

Oracle::<T>::_set_exchange_rate(origin.clone(), get_collateral_currency_id::<T>(), <T as currency::Config>::UnsignedFixedPoint::one()).unwrap();
Expand Down
38 changes: 19 additions & 19 deletions pallets/issue/src/default_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Autogenerated weights for issue
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-04-02, STEPS: `100`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-05-23, STEPS: `100`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `Bogdans-M2-MacBook-Pro.local`, CPU: `<UNKNOWN>`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
Expand Down Expand Up @@ -77,8 +77,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `2192`
// Estimated: `5657`
// Minimum execution time: 57_000_000 picoseconds.
Weight::from_parts(60_000_000, 5657)
// Minimum execution time: 55_000_000 picoseconds.
Weight::from_parts(58_000_000, 5657)
.saturating_add(T::DbWeight::get().reads(15_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -104,8 +104,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `2190`
// Estimated: `71867`
// Minimum execution time: 3_807_000_000 picoseconds.
Weight::from_parts(3_911_000_000, 71867)
// Minimum execution time: 3_926_000_000 picoseconds.
Weight::from_parts(3_982_000_000, 71867)
.saturating_add(T::DbWeight::get().reads(10_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
Expand All @@ -121,8 +121,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `1199`
// Estimated: `4664`
// Minimum execution time: 24_000_000 picoseconds.
Weight::from_parts(25_000_000, 4664)
// Minimum execution time: 23_000_000 picoseconds.
Weight::from_parts(24_000_000, 4664)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
Expand All @@ -146,8 +146,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_000_000 picoseconds.
Weight::from_parts(6_000_000, 0)
// Minimum execution time: 4_000_000 picoseconds.
Weight::from_parts(5_000_000, 0)
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: Issue IssueMinimumTransferAmount (r:0 w:1)
Expand All @@ -156,7 +156,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_000_000 picoseconds.
// Minimum execution time: 3_000_000 picoseconds.
Weight::from_parts(4_000_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand Down Expand Up @@ -200,8 +200,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `2192`
// Estimated: `5657`
// Minimum execution time: 57_000_000 picoseconds.
Weight::from_parts(60_000_000, 5657)
// Minimum execution time: 55_000_000 picoseconds.
Weight::from_parts(58_000_000, 5657)
.saturating_add(RocksDbWeight::get().reads(15_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -227,8 +227,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `2190`
// Estimated: `71867`
// Minimum execution time: 3_807_000_000 picoseconds.
Weight::from_parts(3_911_000_000, 71867)
// Minimum execution time: 3_926_000_000 picoseconds.
Weight::from_parts(3_982_000_000, 71867)
.saturating_add(RocksDbWeight::get().reads(10_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
Expand All @@ -244,8 +244,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `1199`
// Estimated: `4664`
// Minimum execution time: 24_000_000 picoseconds.
Weight::from_parts(25_000_000, 4664)
// Minimum execution time: 23_000_000 picoseconds.
Weight::from_parts(24_000_000, 4664)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
Expand All @@ -269,8 +269,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_000_000 picoseconds.
Weight::from_parts(6_000_000, 0)
// Minimum execution time: 4_000_000 picoseconds.
Weight::from_parts(5_000_000, 0)
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: Issue IssueMinimumTransferAmount (r:0 w:1)
Expand All @@ -279,7 +279,7 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_000_000 picoseconds.
// Minimum execution time: 3_000_000 picoseconds.
Weight::from_parts(4_000_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand Down
Loading