Add Call Filter That Prevents Nested batch_all (#9009)

* add filter preventing nested `batch_all`

* more tests

* fix test

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Shawn Tabrizi
2021-06-03 09:05:02 -04:00
committed by GitHub
parent 94717b93db
commit f585bf1c1e
3 changed files with 71 additions and 26 deletions
+19 -23
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,9 +15,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Weights for pallet_utility
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
//! DATE: 2020-10-27, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
//! Autogenerated weights for pallet_utility
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-06-03, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
// Executed Command:
@@ -46,44 +47,39 @@ pub trait WeightInfo {
fn batch(c: u32, ) -> Weight;
fn as_derivative() -> Weight;
fn batch_all(c: u32, ) -> Weight;
}
/// Weights for pallet_utility using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn batch(c: u32, ) -> Weight {
(20_071_000 as Weight)
.saturating_add((2_739_000 as Weight).saturating_mul(c as Weight))
(19_099_000 as Weight)
// Standard Error: 1_000
.saturating_add((640_000 as Weight).saturating_mul(c as Weight))
}
fn as_derivative() -> Weight {
(5_721_000 as Weight)
(3_701_000 as Weight)
}
fn batch_all(c: u32, ) -> Weight {
(21_440_000 as Weight)
.saturating_add((2_738_000 as Weight).saturating_mul(c as Weight))
(19_199_000 as Weight)
// Standard Error: 0
.saturating_add((1_061_000 as Weight).saturating_mul(c as Weight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn batch(c: u32, ) -> Weight {
(20_071_000 as Weight)
.saturating_add((2_739_000 as Weight).saturating_mul(c as Weight))
(19_099_000 as Weight)
// Standard Error: 1_000
.saturating_add((640_000 as Weight).saturating_mul(c as Weight))
}
fn as_derivative() -> Weight {
(5_721_000 as Weight)
(3_701_000 as Weight)
}
fn batch_all(c: u32, ) -> Weight {
(21_440_000 as Weight)
.saturating_add((2_738_000 as Weight).saturating_mul(c as Weight))
(19_199_000 as Weight)
// Standard Error: 0
.saturating_add((1_061_000 as Weight).saturating_mul(c as Weight))
}
}