Fix benchmarks and ensure CI tests them (#854)

* Fix benchmarks and ensure CI tests them

* FMT
This commit is contained in:
Bastian Köcher
2021-12-12 23:17:15 +01:00
committed by GitHub
parent 308cb3e76b
commit f175a25793
2 changed files with 15 additions and 6 deletions
+9 -2
View File
@@ -112,7 +112,7 @@ check-runtime-benchmarks:
<<: *docker-env <<: *docker-env
script: script:
# Check that the node will compile with `runtime-benchmarks` feature flag. # Check that the node will compile with `runtime-benchmarks` feature flag.
- time cargo check --features runtime-benchmarks - time cargo check --all --features runtime-benchmarks
- sccache -s - sccache -s
cargo-check-try-runtime: cargo-check-try-runtime:
@@ -120,7 +120,14 @@ cargo-check-try-runtime:
<<: *docker-env <<: *docker-env
script: script:
# Check that the node will compile with `try-runtime` feature flag. # Check that the node will compile with `try-runtime` feature flag.
- time cargo check --features try-runtime - time cargo check --all --features try-runtime
- sccache -s
cargo-check-benches:
stage: test
<<: *docker-env
script:
- time cargo check --all --benches
- sccache -s - sccache -s
#### stage: publish #### stage: publish
@@ -17,9 +17,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput}; use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
use cumulus_test_runtime::{AccountId, BalancesCall, SudoCall}; use cumulus_test_runtime::{AccountId, BalancesCall, ExistentialDeposit, SudoCall};
use futures::{future, StreamExt}; use futures::{future, StreamExt};
use polkadot_service::polkadot_runtime::constants::currency::DOLLARS;
use sc_transaction_pool_api::{TransactionPool as _, TransactionSource, TransactionStatus}; use sc_transaction_pool_api::{TransactionPool as _, TransactionSource, TransactionStatus};
use sp_core::{crypto::Pair, sr25519}; use sp_core::{crypto::Pair, sr25519};
use sp_runtime::{generic::BlockId, OpaqueExtrinsic}; use sp_runtime::{generic::BlockId, OpaqueExtrinsic};
@@ -72,7 +71,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
call: Box::new( call: Box::new(
BalancesCall::set_balance { BalancesCall::set_balance {
who: AccountId::from(a.public()).into(), who: AccountId::from(a.public()).into(),
new_free: 1_000_000 * DOLLARS, new_free: 1_000_000 * ExistentialDeposit::get(),
new_reserved: 0, new_reserved: 0,
} }
.into(), .into(),
@@ -99,7 +98,10 @@ fn create_benchmark_extrinsics(
(0..extrinsics_per_account).map(move |nonce| { (0..extrinsics_per_account).map(move |nonce| {
construct_extrinsic( construct_extrinsic(
client, client,
BalancesCall::transfer { dest: Bob.to_account_id().into(), value: 1 * DOLLARS }, BalancesCall::transfer {
dest: Bob.to_account_id().into(),
value: 1 * ExistentialDeposit::get(),
},
account.clone(), account.clone(),
Some(nonce as u32), Some(nonce as u32),
) )