mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Deprecate V1 Weights (#13699)
* Remove deprecated pallet calls Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Deprecate old weight Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update Runtime API Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Delete shitty code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix doctest Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/alliance/src/lib.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Add doc Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * contracts: Use u64 as old weight type Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/contracts/src/lib.rs Co-authored-by: Alexander Theißen <alex.theissen@me.com> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Koute <koute@users.noreply.github.com> Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
0766072393
commit
36957d6760
@@ -236,17 +236,23 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
|
||||
.get(DispatchClass::Normal)
|
||||
.base_extrinsic;
|
||||
let pre_info = DispatchInfo { weight: Weight::from_parts(1000, 0), ..Default::default() };
|
||||
System::note_applied_extrinsic(&Ok(Some(300).into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok(Some(1000).into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok(from_actual_ref_time(Some(300))), pre_info);
|
||||
System::note_applied_extrinsic(&Ok(from_actual_ref_time(Some(1000))), pre_info);
|
||||
System::note_applied_extrinsic(
|
||||
// values over the pre info should be capped at pre dispatch value
|
||||
&Ok(Some(1200).into()),
|
||||
&Ok(from_actual_ref_time(Some(1200))),
|
||||
pre_info,
|
||||
);
|
||||
System::note_applied_extrinsic(
|
||||
&Ok(from_post_weight_info(Some(2_500_000), Pays::Yes)),
|
||||
pre_info,
|
||||
);
|
||||
System::note_applied_extrinsic(&Ok((Some(2_500_000), Pays::Yes).into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok(Pays::No.into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok((Some(2_500_000), Pays::No).into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok((Some(500), Pays::No).into()), pre_info);
|
||||
System::note_applied_extrinsic(
|
||||
&Ok(from_post_weight_info(Some(2_500_000), Pays::No)),
|
||||
pre_info,
|
||||
);
|
||||
System::note_applied_extrinsic(&Ok(from_post_weight_info(Some(500), Pays::No)), pre_info);
|
||||
System::note_applied_extrinsic(
|
||||
&Err(DispatchError::BadOrigin.with_weight(Weight::from_parts(999, 0))),
|
||||
pre_info,
|
||||
@@ -289,7 +295,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
|
||||
class: DispatchClass::Operational,
|
||||
..Default::default()
|
||||
};
|
||||
System::note_applied_extrinsic(&Ok(Some(300).into()), pre_info);
|
||||
System::note_applied_extrinsic(&Ok(from_actual_ref_time(Some(300))), pre_info);
|
||||
|
||||
let got = System::events();
|
||||
let want = vec![
|
||||
@@ -691,3 +697,14 @@ fn ensure_signed_stuff_works() {
|
||||
assert_ok!(EnsureSignedBy::<Members, _>::try_origin(successful_origin));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_actual_ref_time(ref_time: Option<u64>) -> PostDispatchInfo {
|
||||
PostDispatchInfo {
|
||||
actual_weight: ref_time.map(|t| Weight::from_all(t)),
|
||||
pays_fee: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_post_weight_info(ref_time: Option<u64>, pays_fee: Pays) -> PostDispatchInfo {
|
||||
PostDispatchInfo { actual_weight: ref_time.map(|t| Weight::from_all(t)), pays_fee }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user