Skip to content

Commit

Permalink
Chore: update weight (#1899)
Browse files Browse the repository at this point in the history
* benchmark pallet_assets

* add benchmark to parallel

* add to heiko

* fix

* bench

* fix

* add benchmark

* bench

* bench2

* apply weight to parallel

* apply weight to heiko

* fix error

* bench3
  • Loading branch information
mclyk authored Oct 21, 2022
1 parent 2b0e61e commit 42141b7
Show file tree
Hide file tree
Showing 61 changed files with 4,009 additions and 989 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration-tests/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl ExtBuilder {

pub fn heiko_build(self) -> sp_io::TestExternalities {
use heiko_runtime::{
AssetRegistry, Assets, LiquidStaking, Loans, Origin, Runtime, System, XcmHelper,
AssetRegistry, Assets, LiquidStaking, Loans, Origin, System, XcmHelper,
};
use paras::statemine::{ID as StatemineChainId, PALLET_INSTANCE as StatemineAssetInstance};
let mut ext = sp_io::TestExternalities::new(self.init());
Expand Down
11 changes: 11 additions & 0 deletions runtime/heiko/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ runtime-benchmarks = [
'pallet-farming/runtime-benchmarks',
'pallet-asset-registry/runtime-benchmarks',
'pallet-streaming/runtime-benchmarks',
'pallet-assets/runtime-benchmarks',
'pallet-collator-selection/runtime-benchmarks',
'pallet-proxy/runtime-benchmarks',
'pallet-utility/runtime-benchmarks',
'cumulus-pallet-xcmp-queue/runtime-benchmarks',
'pallet-identity/runtime-benchmarks',
'pallet-democracy/runtime-benchmarks',
'pallet-collective/runtime-benchmarks',
'pallet-preimage/runtime-benchmarks',
'pallet-scheduler/runtime-benchmarks',
'pallet-treasury/runtime-benchmarks',
]
std = [
'codec/std',
Expand Down
48 changes: 35 additions & 13 deletions runtime/heiko/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ impl pallet_assets::Config for Runtime {
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type WeightInfo = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type Extra = ();
}

Expand Down Expand Up @@ -839,7 +839,7 @@ impl pallet_proxy::Config for Runtime {
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
Expand All @@ -850,7 +850,7 @@ impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type PalletsOrigin = OriginCaller;
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
}

/// Local origins on this chain are allowed to dispatch XCM sends/executions. However, we later
Expand Down Expand Up @@ -898,7 +898,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type VersionWrapper = PolkadotXcm;
type ControllerOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
Expand Down Expand Up @@ -1143,7 +1143,7 @@ impl orml_oracle::Config<ParallelDataProvider> for Runtime {
type OracleValue = Price;
type RootOperatorAccountId = OneAccount;
type MaxHasDispatchedSize = MaxHasDispatchedSize;
type WeightInfo = ();
type WeightInfo = weights::orml_oracle::WeightInfo<Runtime>;
type Members = OracleMembership;
}

Expand Down Expand Up @@ -1244,7 +1244,7 @@ impl pallet_identity::Config for Runtime {
type Slashed = Treasury;
type ForceOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
type RegistrarOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
}

type EnsureRootOrMoreThanHalfGeneralCouncil = EitherOfDiverse<
Expand Down Expand Up @@ -1313,7 +1313,7 @@ impl pallet_democracy::Config for Runtime {
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_democracy::WeightInfo<Runtime>;
type MaxProposals = MaxProposals;
type VoteLockingPeriod = EnactmentPeriod;
}
Expand Down Expand Up @@ -1347,7 +1347,7 @@ impl pallet_membership::Config<GeneralCouncilMembershipInstance> for Runtime {
type MembershipInitialized = GeneralCouncil;
type MembershipChanged = GeneralCouncil;
type MaxMembers = GeneralCouncilMaxMembers;
type WeightInfo = pallet_membership::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1379,7 +1379,7 @@ impl pallet_membership::Config<TechnicalCommitteeMembershipInstance> for Runtime
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalMaxMembers;
type WeightInfo = pallet_membership::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>;
}

parameter_types! {
Expand All @@ -1389,7 +1389,7 @@ parameter_types! {
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type Event = Event;
type Currency = Balances;
type ManagerOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
Expand All @@ -1413,7 +1413,7 @@ impl pallet_scheduler::Config for Runtime {
type ScheduleOrigin = EnsureRootOrMoreThanHalfGeneralCouncil;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
type PreimageProvider = Preimage;
type NoPreimagePostponement = NoPreimagePostponement;
}
Expand Down Expand Up @@ -1442,7 +1442,7 @@ impl pallet_treasury::Config for Runtime {
type Burn = Burn;
type BurnDestination = ();
type SpendFunds = ();
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type MaxApprovals = MaxApprovals;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
}
Expand Down Expand Up @@ -1539,7 +1539,7 @@ impl orml_vesting::Config for Runtime {
type Currency = Balances;
type MinVestedTransfer = MinVestedTransfer;
type VestedTransferOrigin = frame_system::EnsureSigned<AccountId>;
type WeightInfo = ();
type WeightInfo = weights::orml_vesting::WeightInfo<Runtime>;
type MaxVestingSchedules = MaxVestingSchedules;
type BlockNumberProvider = frame_system::Pallet<Runtime>;
}
Expand Down Expand Up @@ -2015,6 +2015,17 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_farming, Farming);
list_benchmark!(list, extra, pallet_asset_registry, AssetRegistry);
list_benchmark!(list, extra, pallet_streaming, Streaming);
list_benchmark!(list, extra, pallet_assets, Assets);
list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
list_benchmark!(list, extra, pallet_proxy, Proxy);
list_benchmark!(list, extra, pallet_utility, Utility);
list_benchmark!(list, extra, cumulus_pallet_xcmp_queue, XcmpQueue);
list_benchmark!(list, extra, pallet_identity, Identity);
list_benchmark!(list, extra, pallet_democracy, Democracy);
list_benchmark!(list, extra, pallet_collective, TechnicalCommittee);
list_benchmark!(list, extra, pallet_preimage, Preimage);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, pallet_treasury, Treasury);

let storage_info = AllPalletsWithSystem::storage_info();

Expand Down Expand Up @@ -2063,6 +2074,17 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_farming, Farming);
add_benchmark!(params, batches, pallet_asset_registry, AssetRegistry);
add_benchmark!(params, batches, pallet_streaming, Streaming);
add_benchmark!(params, batches, pallet_assets, Assets);
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
add_benchmark!(params, batches, pallet_proxy, Proxy);
add_benchmark!(params, batches, pallet_utility, Utility);
add_benchmark!(params, batches, cumulus_pallet_xcmp_queue, XcmpQueue);
add_benchmark!(params, batches, pallet_identity, Identity);
add_benchmark!(params, batches, pallet_democracy, Democracy);
add_benchmark!(params, batches, pallet_collective, TechnicalCommittee);
add_benchmark!(params, batches, pallet_preimage, Preimage);
add_benchmark!(params, batches, pallet_scheduler, Scheduler);
add_benchmark!(params, batches, pallet_treasury, Treasury);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
Expand Down
44 changes: 44 additions & 0 deletions runtime/heiko/src/weights/cumulus_pallet_xcmp_queue.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/parallel
// benchmark
// pallet
// --chain=heiko-dev
// --execution=wasm
// --wasm-execution=compiled
// --pallet=cumulus_pallet_xcmp_queue
// --extrinsic=*
// --steps=50
// --repeat=20
// --output=./runtime/heiko/src/weights/cumulus_pallet_xcmp_queue.rs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `cumulus_pallet_xcmp_queue`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
// Storage: XcmpQueue QueueConfig (r:1 w:1)
fn set_config_with_u32() -> Weight {
(10_012_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: XcmpQueue QueueConfig (r:1 w:1)
fn set_config_with_weight() -> Weight {
(10_079_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
30 changes: 19 additions & 11 deletions runtime/heiko/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-05-30, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-10-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `ip-172-88-3-164`, CPU: `Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("heiko-dev"), DB CACHE: 1024
// Executed Command:
Expand All @@ -28,40 +29,47 @@ use sp_std::marker::PhantomData;
/// Weight functions for `frame_system`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
fn remark(_b: u32, ) -> Weight {
(158_000 as Weight)
/// The range of component `b` is `[0, 3932160]`.
fn remark(b: u32, ) -> Weight {
(3_703_000 as Weight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
(27_206_000 as Weight)
(0 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
}
// Storage: System Digest (r:1 w:1)
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
fn set_heap_pages() -> Weight {
(8_468_000 as Weight)
(9_860_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
fn set_storage(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 1_000
.saturating_add((1_051_000 as Weight).saturating_mul(i as Weight))
.saturating_add((1_021_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
fn kill_storage(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 1_000
.saturating_add((756_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 2_000
.saturating_add((799_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `p` is `[1, 1000]`.
fn kill_prefix(p: u32, ) -> Weight {
(3_952_000 as Weight)
// Standard Error: 1_000
.saturating_add((1_484_000 as Weight).saturating_mul(p as Weight))
(0 as Weight)
// Standard Error: 2_000
.saturating_add((1_572_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
}
11 changes: 11 additions & 0 deletions runtime/heiko/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ pub mod pallet_router;
pub mod pallet_streaming;
pub mod pallet_timestamp;
pub mod pallet_xcm_helper;
pub mod cumulus_pallet_xcmp_queue;
pub mod orml_oracle;
pub mod orml_vesting;
pub mod pallet_assets;
pub mod pallet_democracy;
pub mod pallet_identity;
pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_scheduler;
pub mod pallet_treasury;
pub mod pallet_utility;
70 changes: 70 additions & 0 deletions runtime/heiko/src/weights/orml_oracle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// This file is part of Parallel.

// Copyright (C) 2020-2022 Parallel Foundation.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Autogenerated weights for orml_oracle
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("parallel-dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/parallel
// benchmark
// pallet
// --chain=parallel-dev
// --steps=50
// --repeat=20
// --pallet=*
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --template=./templates/runtime-weight-template.hbs
// --output=./runtime/parallel/src/weights/

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for orml_oracle.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> orml_oracle::WeightInfo for WeightInfo<T> {
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: ParallelOracle HasDispatched (r:1 w:1)
// Storage: Timestamp Now (r:1 w:0)
// Storage: OperatorMembershipParallel Members (r:1 w:0)
// Storage: ParallelOracle Values (r:1 w:0)
// Storage: ParallelOracle RawValues (r:0 w:1)
fn feed_values(c: u32, ) -> Weight {
(18_441_000 as Weight)
// Standard Error: 88_000
.saturating_add((6_603_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
}
// Storage: ParallelOracle HasDispatched (r:0 w:1)
fn on_finalize() -> Weight {
(3_578_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
Loading

0 comments on commit 42141b7

Please sign in to comment.