Skip to content

Commit

Permalink
feat(torus0): add benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
saiintbrisson committed Jan 3, 2025
1 parent e5c80be commit 03e423c
Show file tree
Hide file tree
Showing 13 changed files with 501 additions and 117 deletions.
1 change: 1 addition & 0 deletions pallets/emission0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ std = [
runtime-benchmarks = [
"polkadot-sdk/runtime-benchmarks",
"pallet-torus0-api/runtime-benchmarks",
"pallet-governance-api/runtime-benchmarks",
]
try-runtime = ["polkadot-sdk/try-runtime"]

Expand Down
26 changes: 13 additions & 13 deletions pallets/emission0/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0
//! DATE: 2025-01-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `MacBook-Pro-de-Joao.local`, CPU: `<UNKNOWN>`
//! HOSTNAME: `Luizs-MacBook-Pro.local`, CPU: `<UNKNOWN>`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024`
// Executed Command:
Expand Down Expand Up @@ -64,8 +64,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `7638`
// Minimum execution time: 33_000_000 picoseconds.
Weight::from_parts(34_000_000, 7638)
// Minimum execution time: 24_000_000 picoseconds.
Weight::from_parts(26_000_000, 7638)
.saturating_add(T::DbWeight::get().reads(8_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -77,8 +77,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `168`
// Estimated: `7638`
// Minimum execution time: 17_000_000 picoseconds.
Weight::from_parts(18_000_000, 7638)
// Minimum execution time: 12_000_000 picoseconds.
Weight::from_parts(12_000_000, 7638)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -88,8 +88,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `199`
// Estimated: `3529`
// Minimum execution time: 10_000_000 picoseconds.
Weight::from_parts(11_000_000, 3529)
// Minimum execution time: 7_000_000 picoseconds.
Weight::from_parts(8_000_000, 3529)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -115,8 +115,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `7638`
// Minimum execution time: 33_000_000 picoseconds.
Weight::from_parts(34_000_000, 7638)
// Minimum execution time: 24_000_000 picoseconds.
Weight::from_parts(26_000_000, 7638)
.saturating_add(RocksDbWeight::get().reads(8_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand All @@ -128,8 +128,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `168`
// Estimated: `7638`
// Minimum execution time: 17_000_000 picoseconds.
Weight::from_parts(18_000_000, 7638)
// Minimum execution time: 12_000_000 picoseconds.
Weight::from_parts(12_000_000, 7638)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand All @@ -139,8 +139,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `199`
// Estimated: `3529`
// Minimum execution time: 10_000_000 picoseconds.
Weight::from_parts(11_000_000, 3529)
// Minimum execution time: 7_000_000 picoseconds.
Weight::from_parts(8_000_000, 3529)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand Down
1 change: 1 addition & 0 deletions pallets/governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runtime-benchmarks = [
"pallet-emission0/runtime-benchmarks",

"pallet-torus0-api/runtime-benchmarks",
"pallet-governance-api/runtime-benchmarks",
]
try-runtime = [
"polkadot-sdk/try-runtime",
Expand Down
6 changes: 6 additions & 0 deletions pallets/governance/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ pub trait GovernanceApi<AccountId> {

fn ensure_allocator(key: &AccountId) -> DispatchResult;

#[doc(hidden)]
#[cfg(feature = "runtime-benchmarks")]
fn set_allocator(key: &AccountId);

#[doc(hidden)]
#[cfg(feature = "runtime-benchmarks")]
fn set_whitelisted(key: &AccountId);
}
6 changes: 6 additions & 0 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,13 @@ impl<T: Config> pallet_governance_api::GovernanceApi<T::AccountId> for Pallet<T>
crate::roles::ensure_allocator::<T>(key)
}

#[cfg(feature = "runtime-benchmarks")]
fn set_allocator(key: &T::AccountId) {
crate::Allocators::<T>::insert(key, ());
}

#[cfg(feature = "runtime-benchmarks")]
fn set_whitelisted(key: &T::AccountId) {
crate::Whitelist::<T>::insert(key, ())
}
}
Loading

0 comments on commit 03e423c

Please sign in to comment.