mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 20:57:59 +00:00
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:
committed by
GitHub
parent
2c7166eb9c
commit
3b6d31f03d
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user