mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Add session weight (#477)
* session weight * decouple session benchmarking and collator selection * removed mock * licensing * benchmarking script * set benchmarking into runtime * Update scripts/benchmarks.sh * real weights Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", default-fea
|
||||
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session-benchmarking = {path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
|
||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
@@ -91,6 +92,7 @@ runtime-benchmarks = [
|
||||
'pallet-balances/runtime-benchmarks',
|
||||
'pallet-multisig/runtime-benchmarks',
|
||||
'pallet-proxy/runtime-benchmarks',
|
||||
'pallet-session-benchmarking/runtime-benchmarks',
|
||||
'pallet-utility/runtime-benchmarks',
|
||||
'pallet-timestamp/runtime-benchmarks',
|
||||
'pallet-xcm/runtime-benchmarks',
|
||||
|
||||
@@ -570,7 +570,7 @@ impl pallet_session::Config for Runtime {
|
||||
type SessionHandler = <opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = opaque::SessionKeys;
|
||||
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
|
||||
type WeightInfo = ();
|
||||
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_aura::Config for Runtime {
|
||||
@@ -789,8 +789,11 @@ impl_runtime_apis! {
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
||||
|
||||
use pallet_session_benchmarking::Pallet as SessionBench;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
impl pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
@@ -813,6 +816,7 @@ impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
||||
add_benchmark!(params, batches, pallet_multisig, Multisig);
|
||||
add_benchmark!(params, batches, pallet_proxy, Proxy);
|
||||
add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
|
||||
add_benchmark!(params, batches, pallet_utility, Utility);
|
||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
||||
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
|
||||
|
||||
@@ -3,5 +3,6 @@ pub mod pallet_balances;
|
||||
pub mod pallet_multisig;
|
||||
pub mod pallet_collator_selection;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
//! Autogenerated weights for pallet_session
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||
//! DATE: 2021-06-08, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// ./target/release/polkadot-collator
|
||||
// benchmark
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_session
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --raw
|
||||
// --output=./polkadot-parachains/statemint-runtime/src/weights
|
||||
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for pallet_session.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
|
||||
fn set_keys() -> Weight {
|
||||
(25_040_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn purge_keys() -> Weight {
|
||||
(17_551_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user