mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Properly set the max proof size weight on defaults and tests (#12383)
* Properly set the max proof size weight on defaults and tests * cargo fmt * Set proper max proof size for contracts pallet tests * Properly set max proof size for node * Properly set max proof size for frame system mock * Update test expectations * Update test expectations * Properly set max proof size for balances mock * Update test expectations * Update test expectations * Properly set max proof size for democracy mock * Properly set max proof size for scheduler mock * Properly set max proof size for fast unstake mock * Properly set max proof size for tx payment mock * Properly set max proof size for elections phragmen mock * Properly set max proof size for node template
This commit is contained in:
@@ -310,7 +310,7 @@ mod tests {
|
||||
check(|max, len| {
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(max, len));
|
||||
assert_eq!(System::block_weight().total(), Weight::MAX);
|
||||
assert!(System::block_weight().total().all_gt(block_weight_limit()));
|
||||
assert!(System::block_weight().total().ref_time() > block_weight_limit().ref_time());
|
||||
});
|
||||
check(|max, len| {
|
||||
assert_ok!(CheckWeight::<Test>::do_validate(max, len));
|
||||
@@ -367,7 +367,7 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::register_extra_weight_unchecked(Weight::MAX, DispatchClass::Normal);
|
||||
assert_eq!(System::block_weight().total(), Weight::MAX);
|
||||
assert!(System::block_weight().total().all_gt(block_weight_limit()));
|
||||
assert!(System::block_weight().total().ref_time() > block_weight_limit().ref_time());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -392,8 +392,8 @@ mod tests {
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&max_normal, len));
|
||||
assert_eq!(System::block_weight().total(), Weight::from_ref_time(768));
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&rest_operational, len));
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024));
|
||||
assert_eq!(System::block_weight().total(), block_weight_limit());
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024).set_proof_size(u64::MAX));
|
||||
assert_eq!(System::block_weight().total(), block_weight_limit().set_proof_size(0));
|
||||
// Checking single extrinsic should not take current block weight into account.
|
||||
assert_eq!(CheckWeight::<Test>::check_extrinsic_weight(&rest_operational), Ok(()));
|
||||
});
|
||||
@@ -417,8 +417,8 @@ mod tests {
|
||||
// Extra 20 here from block execution + base extrinsic weight
|
||||
assert_eq!(System::block_weight().total(), Weight::from_ref_time(266));
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&max_normal, len));
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024));
|
||||
assert_eq!(System::block_weight().total(), block_weight_limit());
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024).set_proof_size(u64::MAX));
|
||||
assert_eq!(System::block_weight().total(), block_weight_limit().set_proof_size(0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ mod tests {
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&max_normal, len));
|
||||
assert_eq!(System::block_weight().total(), Weight::from_ref_time(768));
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&mandatory, len));
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024));
|
||||
assert_eq!(block_weight_limit(), Weight::from_ref_time(1024).set_proof_size(u64::MAX));
|
||||
assert_eq!(System::block_weight().total(), Weight::from_ref_time(1024 + 768));
|
||||
assert_eq!(CheckWeight::<Test>::check_extrinsic_weight(&mandatory), Ok(()));
|
||||
});
|
||||
@@ -682,11 +682,11 @@ mod tests {
|
||||
.base_block(Weight::zero())
|
||||
.for_class(DispatchClass::non_mandatory(), |w| {
|
||||
w.base_extrinsic = Weight::zero();
|
||||
w.max_total = Some(Weight::from_ref_time(20));
|
||||
w.max_total = Some(Weight::from_ref_time(20).set_proof_size(u64::MAX));
|
||||
})
|
||||
.for_class(DispatchClass::Mandatory, |w| {
|
||||
w.base_extrinsic = Weight::zero();
|
||||
w.reserved = Some(Weight::from_ref_time(5));
|
||||
w.reserved = Some(Weight::from_ref_time(5).set_proof_size(u64::MAX));
|
||||
w.max_total = None;
|
||||
})
|
||||
.build_or_panic();
|
||||
@@ -695,7 +695,7 @@ mod tests {
|
||||
DispatchClass::Operational => Weight::from_ref_time(10),
|
||||
DispatchClass::Mandatory => Weight::zero(),
|
||||
});
|
||||
assert_eq!(maximum_weight.max_block, all_weight.total());
|
||||
assert_eq!(maximum_weight.max_block, all_weight.total().set_proof_size(u64::MAX));
|
||||
|
||||
// fits into reserved
|
||||
let mandatory1 = DispatchInfo {
|
||||
|
||||
Reference in New Issue
Block a user