Fix broken benchmarking (#167)

main
Alexander Koz 2021-04-15 13:53:36 +03:00 committed by GitHub
parent 0a0a91d578
commit fc9d24c429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View File

@ -37,3 +37,8 @@ jobs:
- name: Check Build - name: Check Build
run: | run: |
SKIP_WASM_BUILD=1 cargo check --release SKIP_WASM_BUILD=1 cargo check --release
- name: Check Build for Benchmarking
run: >
pushd node &&
cargo check --features=runtime-benchmarks --release

3
Cargo.lock generated
View File

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3
[[package]] [[package]]
name = "Inflector" name = "Inflector"
version = "0.11.4" version = "0.11.4"
@ -3858,6 +3860,7 @@ dependencies = [
"sp-core", "sp-core",
"sp-io", "sp-io",
"sp-runtime", "sp-runtime",
"sp-std",
] ]
[[package]] [[package]]

View File

@ -17,6 +17,7 @@ codec = { default-features = false, features = ['derive'], package = 'parity-sca
frame-system = { default-features = false, version = '3.0.0' } frame-system = { default-features = false, version = '3.0.0' }
frame-support = { default-features = false, version = '3.0.0' } frame-support = { default-features = false, version = '3.0.0' }
frame-benchmarking = { default-features = false, optional = true, version = '3.1.0' } frame-benchmarking = { default-features = false, optional = true, version = '3.1.0' }
sp-std = { default-features = false, version = '3.0.0' }
[dev-dependencies] [dev-dependencies]
serde = { version = "1.0.119" } serde = { version = "1.0.119" }
@ -31,8 +32,13 @@ std = [
'frame-support/std', 'frame-support/std',
'frame-system/std', 'frame-system/std',
'frame-benchmarking/std', 'frame-benchmarking/std',
'sp-std/std',
]
runtime-benchmarks = [
'frame-benchmarking',
'frame-support/runtime-benchmarks',
'frame-system/runtime-benchmarks',
] ]
runtime-benchmarks = ['frame-benchmarking']
# Note: frame-support `try-runtime` feature is released after v3. # Note: frame-support `try-runtime` feature is released after v3.
# Uncomment the following line when `frame-support` version > `3.0.0`. # Uncomment the following line when `frame-support` version > `3.0.0`.
# try-runtime = ['frame-support/try-runtime'] # try-runtime = ['frame-support/try-runtime']

View File

@ -4,6 +4,8 @@ use super::*;
use frame_system::RawOrigin; use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, whitelisted_caller, impl_benchmark_test_suite}; use frame_benchmarking::{benchmarks, whitelisted_caller, impl_benchmark_test_suite};
use sp_std::{vec, vec::Vec, boxed::Box};
#[allow(unused)] #[allow(unused)]
use crate::Module as Template; use crate::Module as Template;

View File

@ -460,7 +460,7 @@ impl_runtime_apis! {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> { ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
use frame_system_benchmarking::Pallet as SystemBench; use frame_system_benchmarking::Module as SystemBench;
impl frame_system_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {}
let whitelist: Vec<TrackedStorageKey> = vec![ let whitelist: Vec<TrackedStorageKey> = vec![