Skip to content

Commit 1032fb7

Browse files
Test works
1 parent 74523df commit 1032fb7

File tree

10 files changed

+76
-21
lines changed

10 files changed

+76
-21
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ dev = [
3333

3434
try-runtime = ["darwinia-cli/try-runtime"]
3535

36-
runtime-benchmarks = [
37-
"darwinia-cli/runtime-benchmarks",
38-
]
39-
36+
runtime-benchmarks = ["darwinia-cli/runtime-benchmarks"]
4037

4138
[workspace]
4239
members = [

cli/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ darwinia-cli = { optional = true, git = "https://github.com/darwinia-network/dar
2929
darwinia-service = { default-features = false, path = "../node/service" }
3030
# substrate client
3131
sc-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
32-
"frame-benchmarking-cli" = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3332
sc-client-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3433
sc-executor = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3534
sc-network = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3635
sc-service = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3736
sc-tracing = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3837
try-runtime-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
38+
# benchmark
39+
frame-benchmarking-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
3940
# substrate primitives
4041
sp-core = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
4142
# this crate is used only to enable `trie-memory-tracker` feature
@@ -78,4 +79,5 @@ try-runtime = [
7879

7980
runtime-benchmarks = [
8081
"frame-benchmarking-cli",
82+
"darwinia-service/runtime-benchmarks",
8183
]

cli/src/command.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,12 @@ pub fn run() -> sc_cli::Result<()> {
414414
Some(Subcommand::Benchmark(cmd)) => {
415415
let runner = cli.create_runner(cmd)?;
416416
let chain_spec = &runner.config().chain_spec;
417+
417418
if chain_spec.is_crab() {
418419
runner.sync_run(|config| cmd.run::<crab_runtime::Block, CrabExecutor>(config))
419420
} else if chain_spec.is_darwinia() {
420-
todo!()
421+
runner
422+
.sync_run(|config| cmd.run::<darwinia_runtime::Block, DarwiniaExecutor>(config))
421423
} else {
422424
Err("Benchmarking wasn't enabled when building the node. \
423425
You can enable it with `--features runtime-benchmarks`."

file_header.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This file is part of Darwinia.
2+
//
3+
// Copyright (C) 2018-2021 Darwinia Network
4+
// SPDX-License-Identifier: GPL-3.0
5+
//
6+
// Darwinia 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+
// Darwinia 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 Darwinia. If not, see <https://www.gnu.org/licenses/>.

node/service/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ sc-telemetry = { git = "https://github.com/darwinia-network/substrate.
5252
sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
5353
# substrate frame
5454
frame-benchmarking = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
55-
frame-benchmarking-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
5655
frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
5756
pallet-im-online = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
5857
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
@@ -96,7 +95,6 @@ try-runtime = [
9695
]
9796

9897
runtime-benchmarks = [
99-
"frame-benchmarking-cli",
10098
"crab-runtime/runtime-benchmarks",
10199
"darwinia-runtime/runtime-benchmarks",
102100
]

runtime/crab/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ std = [
138138
"dvm-dynamic-fee/std",
139139
"dvm-rpc-runtime-api/std",
140140
# --- dvm --->
141-
"frame-benchmarking/std",
142141
"frame-executive/std",
143142
"frame-support/std",
144143
"frame-system/std",

runtime/crab/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ sp_api::impl_runtime_apis! {
659659
let mut batches = Vec::<BenchmarkBatch>::new();
660660
let params = (&config, &whitelist);
661661

662+
662663
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
663664

664665
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
+48-7
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,81 @@
1+
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
2+
// This file is part of Polkadot.
3+
4+
// Polkadot is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Polkadot is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
16+
//! Autogenerated weights for frame_system
17+
//!
18+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
19+
//! DATE: 2021-08-06, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
20+
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-dev"), DB CACHE: 128
21+
22+
// Executed Command:
23+
// ./target/release/darwinia
24+
// benchmark
25+
// --chain=crab-dev
26+
// --steps=50
27+
// --repeat=20
28+
// --pallet=frame_system
29+
// --extrinsic=*
30+
// --execution=wasm
31+
// --wasm-execution=compiled
32+
// --heap-pages=4096
33+
// --header=./file_header.txt
34+
// --output=./runtime/crab/src/weights/
35+
136
#![allow(unused_parens)]
237
#![allow(unused_imports)]
338

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

42+
/// Weight functions for frame_system.
743
pub struct WeightInfo<T>(PhantomData<T>);
844
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
945
fn remark(_b: u32) -> Weight {
10-
(1_815_000 as Weight)
46+
(1_058_000 as Weight)
1147
}
1248
fn remark_with_event(b: u32) -> Weight {
13-
(9_697_000 as Weight)
49+
(0 as Weight)
1450
// Standard Error: 0
1551
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
52+
.saturating_add(T::DbWeight::get().reads(4 as Weight))
53+
.saturating_add(T::DbWeight::get().writes(2 as Weight))
1654
}
1755
fn set_heap_pages() -> Weight {
18-
(2_463_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
56+
(1_724_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
1957
}
2058
fn set_changes_trie_config() -> Weight {
21-
(11_280_000 as Weight)
59+
(9_478_000 as Weight)
2260
.saturating_add(T::DbWeight::get().reads(1 as Weight))
2361
.saturating_add(T::DbWeight::get().writes(2 as Weight))
2462
}
2563
fn set_storage(i: u32) -> Weight {
2664
(0 as Weight)
27-
.saturating_add((821_000 as Weight).saturating_mul(i as Weight))
65+
// Standard Error: 1_000
66+
.saturating_add((669_000 as Weight).saturating_mul(i as Weight))
2867
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
2968
}
3069
fn kill_storage(i: u32) -> Weight {
3170
(0 as Weight)
32-
.saturating_add((549_000 as Weight).saturating_mul(i as Weight))
71+
// Standard Error: 1_000
72+
.saturating_add((481_000 as Weight).saturating_mul(i as Weight))
3373
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
3474
}
3575
fn kill_prefix(p: u32) -> Weight {
3676
(0 as Weight)
37-
.saturating_add((872_000 as Weight).saturating_mul(p as Weight))
77+
// Standard Error: 9_000
78+
.saturating_add((1_019_000 as Weight).saturating_mul(p as Weight))
3879
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
3980
}
4081
}

runtime/darwinia/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ darwinia-support = { default-features = false, git = "https:/
3636
darwinia-treasury = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
3737
darwinia-tron-backing = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
3838
darwinia-vesting = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
39-
frame-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
40-
frame-system-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
4139
# darwinia primitives
4240
darwinia-primitives = { default-features = false, path = "../../primitives" }
4341
ethereum-primitives = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
4442
# darwinia runtime
4543
darwinia-runtime-common = { default-features = false, path = "../common" }
4644
# substrate frame
45+
frame-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
46+
frame-system-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
4747
frame-executive = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
4848
frame-support = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
4949
frame-system = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
@@ -120,7 +120,6 @@ std = [
120120
"darwinia-runtime-common/std",
121121
"frame-executive/std",
122122
"frame-support/std",
123-
"frame-benchmarking/std",
124123
"frame-system/std",
125124
"frame-system-rpc-runtime-api/std",
126125
"frame-try-runtime/std",
@@ -180,8 +179,8 @@ on-chain-release-build = [
180179
runtime-benchmarks = [
181180
"frame-benchmarking",
182181
"frame-system-benchmarking",
183-
"frame-system/runtime-benchmarks",
184182
"frame-support/runtime-benchmarks",
183+
"frame-system/runtime-benchmarks",
185184
"pallet-collective/runtime-benchmarks",
186185
"pallet-society/runtime-benchmarks",
187186
]

0 commit comments

Comments
 (0)