mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 07:51:03 +00:00
WeightInfo for System, Timestamp, and Utility (#6868)
* initial updates to system * fix compile * Update writer.rs * update weights * finish system weights * timestamp weights * utility weight * Fix overflow in weight calculations * add back weight notes * Update for whitelisted benchmarks * add trait bounds * Revert "add trait bounds" This reverts commit 12b08b7189aa3969f96fa19b211a370860fdb240. * Update weights for unaccounted for read
This commit is contained in:
@@ -54,7 +54,7 @@ impl_outer_dispatch! {
|
||||
pub struct Test;
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub const MaximumBlockWeight: Weight = 1024;
|
||||
pub const MaximumBlockWeight: Weight = Weight::max_value();
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
@@ -121,6 +121,7 @@ type System = frame_system::Module<Test>;
|
||||
type Balances = pallet_balances::Module<Test>;
|
||||
type Utility = Module<Test>;
|
||||
|
||||
use frame_system::Call as SystemCall;
|
||||
use pallet_balances::Call as BalancesCall;
|
||||
use pallet_balances::Error as BalancesError;
|
||||
|
||||
@@ -236,3 +237,20 @@ fn batch_early_exit_works() {
|
||||
assert_eq!(Balances::free_balance(2), 15);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn batch_weight_calculation_doesnt_overflow() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let big_call = Call::System(SystemCall::fill_block(Perbill::from_percent(50)));
|
||||
assert_eq!(big_call.get_dispatch_info().weight, Weight::max_value() / 2);
|
||||
|
||||
// 3 * 50% saturates to 100%
|
||||
let batch_call = Call::Utility(crate::Call::batch(vec![
|
||||
big_call.clone(),
|
||||
big_call.clone(),
|
||||
big_call.clone(),
|
||||
]));
|
||||
|
||||
assert_eq!(batch_call.get_dispatch_info().weight, Weight::max_value());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user