Skip to content

Commit

Permalink
Test works
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Aug 6, 2021
1 parent 74523df commit 0079498
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ dev = [

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

runtime-benchmarks = [
"darwinia-cli/runtime-benchmarks",
]

runtime-benchmarks = ["darwinia-cli/runtime-benchmarks"]

[workspace]
members = [
Expand Down
4 changes: 3 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ darwinia-cli = { optional = true, git = "https://github.com/darwinia-network/dar
darwinia-service = { default-features = false, path = "../node/service" }
# substrate client
sc-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
"frame-benchmarking-cli" = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
sc-client-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
sc-executor = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
sc-network = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
sc-service = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
sc-tracing = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
try-runtime-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
# benchmark
frame-benchmarking-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
# substrate primitives
sp-core = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
# this crate is used only to enable `trie-memory-tracker` feature
Expand Down Expand Up @@ -78,4 +79,5 @@ try-runtime = [

runtime-benchmarks = [
"frame-benchmarking-cli",
"darwinia-service/runtime-benchmarks",
]
4 changes: 3 additions & 1 deletion cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,12 @@ pub fn run() -> sc_cli::Result<()> {
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;

if chain_spec.is_crab() {
runner.sync_run(|config| cmd.run::<crab_runtime::Block, CrabExecutor>(config))
} else if chain_spec.is_darwinia() {
todo!()
runner
.sync_run(|config| cmd.run::<darwinia_runtime::Block, DarwiniaExecutor>(config))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down
17 changes: 17 additions & 0 deletions file_header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file is part of Darwinia.
//
// Copyright (C) 2018-2021 Darwinia Network
// SPDX-License-Identifier: GPL-3.0
//
// Darwinia 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.
//
// Darwinia 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 Darwinia. If not, see <https://www.gnu.org/licenses/>.
2 changes: 0 additions & 2 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ sc-telemetry = { git = "https://github.com/darwinia-network/substrate.
sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
# substrate frame
frame-benchmarking = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-benchmarking-cli = { optional = true, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
pallet-im-online = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
Expand Down Expand Up @@ -96,7 +95,6 @@ try-runtime = [
]

runtime-benchmarks = [
"frame-benchmarking-cli",
"crab-runtime/runtime-benchmarks",
"darwinia-runtime/runtime-benchmarks",
]
1 change: 0 additions & 1 deletion runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ std = [
"dvm-dynamic-fee/std",
"dvm-rpc-runtime-api/std",
# --- dvm --->
"frame-benchmarking/std",
"frame-executive/std",
"frame-support/std",
"frame-system/std",
Expand Down
1 change: 1 addition & 0 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ sp_api::impl_runtime_apis! {
let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);


add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Expand Down
7 changes: 3 additions & 4 deletions runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ darwinia-support = { default-features = false, git = "https:/
darwinia-treasury = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
darwinia-tron-backing = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
darwinia-vesting = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
frame-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-system-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
# darwinia primitives
darwinia-primitives = { default-features = false, path = "../../primitives" }
ethereum-primitives = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", tag = "darwinia-v0.11.2" }
# darwinia runtime
darwinia-runtime-common = { default-features = false, path = "../common" }
# substrate frame
frame-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-system-benchmarking = { optional=true, default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-executive = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-support = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
frame-system = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.2" }
Expand Down Expand Up @@ -120,7 +120,6 @@ std = [
"darwinia-runtime-common/std",
"frame-executive/std",
"frame-support/std",
"frame-benchmarking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"frame-try-runtime/std",
Expand Down Expand Up @@ -180,8 +179,8 @@ on-chain-release-build = [
runtime-benchmarks = [
"frame-benchmarking",
"frame-system-benchmarking",
"frame-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-society/runtime-benchmarks",
]

0 comments on commit 0079498

Please sign in to comment.