pallet-glutton: over-unity consumption (#14338)

* pallet-glutton: over-unity consumption

* Add hard limit

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Highlight warning

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix docs

* Review test fixes

Co-authored-by: Guillaume Yu Thiolliere <gui.thiolliere@gmail.com>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet-glutton

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet-glutton

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Guillaume Yu Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-06-13 17:57:04 +02:00
committed by GitHub
parent 2c7166eb9c
commit 3b6d31f03d
8 changed files with 246 additions and 166 deletions
+7 -6
View File
@@ -25,6 +25,7 @@ use super::*;
use frame_benchmarking::benchmarks;
use frame_support::{pallet_prelude::*, weights::constants::*};
use frame_system::RawOrigin as SystemOrigin;
use sp_runtime::{traits::One, Perbill};
use crate::Pallet as Glutton;
use frame_system::Pallet as System;
@@ -67,8 +68,8 @@ benchmarks! {
// For manual verification only.
on_idle_high_proof_waste {
(0..5000).for_each(|i| TrashData::<T>::insert(i, [i as u8; 1024]));
let _ = Glutton::<T>::set_compute(SystemOrigin::Root.into(), Perbill::from_percent(100));
let _ = Glutton::<T>::set_storage(SystemOrigin::Root.into(), Perbill::from_percent(100));
let _ = Glutton::<T>::set_compute(SystemOrigin::Root.into(), One::one());
let _ = Glutton::<T>::set_storage(SystemOrigin::Root.into(), One::one());
}: {
let weight = Glutton::<T>::on_idle(System::<T>::block_number(), Weight::from_parts(WEIGHT_REF_TIME_PER_MILLIS * 100, WEIGHT_PROOF_SIZE_PER_MB * 5));
}
@@ -76,8 +77,8 @@ benchmarks! {
// For manual verification only.
on_idle_low_proof_waste {
(0..5000).for_each(|i| TrashData::<T>::insert(i, [i as u8; 1024]));
let _ = Glutton::<T>::set_compute(SystemOrigin::Root.into(), Perbill::from_percent(100));
let _ = Glutton::<T>::set_storage(SystemOrigin::Root.into(), Perbill::from_percent(100));
let _ = Glutton::<T>::set_compute(SystemOrigin::Root.into(), One::one());
let _ = Glutton::<T>::set_storage(SystemOrigin::Root.into(), One::one());
}: {
let weight = Glutton::<T>::on_idle(System::<T>::block_number(), Weight::from_parts(WEIGHT_REF_TIME_PER_MILLIS * 100, WEIGHT_PROOF_SIZE_PER_KB * 20));
}
@@ -89,10 +90,10 @@ benchmarks! {
}
set_compute {
}: _(SystemOrigin::Root, Perbill::from_percent(50))
}: _(SystemOrigin::Root, FixedU64::from_perbill(Perbill::from_percent(50)))
set_storage {
}: _(SystemOrigin::Root, Perbill::from_percent(50))
}: _(SystemOrigin::Root, FixedU64::from_perbill(Perbill::from_percent(50)))
impl_benchmark_test_suite!(Glutton, crate::mock::new_test_ext(), crate::mock::Test);
}
+43 -36
View File
@@ -15,6 +15,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # WARNING
//!
//! **DO NOT USE ON VALUE-BEARING CHAINS. THIS PALLET IS ONLY INTENDED FOR TESTING USAGE.**
//!
//! # Glutton Pallet
//!
//! Pallet that consumes `ref_time` and `proof_size` of a block. Based on the
@@ -32,10 +36,10 @@ mod tests;
pub mod weights;
use blake2::{Blake2b512, Digest};
use frame_support::{pallet_prelude::*, weights::WeightMeter};
use frame_support::{pallet_prelude::*, weights::WeightMeter, DefaultNoBound};
use frame_system::pallet_prelude::*;
use sp_io::hashing::twox_256;
use sp_runtime::{traits::Zero, Perbill};
use sp_runtime::{traits::Zero, FixedPointNumber, FixedU64};
use sp_std::{vec, vec::Vec};
pub use pallet::*;
@@ -43,8 +47,10 @@ pub use weights::WeightInfo;
/// The size of each value in the `TrashData` storage in bytes.
pub const VALUE_SIZE: usize = 1024;
/// Max number of entries for `TrashData` storage item
/// Max number of entries for the `TrashData` map.
pub const MAX_TRASH_DATA_ENTRIES: u32 = 65_000;
/// Hard limit for any other resource limit (in units).
pub const RESOURCE_HARD_LIMIT: FixedU64 = FixedU64::from_u32(10);
#[frame_support::pallet]
pub mod pallet {
@@ -52,6 +58,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The admin origin that can set computational limits and initialize the pallet.
@@ -70,9 +77,9 @@ pub mod pallet {
/// The pallet has been (re)initialized.
PalletInitialized { reinit: bool },
/// The computation limit has been updated.
ComputationLimitSet { compute: Perbill },
ComputationLimitSet { compute: FixedU64 },
/// The storage limit has been updated.
StorageLimitSet { storage: Perbill },
StorageLimitSet { storage: FixedU64 },
}
#[pallet::error]
@@ -81,17 +88,24 @@ pub mod pallet {
///
/// Set `witness_count` to `Some` to bypass this error.
AlreadyInitialized,
/// The limit was over [`crate::RESOURCE_HARD_LIMIT`].
InsaneLimit,
}
/// Storage value used to specify what percentage of the left over `ref_time`
/// to consume during `on_idle`.
/// The proportion of the remaining `ref_time` to consume during `on_idle`.
///
/// `1.0` is mapped to `100%`. Must be at most [`crate::RESOURCE_HARD_LIMIT`]. Setting this to
/// over `1.0` could stall the chain.
#[pallet::storage]
pub(crate) type Compute<T: Config> = StorageValue<_, Perbill, ValueQuery>;
pub(crate) type Compute<T: Config> = StorageValue<_, FixedU64, ValueQuery>;
/// Storage value used the specify what percentage of left over `proof_size`
/// to consume during `on_idle`.
/// The proportion of the remaining `proof_size` to consume during `on_idle`.
///
/// `1.0` is mapped to `100%`. Must be at most [`crate::RESOURCE_HARD_LIMIT`]. Setting this to
/// over `1.0` could stall the chain.
#[pallet::storage]
pub(crate) type Storage<T: Config> = StorageValue<_, Perbill, ValueQuery>;
pub(crate) type Storage<T: Config> = StorageValue<_, FixedU64, ValueQuery>;
/// Storage map used for wasting proof size.
///
@@ -115,22 +129,13 @@ pub mod pallet {
pub(crate) type TrashDataCount<T: Config> = StorageValue<_, u32, ValueQuery>;
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
pub struct GenesisConfig {
pub compute: Perbill,
pub storage: Perbill,
pub compute: FixedU64,
pub storage: FixedU64,
pub trash_data_count: u32,
}
impl Default for GenesisConfig {
fn default() -> Self {
Self {
compute: Default::default(),
storage: Default::default(),
trash_data_count: Default::default(),
}
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
@@ -145,7 +150,10 @@ pub mod pallet {
TrashDataCount::<T>::set(self.trash_data_count);
assert!(self.compute <= RESOURCE_HARD_LIMIT, "Compute limit is insane");
<Compute<T>>::put(self.compute);
assert!(self.storage <= RESOURCE_HARD_LIMIT, "Storage limit is insane");
<Storage<T>>::put(self.storage);
}
}
@@ -169,9 +177,10 @@ pub mod pallet {
return T::WeightInfo::empty_on_idle()
}
let proof_size_limit = Storage::<T>::get().mul_floor(meter.remaining().proof_size());
let proof_size_limit =
Storage::<T>::get().saturating_mul_int(meter.remaining().proof_size());
let computation_weight_limit =
Compute::<T>::get().mul_floor(meter.remaining().ref_time());
Compute::<T>::get().saturating_mul_int(meter.remaining().ref_time());
let mut meter = WeightMeter::from_limit(Weight::from_parts(
computation_weight_limit,
proof_size_limit,
@@ -184,15 +193,14 @@ pub mod pallet {
}
}
#[pallet::call]
#[pallet::call(weight = T::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Initializes the pallet by writing into `TrashData`.
/// Initialize the pallet. Should be called once, if no genesis state was provided.
///
/// `current_count` is the current number of elements in `TrashData`. This can be set to
/// `None` when the pallet is first initialized.
///
/// Only callable by Root or `AdminOrigin`. A good default for `new_count` is
/// `5_000`.
/// Only callable by Root or `AdminOrigin`. A good default for `new_count` is `5_000`.
#[pallet::call_index(0)]
#[pallet::weight(
T::WeightInfo::initialize_pallet_grow(witness_count.unwrap_or_default())
@@ -227,10 +235,10 @@ pub mod pallet {
///
/// Only callable by Root or `AdminOrigin`.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::set_compute())]
pub fn set_compute(origin: OriginFor<T>, compute: Perbill) -> DispatchResult {
pub fn set_compute(origin: OriginFor<T>, compute: FixedU64) -> DispatchResult {
T::AdminOrigin::try_origin(origin).map(|_| ()).or_else(|o| ensure_root(o))?;
ensure!(compute <= RESOURCE_HARD_LIMIT, Error::<T>::InsaneLimit);
Compute::<T>::set(compute);
Self::deposit_event(Event::ComputationLimitSet { compute });
@@ -239,17 +247,16 @@ pub mod pallet {
/// Set how much of the remaining `proof_size` weight should be consumed by `on_idle`.
//
/// 100% means that all remaining `proof_size` will be consumed. The PoV benchmarking
/// `1.0` means that all remaining `proof_size` will be consumed. The PoV benchmarking
/// results that are used here are likely an over-estimation. 100% intended consumption will
/// therefore translate to less than 100% actual consumption. In the future, this could be
/// counter-acted by allowing the glutton to specify over-unity consumption ratios.
/// therefore translate to less than 100% actual consumption.
///
/// Only callable by Root or `AdminOrigin`.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::set_storage())]
pub fn set_storage(origin: OriginFor<T>, storage: Perbill) -> DispatchResult {
pub fn set_storage(origin: OriginFor<T>, storage: FixedU64) -> DispatchResult {
T::AdminOrigin::try_origin(origin).map(|_| ()).or_else(|o| ensure_root(o))?;
ensure!(storage <= RESOURCE_HARD_LIMIT, Error::<T>::InsaneLimit);
Storage::<T>::set(storage);
Self::deposit_event(Event::StorageLimitSet { storage });
+12 -1
View File
@@ -18,7 +18,10 @@
use super::*;
use crate as pallet_glutton;
use frame_support::traits::{ConstU32, ConstU64};
use frame_support::{
assert_ok,
traits::{ConstU32, ConstU64},
};
use sp_core::H256;
use sp_runtime::{
testing::Header,
@@ -79,3 +82,11 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
ext.execute_with(|| System::set_block_number(1));
ext
}
/// Set the `compute` and `storage` limits.
///
/// `1.0` corresponds to `100%`.
pub fn set_limits(compute: f64, storage: f64) {
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), FixedU64::from_float(compute)));
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), FixedU64::from_float(storage)));
}
+88 -31
View File
@@ -17,10 +17,13 @@
//! Tests for the glutton pallet.
use super::*;
use mock::{new_test_ext, Glutton, RuntimeOrigin, System, Test};
use super::{mock::*, *};
use frame_support::{assert_err, assert_noop, assert_ok, weights::constants::*};
use sp_runtime::{traits::One, Perbill};
const CALIBRATION_ERROR: &'static str =
"Weight calibration failed. Please re-run the benchmarks on the same hardware.";
#[test]
fn initialize_pallet_works() {
@@ -86,52 +89,81 @@ fn expand_and_shrink_trash_data_works() {
#[test]
fn setting_compute_works() {
new_test_ext().execute_with(|| {
assert_eq!(Compute::<Test>::get(), Perbill::from_percent(0));
assert_eq!(Compute::<Test>::get(), Zero::zero());
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), Perbill::from_percent(70)));
assert_eq!(Compute::<Test>::get(), Perbill::from_percent(70));
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), FixedU64::from_float(0.3)));
assert_eq!(Compute::<Test>::get(), FixedU64::from_float(0.3));
System::assert_last_event(
Event::ComputationLimitSet { compute: Perbill::from_percent(70) }.into(),
Event::ComputationLimitSet { compute: FixedU64::from_float(0.3) }.into(),
);
assert_noop!(
Glutton::set_compute(RuntimeOrigin::signed(1), Perbill::from_percent(30)),
Glutton::set_compute(RuntimeOrigin::signed(1), FixedU64::from_float(0.5)),
DispatchError::BadOrigin
);
assert_noop!(
Glutton::set_compute(RuntimeOrigin::none(), Perbill::from_percent(30)),
Glutton::set_compute(RuntimeOrigin::none(), FixedU64::from_float(0.5)),
DispatchError::BadOrigin
);
});
}
#[test]
fn setting_compute_respects_limit() {
new_test_ext().execute_with(|| {
// < 1000% is fine
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), FixedU64::from_float(9.99)),);
// == 1000% is fine
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), FixedU64::from_u32(10)),);
// > 1000% is not
assert_noop!(
Glutton::set_compute(RuntimeOrigin::root(), FixedU64::from_float(10.01)),
Error::<Test>::InsaneLimit
);
});
}
#[test]
fn setting_storage_works() {
new_test_ext().execute_with(|| {
assert_eq!(Storage::<Test>::get(), Perbill::from_percent(0));
assert!(Storage::<Test>::get().is_zero());
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), Perbill::from_percent(30)));
assert_eq!(Storage::<Test>::get(), Perbill::from_percent(30));
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), FixedU64::from_float(0.3)));
assert_eq!(Storage::<Test>::get(), FixedU64::from_float(0.3));
System::assert_last_event(
Event::StorageLimitSet { storage: Perbill::from_percent(30) }.into(),
Event::StorageLimitSet { storage: FixedU64::from_float(0.3) }.into(),
);
assert_noop!(
Glutton::set_storage(RuntimeOrigin::signed(1), Perbill::from_percent(90)),
Glutton::set_storage(RuntimeOrigin::signed(1), FixedU64::from_float(0.5)),
DispatchError::BadOrigin
);
assert_noop!(
Glutton::set_storage(RuntimeOrigin::none(), Perbill::from_percent(90)),
Glutton::set_storage(RuntimeOrigin::none(), FixedU64::from_float(0.5)),
DispatchError::BadOrigin
);
});
}
#[test]
fn setting_storage_respects_limit() {
new_test_ext().execute_with(|| {
// < 1000% is fine
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), FixedU64::from_float(9.99)),);
// == 1000% is fine
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), FixedU64::from_u32(10)),);
// > 1000% is not
assert_noop!(
Glutton::set_storage(RuntimeOrigin::root(), FixedU64::from_float(10.01)),
Error::<Test>::InsaneLimit
);
});
}
#[test]
fn on_idle_works() {
new_test_ext().execute_with(|| {
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), Perbill::from_percent(100)));
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), Perbill::from_percent(100)));
set_limits(One::one(), One::one());
Glutton::on_idle(1, Weight::from_parts(20_000_000, 0));
});
@@ -141,8 +173,7 @@ fn on_idle_works() {
#[test]
fn on_idle_weight_high_proof_is_close_enough_works() {
new_test_ext().execute_with(|| {
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), Perbill::from_percent(100)));
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), Perbill::from_percent(100)));
set_limits(One::one(), One::one());
let should = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, WEIGHT_PROOF_SIZE_PER_MB * 5);
let got = Glutton::on_idle(1, should);
@@ -151,15 +182,13 @@ fn on_idle_weight_high_proof_is_close_enough_works() {
let ratio = Perbill::from_rational(got.proof_size(), should.proof_size());
assert!(
ratio >= Perbill::from_percent(99),
"Too few proof size consumed, was only {:?} of expected",
ratio
"Too few proof size consumed, was only {ratio:?} of expected",
);
let ratio = Perbill::from_rational(got.ref_time(), should.ref_time());
assert!(
ratio >= Perbill::from_percent(99),
"Too few ref time consumed, was only {:?} of expected",
ratio
"Too few ref time consumed, was only {ratio:?} of expected",
);
});
}
@@ -167,26 +196,54 @@ fn on_idle_weight_high_proof_is_close_enough_works() {
#[test]
fn on_idle_weight_low_proof_is_close_enough_works() {
new_test_ext().execute_with(|| {
assert_ok!(Glutton::set_compute(RuntimeOrigin::root(), Perbill::from_percent(100)));
assert_ok!(Glutton::set_storage(RuntimeOrigin::root(), Perbill::from_percent(100)));
set_limits(One::one(), One::one());
let should = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, WEIGHT_PROOF_SIZE_PER_KB * 20);
let got = Glutton::on_idle(1, should);
assert!(got.all_lte(should), "Consumed too much weight");
let ratio = Perbill::from_rational(got.proof_size(), should.proof_size());
// Just a sanity check here.
// Just a sanity check here for > 0
assert!(
ratio >= Perbill::from_percent(50),
"Too few proof size consumed, was only {:?} of expected",
ratio
"Too few proof size consumed, was only {ratio:?} of expected",
);
let ratio = Perbill::from_rational(got.ref_time(), should.ref_time());
assert!(
ratio >= Perbill::from_percent(99),
"Too few ref time consumed, was only {:?} of expected",
ratio
"Too few ref time consumed, was only {ratio:?} of expected",
);
});
}
#[test]
fn on_idle_weight_over_unity_is_close_enough_works() {
new_test_ext().execute_with(|| {
// Para blocks get ~500ms compute and ~5MB proof size.
let max_block =
Weight::from_parts(500 * WEIGHT_REF_TIME_PER_MILLIS, 5 * WEIGHT_PROOF_SIZE_PER_MB);
// But now we tell it to consume more than that.
set_limits(1.75, 1.5);
let want = Weight::from_parts(
(1.75 * max_block.ref_time() as f64) as u64,
(1.5 * max_block.proof_size() as f64) as u64,
);
let consumed = Glutton::on_idle(1, max_block);
assert!(consumed.all_gt(max_block), "Must consume more than the block limit");
assert!(consumed.all_lte(want), "Consumed more than the requested weight");
let ratio = Perbill::from_rational(consumed.proof_size(), want.proof_size());
assert!(
ratio >= Perbill::from_percent(99),
"Too few proof size consumed, was only {ratio:?} of expected",
);
let ratio = Perbill::from_rational(consumed.ref_time(), want.ref_time());
assert!(
ratio >= Perbill::from_percent(99),
"Too few ref time consumed, was only {ratio:?} of expected",
);
});
}
@@ -202,7 +259,7 @@ fn waste_at_most_ref_time_weight_close_enough() {
// We require it to be under-spend by at most 1%.
assert!(
meter.consumed_ratio() >= Perbill::from_percent(99),
"Consumed too few: {:?}",
"{CALIBRATION_ERROR}\nConsumed too few: {:?}",
meter.consumed_ratio()
);
});
@@ -219,7 +276,7 @@ fn waste_at_most_proof_size_weight_close_enough() {
// We require it to be under-spend by at most 1%.
assert!(
meter.consumed_ratio() >= Perbill::from_percent(99),
"Consumed too few: {:?}",
"{CALIBRATION_ERROR}\nConsumed too few: {:?}",
meter.consumed_ratio()
);
});
+91 -89
View File
@@ -18,33 +18,35 @@
//! Autogenerated weights for pallet_glutton
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-06-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/substrate
// target/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_glutton
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/glutton/src/weights.rs
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet-glutton
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/glutton/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
use core::marker::PhantomData;
/// Weight functions needed for pallet_glutton.
pub trait WeightInfo {
@@ -69,12 +71,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_grow(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Measured: `86`
// Estimated: `1489`
// Minimum execution time: 10_410_000 picoseconds.
Weight::from_parts(10_515_000, 1489)
// Standard Error: 1_069
.saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into()))
// Minimum execution time: 11_620_000 picoseconds.
Weight::from_parts(18_662_404, 1489)
// Standard Error: 8_342
.saturating_add(Weight::from_parts(8_453_895, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -86,12 +88,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_shrink(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `65`
// Measured: `119`
// Estimated: `1489`
// Minimum execution time: 11_105_000 picoseconds.
Weight::from_parts(584_850, 1489)
// Standard Error: 1_417
.saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into()))
// Minimum execution time: 11_128_000 picoseconds.
Weight::from_parts(11_404_000, 1489)
// Standard Error: 1_098
.saturating_add(Weight::from_parts(1_007_030, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -101,83 +103,83 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 709_000 picoseconds.
Weight::from_parts(7_409_096, 0)
// Standard Error: 23
.saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into()))
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(607_000, 0)
// Standard Error: 18
.saturating_add(Weight::from_parts(85_323, 0).saturating_mul(i.into()))
}
/// Storage: Glutton TrashData (r:5000 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
/// The range of component `i` is `[0, 5000]`.
fn waste_proof_size_some(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119036 + i * (1022 ±0)`
// Measured: `119114 + i * (1022 ±0)`
// Estimated: `990 + i * (3016 ±0)`
// Minimum execution time: 584_000 picoseconds.
Weight::from_parts(674_000, 990)
// Standard Error: 1_802
.saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into()))
// Minimum execution time: 503_000 picoseconds.
Weight::from_parts(589_000, 990)
// Standard Error: 2_971
.saturating_add(Weight::from_parts(5_347_659, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into()))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:1737 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_high_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `1900466`
// Measured: `1900497`
// Estimated: `5239782`
// Minimum execution time: 57_124_610_000 picoseconds.
Weight::from_parts(57_256_059_000, 5239782)
// Minimum execution time: 55_496_326_000 picoseconds.
Weight::from_parts(55_707_517_000, 5239782)
.saturating_add(T::DbWeight::get().reads(1739_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:5 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_low_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `9516`
// Measured: `9547`
// Estimated: `16070`
// Minimum execution time: 101_500_066_000 picoseconds.
Weight::from_parts(101_621_640_000, 16070)
// Minimum execution time: 98_314_570_000 picoseconds.
Weight::from_parts(98_702_199_000, 16070)
.saturating_add(T::DbWeight::get().reads(7_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn empty_on_idle() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `1489`
// Minimum execution time: 4_164_000 picoseconds.
Weight::from_parts(4_378_000, 1489)
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 5_853_000 picoseconds.
Weight::from_parts(6_055_000, 1493)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
/// Storage: Glutton Compute (r:0 w:1)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_compute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_795_000 picoseconds.
Weight::from_parts(9_076_000, 0)
// Minimum execution time: 8_741_000 picoseconds.
Weight::from_parts(8_962_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Glutton Storage (r:0 w:1)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_storage() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_979_000 picoseconds.
Weight::from_parts(9_195_000, 0)
// Minimum execution time: 8_585_000 picoseconds.
Weight::from_parts(8_789_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
@@ -191,12 +193,12 @@ impl WeightInfo for () {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_grow(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Measured: `86`
// Estimated: `1489`
// Minimum execution time: 10_410_000 picoseconds.
Weight::from_parts(10_515_000, 1489)
// Standard Error: 1_069
.saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into()))
// Minimum execution time: 11_620_000 picoseconds.
Weight::from_parts(18_662_404, 1489)
// Standard Error: 8_342
.saturating_add(Weight::from_parts(8_453_895, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -208,12 +210,12 @@ impl WeightInfo for () {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_shrink(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `65`
// Measured: `119`
// Estimated: `1489`
// Minimum execution time: 11_105_000 picoseconds.
Weight::from_parts(584_850, 1489)
// Standard Error: 1_417
.saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into()))
// Minimum execution time: 11_128_000 picoseconds.
Weight::from_parts(11_404_000, 1489)
// Standard Error: 1_098
.saturating_add(Weight::from_parts(1_007_030, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -223,83 +225,83 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 709_000 picoseconds.
Weight::from_parts(7_409_096, 0)
// Standard Error: 23
.saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into()))
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(607_000, 0)
// Standard Error: 18
.saturating_add(Weight::from_parts(85_323, 0).saturating_mul(i.into()))
}
/// Storage: Glutton TrashData (r:5000 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
/// The range of component `i` is `[0, 5000]`.
fn waste_proof_size_some(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119036 + i * (1022 ±0)`
// Measured: `119114 + i * (1022 ±0)`
// Estimated: `990 + i * (3016 ±0)`
// Minimum execution time: 584_000 picoseconds.
Weight::from_parts(674_000, 990)
// Standard Error: 1_802
.saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into()))
// Minimum execution time: 503_000 picoseconds.
Weight::from_parts(589_000, 990)
// Standard Error: 2_971
.saturating_add(Weight::from_parts(5_347_659, 0).saturating_mul(i.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into()))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:1737 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_high_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `1900466`
// Measured: `1900497`
// Estimated: `5239782`
// Minimum execution time: 57_124_610_000 picoseconds.
Weight::from_parts(57_256_059_000, 5239782)
// Minimum execution time: 55_496_326_000 picoseconds.
Weight::from_parts(55_707_517_000, 5239782)
.saturating_add(RocksDbWeight::get().reads(1739_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:5 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_low_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `9516`
// Measured: `9547`
// Estimated: `16070`
// Minimum execution time: 101_500_066_000 picoseconds.
Weight::from_parts(101_621_640_000, 16070)
// Minimum execution time: 98_314_570_000 picoseconds.
Weight::from_parts(98_702_199_000, 16070)
.saturating_add(RocksDbWeight::get().reads(7_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn empty_on_idle() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `1489`
// Minimum execution time: 4_164_000 picoseconds.
Weight::from_parts(4_378_000, 1489)
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 5_853_000 picoseconds.
Weight::from_parts(6_055_000, 1493)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
/// Storage: Glutton Compute (r:0 w:1)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_compute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_795_000 picoseconds.
Weight::from_parts(9_076_000, 0)
// Minimum execution time: 8_741_000 picoseconds.
Weight::from_parts(8_962_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Glutton Storage (r:0 w:1)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_storage() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_979_000 picoseconds.
Weight::from_parts(9_195_000, 0)
// Minimum execution time: 8_585_000 picoseconds.
Weight::from_parts(8_789_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}