Skip to content

Commit 2cb0d28

Browse files
authored
Merge branch 'develop' into weights (#235)
1 parent c875b66 commit 2cb0d28

File tree

7 files changed

+185
-2
lines changed

7 files changed

+185
-2
lines changed

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ frame-executive = { git = "https://github.com/paritytech/substrate", branch = "p
9797
frame-metadata = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
9898
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
9999
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
100+
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
100101
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
101102
max-encoded-len = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
102103
pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }

runtime/bifrost/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ frame-benchmarking = { version = "3.0.0", default-features = false, optional = t
3232
frame-executive = { version = "3.0.0", default-features = false }
3333
frame-support = { version = "3.0.0", default-features = false }
3434
frame-system = { version = "3.0.0", default-features = false }
35+
frame-system-benchmarking = { version = "3.0.0", default-features = false, optional = true }
3536
frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false }
3637
frame-try-runtime = { version = "0.9.0", default-features = false, optional = true }
3738
pallet-aura = { version = "3.0.0", default-features = false }
@@ -141,6 +142,7 @@ with-tracing = ["frame-executive/with-tracing"]
141142

142143
runtime-benchmarks = [
143144
"frame-benchmarking",
145+
"frame-system-benchmarking",
144146
"frame-support/runtime-benchmarks",
145147
"frame-system/runtime-benchmarks",
146148
"pallet-balances/runtime-benchmarks",

runtime/bifrost/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl frame_system::Config for Runtime {
208208
/// Converts a module to an index of this module in the runtime.
209209
type PalletInfo = PalletInfo;
210210
type SS58Prefix = SS58Prefix;
211-
type SystemWeightInfo = ();
211+
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
212212
/// Runtime version.
213213
type Version = Version;
214214
}
@@ -575,7 +575,7 @@ impl orml_tokens::Config for Runtime {
575575
type ExistentialDeposits = ExistentialDeposits;
576576
type MaxLocks = MaxLocks;
577577
type OnDust = orml_tokens::TransferDust<Runtime, BifrostTreasuryAccount>;
578-
type WeightInfo = ();
578+
type WeightInfo = weights::orml_tokens::WeightInfo<Runtime>;
579579
}
580580

581581
// orml runtime end
@@ -839,6 +839,9 @@ impl_runtime_apis! {
839839
config: frame_benchmarking::BenchmarkConfig
840840
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
841841
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
842+
use frame_system_benchmarking::Pallet as SystemBench;
843+
844+
impl frame_system_benchmarking::Config for Runtime {}
842845

843846
let whitelist: Vec<TrackedStorageKey> = vec![
844847
// you can whitelist any storage keys you do not want to track here
@@ -848,6 +851,7 @@ impl_runtime_apis! {
848851
let params = (&config, &whitelist);
849852

850853
// Adding the pallet you will perform thee benchmarking
854+
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
851855
add_benchmark!(params, batches, pallet_balances, Balances);
852856
// add_benchmark!(params, batches, pallet_bounties, Bounties);
853857
add_benchmark!(params, batches, pallet_indices, Indices);
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// This file is part of Bifrost.
2+
3+
// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5+
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU General Public License as published by
8+
// the Free Software Foundation, either version 3 of the License, or
9+
// (at your option) any later version.
10+
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU General Public License for more details.
15+
16+
// You should have received a copy of the GNU General Public License
17+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
19+
//! Autogenerated weights for frame_system
20+
//!
21+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
22+
//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
23+
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128
24+
25+
// Executed Command:
26+
// target/debug/bifrost
27+
// benchmark
28+
// --chain=bifrost-genesis
29+
// --steps=50
30+
// --repeat=20
31+
// --pallet=frame_system
32+
// --extrinsic=*
33+
// --execution=wasm
34+
// --wasm-execution=compiled
35+
// --heap-pages=4096
36+
// --header=./HEADER-GPL3
37+
// --output=./runtime/bifrost/src/weights/
38+
39+
#![allow(unused_parens)]
40+
#![allow(unused_imports)]
41+
42+
use frame_support::{traits::Get, weights::Weight};
43+
use sp_std::marker::PhantomData;
44+
45+
/// Weight functions for frame_system.
46+
pub struct WeightInfo<T>(PhantomData<T>);
47+
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
48+
fn remark(_b: u32) -> Weight {
49+
(51_052_000 as Weight)
50+
}
51+
fn remark_with_event(b: u32) -> Weight {
52+
(1_623_480_000 as Weight)
53+
// Standard Error: 0
54+
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
55+
.saturating_add(T::DbWeight::get().reads(4 as Weight))
56+
.saturating_add(T::DbWeight::get().writes(2 as Weight))
57+
}
58+
fn set_heap_pages() -> Weight {
59+
(73_328_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
60+
}
61+
fn set_changes_trie_config() -> Weight {
62+
(373_044_000 as Weight)
63+
.saturating_add(T::DbWeight::get().reads(1 as Weight))
64+
.saturating_add(T::DbWeight::get().writes(2 as Weight))
65+
}
66+
fn set_storage(i: u32) -> Weight {
67+
(358_763_000 as Weight)
68+
// Standard Error: 311_000
69+
.saturating_add((27_904_000 as Weight).saturating_mul(i as Weight))
70+
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
71+
}
72+
fn kill_storage(i: u32) -> Weight {
73+
(0 as Weight)
74+
// Standard Error: 242_000
75+
.saturating_add((24_201_000 as Weight).saturating_mul(i as Weight))
76+
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
77+
}
78+
fn kill_prefix(p: u32) -> Weight {
79+
(1_234_472_000 as Weight)
80+
// Standard Error: 531_000
81+
.saturating_add((45_655_000 as Weight).saturating_mul(p as Weight))
82+
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
83+
}
84+
}

runtime/bifrost/src/weights/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
2121
//! A list of the different weight modules for our runtime.
2222
23+
pub mod frame_system;
24+
pub mod orml_tokens;
2325
pub mod pallet_balances;
2426
pub mod pallet_bounties;
2527
pub mod pallet_indices;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// This file is part of Bifrost.
2+
3+
// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5+
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU General Public License as published by
8+
// the Free Software Foundation, either version 3 of the License, or
9+
// (at your option) any later version.
10+
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU General Public License for more details.
15+
16+
// You should have received a copy of the GNU General Public License
17+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
19+
//! Autogenerated weights for pallet_balances
20+
//!
21+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
22+
//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
23+
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128
24+
25+
// Executed Command:
26+
// target/release/bifrost
27+
// benchmark
28+
// --chain=bifrost-genesis
29+
// --steps=50
30+
// --repeat=20
31+
// --pallet=orml_tokens
32+
// --extrinsic=*
33+
// --execution=wasm
34+
// --wasm-execution=compiled
35+
// --heap-pages=4096
36+
// --header=./HEADER-GPL3
37+
// --output=./runtime/bifrost/src/weights/
38+
39+
40+
#![cfg_attr(rustfmt, rustfmt_skip)]
41+
#![allow(unused_parens)]
42+
#![allow(unused_imports)]
43+
44+
use frame_support::{traits::Get, weights::Weight};
45+
use sp_std::marker::PhantomData;
46+
47+
/// Weight functions for orml_tokens.
48+
pub struct WeightInfo<T>(PhantomData<T>);
49+
impl<T: frame_system::Config> orml_tokens::WeightInfo for WeightInfo<T> {
50+
fn transfer() -> Weight {
51+
(119_078_000 as Weight)
52+
.saturating_add(T::DbWeight::get().reads(5 as Weight))
53+
.saturating_add(T::DbWeight::get().writes(4 as Weight))
54+
}
55+
fn transfer_all() -> Weight {
56+
(123_199_000 as Weight)
57+
.saturating_add(T::DbWeight::get().reads(5 as Weight))
58+
.saturating_add(T::DbWeight::get().writes(4 as Weight))
59+
}
60+
fn transfer_keep_alive() -> Weight {
61+
(119_078_000 as Weight)
62+
.saturating_add(T::DbWeight::get().reads(5 as Weight))
63+
.saturating_add(T::DbWeight::get().writes(4 as Weight))
64+
}
65+
fn force_transfer() -> Weight {
66+
(119_078_000 as Weight)
67+
.saturating_add(T::DbWeight::get().reads(5 as Weight))
68+
.saturating_add(T::DbWeight::get().writes(4 as Weight))
69+
}
70+
fn set_balance() -> Weight {
71+
(119_078_000 as Weight)
72+
.saturating_add(T::DbWeight::get().reads(5 as Weight))
73+
.saturating_add(T::DbWeight::get().writes(4 as Weight))
74+
}
75+
}

0 commit comments

Comments
 (0)