Fix runtime benchmarks CI (#6545)

* debug (ci): ci config [skip ci]

* debug (ci): fix runtime benchmarks

* fix identity benchmarks

* fix utility benchmarks

* Revert "debug (ci): ci config [skip ci]"

This reverts commit 081b175b5e95604520c79ea4e5822b84ea35ddaa.

* change (ci): touch ci config to run CI

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Gav Wood <gavin@parity.io>
This commit is contained in:
Denis Pisarev
2020-07-01 09:36:12 +02:00
committed by GitHub
parent c4f6fbceac
commit ce02e1df84
4 changed files with 31 additions and 8 deletions
+12 -1
View File
@@ -20,11 +20,19 @@
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use frame_system::RawOrigin;
use frame_system::{RawOrigin, EventRecord};
use frame_benchmarking::{benchmarks, account};
const SEED: u32 = 0;
fn assert_last_event<T: Trait>(generic_event: <T as Trait>::Event) {
let events = frame_system::Module::<T>::events();
let system_event: <T as frame_system::Trait>::Event = generic_event.into();
// compare to the last event record
let EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}
benchmarks! {
_ { }
@@ -37,6 +45,9 @@ benchmarks! {
}
let caller = account("caller", 0, SEED);
}: _(RawOrigin::Signed(caller), calls)
verify {
assert_last_event::<T>(Event::BatchCompleted.into())
}
as_derivative {
let u in 0 .. 1000;
+4 -2
View File
@@ -104,6 +104,8 @@ impl Filter<Call> for TestBaseCallFilter {
fn filter(c: &Call) -> bool {
match *c {
Call::Balances(_) => true,
// For benchmarking, this acts as a noop call
Call::System(frame_system::Call::remark(..)) => true,
_ => false,
}
}
@@ -163,7 +165,7 @@ fn as_derivative_filters() {
assert_noop!(Utility::as_derivative(
Origin::signed(1),
1,
Box::new(Call::System(frame_system::Call::remark(vec![]))),
Box::new(Call::System(frame_system::Call::suicide())),
), DispatchError::BadOrigin);
});
}
@@ -208,7 +210,7 @@ fn batch_with_signed_filters() {
new_test_ext().execute_with(|| {
assert_ok!(
Utility::batch(Origin::signed(1), vec![
Call::System(frame_system::Call::remark(vec![]))
Call::System(frame_system::Call::suicide())
]),
);
expect_event(Event::BatchInterrupted(0, DispatchError::BadOrigin));