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

add orml_tokens and frame_system weight #235

Merged
merged 1 commit into from
Aug 19, 2021
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
15 changes: 15 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ frame-executive = { git = "https://github.com/paritytech/substrate", branch = "p
frame-metadata = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
max-encoded-len = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
Expand Down
2 changes: 2 additions & 0 deletions runtime/bifrost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ frame-benchmarking = { version = "3.0.0", default-features = false, optional = t
frame-executive = { version = "3.0.0", default-features = false }
frame-support = { version = "3.0.0", default-features = false }
frame-system = { version = "3.0.0", default-features = false }
frame-system-benchmarking = { version = "3.0.0", default-features = false, optional = true }
frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false }
frame-try-runtime = { version = "0.9.0", default-features = false, optional = true }
pallet-aura = { version = "3.0.0", default-features = false }
Expand Down Expand Up @@ -139,6 +140,7 @@ with-tracing = ["frame-executive/with-tracing"]

runtime-benchmarks = [
"frame-benchmarking",
"frame-system-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
Expand Down
8 changes: 6 additions & 2 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl frame_system::Config for Runtime {
/// Converts a module to an index of this module in the runtime.
type PalletInfo = PalletInfo;
type SS58Prefix = SS58Prefix;
type SystemWeightInfo = ();
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
/// Runtime version.
type Version = Version;
}
Expand Down Expand Up @@ -560,7 +560,7 @@ impl orml_tokens::Config for Runtime {
type ExistentialDeposits = ExistentialDeposits;
type MaxLocks = MaxLocks;
type OnDust = orml_tokens::TransferDust<Runtime, BifrostTreasuryAccount>;
type WeightInfo = ();
type WeightInfo = weights::orml_tokens::WeightInfo<Runtime>;
}

// orml runtime end
Expand Down Expand Up @@ -824,6 +824,9 @@ impl_runtime_apis! {
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
use frame_system_benchmarking::Pallet as SystemBench;

impl frame_system_benchmarking::Config for Runtime {}

let whitelist: Vec<TrackedStorageKey> = vec![
// you can whitelist any storage keys you do not want to track here
Expand All @@ -833,6 +836,7 @@ impl_runtime_apis! {
let params = (&config, &whitelist);

// Adding the pallet you will perform thee benchmarking
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
add_benchmark!(params, batches, pallet_balances, Balances);
// add_benchmark!(params, batches, pallet_bounties, Bounties);
add_benchmark!(params, batches, pallet_indices, Indices);
Expand Down
84 changes: 84 additions & 0 deletions runtime/bifrost/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// This file is part of Bifrost.

// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd.
// 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 frame_system
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128

// Executed Command:
// target/debug/bifrost
// benchmark
// --chain=bifrost-genesis
// --steps=50
// --repeat=20
// --pallet=frame_system
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./HEADER-GPL3
// --output=./runtime/bifrost/src/weights/

#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
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 {
(51_052_000 as Weight)
}
fn remark_with_event(b: u32) -> Weight {
(1_623_480_000 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn set_heap_pages() -> Weight {
(73_328_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_changes_trie_config() -> Weight {
(373_044_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn set_storage(i: u32) -> Weight {
(358_763_000 as Weight)
// Standard Error: 311_000
.saturating_add((27_904_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_storage(i: u32) -> Weight {
(0 as Weight)
// Standard Error: 242_000
.saturating_add((24_201_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_prefix(p: u32) -> Weight {
(1_234_472_000 as Weight)
// Standard Error: 531_000
.saturating_add((45_655_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
}
2 changes: 2 additions & 0 deletions runtime/bifrost/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

//! A list of the different weight modules for our runtime.

pub mod frame_system;
pub mod orml_tokens;
pub mod pallet_balances;
pub mod pallet_bounties;
pub mod pallet_indices;
Expand Down
75 changes: 75 additions & 0 deletions runtime/bifrost/src/weights/orml_tokens.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// This file is part of Bifrost.

// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd.
// 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 pallet_balances
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128

// Executed Command:
// target/release/bifrost
// benchmark
// --chain=bifrost-genesis
// --steps=50
// --repeat=20
// --pallet=orml_tokens
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./HEADER-GPL3
// --output=./runtime/bifrost/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_tokens.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> orml_tokens::WeightInfo for WeightInfo<T> {
fn transfer() -> Weight {
(119_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn transfer_all() -> Weight {
(123_199_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn transfer_keep_alive() -> Weight {
(119_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn force_transfer() -> Weight {
(119_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn set_balance() -> Weight {
(119_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
}