Run benchmarks for mock runtimes (#1996)

* run benchmarks for pallet-bridge-grandpa mock runtime

* run benchmarks for pallet-bridge-relayers mock runtime

* run benchmarks for pallet-bridge-parachains mock runtime

* run benchmarks for pallet-bridge-messages mock runtime

* test benchmarks on mockj runtimes from CI

* clippy and spelling
This commit is contained in:
Svyatoslav Nikolsky
2023-03-27 14:33:12 +03:00
committed by Bastian Köcher
parent 88fb2befa0
commit 068f6f648b
10 changed files with 130 additions and 18 deletions
@@ -136,4 +136,6 @@ benchmarks_instance_pallet! {
// check that the header#0 has been pruned
assert!(!<ImportedHeaders<T, I>>::contains_key(genesis_header.hash()));
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime)
}
+9 -2
View File
@@ -131,10 +131,17 @@ impl ChainWithGrandpa for TestBridgedChain {
const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = 64;
}
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
sp_io::TestExternalities::new(Default::default()).execute_with(test)
/// Return test externalities to use in tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
sp_io::TestExternalities::new(Default::default())
}
/// Return test within default test externalities context.
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
new_test_ext().execute_with(test)
}
/// Return test header with given number.
pub fn test_header(num: TestNumber) -> TestHeader {
// We wrap the call to avoid explicit type annotations in our tests
bp_test_utils::test_header(num)