mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 02:51:01 +00:00
Add benchmarking for parachain runtime initializer pallet (#3913)
* Add benchmarking for parachain runtime initializer pallet * Fix default impl for initializer pallet WeightInfo * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::initializer --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_initializer.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::initializer --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_initializer.rs * Use real weights and use max_block as default weight * Add variable for digest vec length for initializer benchmark * Fix compilation errors * Add WeightInfo to parachains_initializer config in polkadot runtime * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::initializer --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_initializer.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::initializer --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_initializer.rs * Appease spellchecker * Use kusama weights in polkadot runtime for parachain initializer pallet Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::*;
|
||||
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
|
||||
use frame_system::{DigestItemOf, RawOrigin};
|
||||
use primitives::v1::ConsensusLog;
|
||||
|
||||
// Random large number for the digest
|
||||
const DIGEST_MAX_LEN: u32 = 65536;
|
||||
|
||||
benchmarks! {
|
||||
force_approve {
|
||||
let d in 0 .. DIGEST_MAX_LEN;
|
||||
for _ in 0 .. d {
|
||||
<frame_system::Pallet<T>>::deposit_log(ConsensusLog::ForceApprove(d).into());
|
||||
}
|
||||
}: _(RawOrigin::Root, d + 1)
|
||||
verify {
|
||||
assert_eq!(
|
||||
<frame_system::Pallet<T>>::digest().logs.last().unwrap(),
|
||||
&<DigestItemOf<T>>::from(ConsensusLog::ForceApprove(d + 1)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
);
|
||||
Reference in New Issue
Block a user