diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 33c494c..219cfeb 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,6 +1,6 @@ name: Check Set-Up & Build -# Controls when the action will run. +# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch push: @@ -37,3 +37,8 @@ jobs: - name: Check Build run: | SKIP_WASM_BUILD=1 cargo check --release + + - name: Check Build for Benchmarking + run: > + pushd node && + cargo check --features=runtime-benchmarks --release diff --git a/Cargo.lock b/Cargo.lock index d38bead..658e1ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "Inflector" version = "0.11.4" @@ -3858,6 +3860,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "sp-std", ] [[package]] diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 6d581e9..4670af9 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -17,6 +17,7 @@ codec = { default-features = false, features = ['derive'], package = 'parity-sca frame-system = { 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' } +sp-std = { default-features = false, version = '3.0.0' } [dev-dependencies] serde = { version = "1.0.119" } @@ -31,8 +32,13 @@ std = [ 'frame-support/std', 'frame-system/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. # Uncomment the following line when `frame-support` version > `3.0.0`. # try-runtime = ['frame-support/try-runtime'] diff --git a/pallets/template/src/benchmarking.rs b/pallets/template/src/benchmarking.rs index 5296ed7..52f33b7 100644 --- a/pallets/template/src/benchmarking.rs +++ b/pallets/template/src/benchmarking.rs @@ -4,6 +4,8 @@ use super::*; use frame_system::RawOrigin; use frame_benchmarking::{benchmarks, whitelisted_caller, impl_benchmark_test_suite}; +use sp_std::{vec, vec::Vec, boxed::Box}; + #[allow(unused)] use crate::Module as Template; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 0568678..5f90727 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -460,7 +460,7 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { 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 {} let whitelist: Vec = vec![