Deprecate Weight::from_{ref_time, proof_size} (#13475)

* Deprecate Weight::from_{ref_time, proof_size}

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

* Update templates

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

* Use from_parts

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

* Use from_parts

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

* Dont revert comment 🤦

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

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances

* Update weight files

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

* More fixes

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

* Adapt to Master changes

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

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-03-02 22:28:17 +01:00
committed by GitHub
parent 7981d4aa59
commit 9e56e1acdd
101 changed files with 2695 additions and 2857 deletions
+9 -9
View File
@@ -171,7 +171,7 @@ pub mod pallet {
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
Self::deposit_event(Event::Something(10));
Weight::from_ref_time(10)
Weight::from_parts(10, 0)
}
fn on_finalize(_: BlockNumberFor<T>) {
let _ = T::AccountId::from(SomeType1); // Test for where clause
@@ -182,7 +182,7 @@ pub mod pallet {
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
Self::deposit_event(Event::Something(30));
Weight::from_ref_time(30)
Weight::from_parts(30, 0)
}
fn integrity_test() {
let _ = T::AccountId::from(SomeType1); // Test for where clause
@@ -197,7 +197,7 @@ pub mod pallet {
{
/// Doc comment put in metadata
#[pallet::call_index(0)]
#[pallet::weight(Weight::from_ref_time(*_foo as u64))]
#[pallet::weight(Weight::from_parts(*_foo as u64, 0))]
pub fn foo(
origin: OriginFor<T>,
#[pallet::compact] _foo: u32,
@@ -715,7 +715,7 @@ fn call_expand() {
assert_eq!(
call_foo.get_dispatch_info(),
DispatchInfo {
weight: frame_support::weights::Weight::from_ref_time(3),
weight: frame_support::weights::Weight::from_parts(3, 0),
class: DispatchClass::Normal,
pays_fee: Pays::Yes
}
@@ -1096,10 +1096,10 @@ fn pallet_hooks_expand() {
TestExternalities::default().execute_with(|| {
frame_system::Pallet::<Runtime>::set_block_number(1);
assert_eq!(AllPalletsWithoutSystem::on_initialize(1), Weight::from_ref_time(10));
assert_eq!(AllPalletsWithoutSystem::on_initialize(1), Weight::from_parts(10, 0));
AllPalletsWithoutSystem::on_finalize(1);
assert_eq!(AllPalletsWithoutSystem::on_runtime_upgrade(), Weight::from_ref_time(30));
assert_eq!(AllPalletsWithoutSystem::on_runtime_upgrade(), Weight::from_parts(30, 0));
assert_eq!(
frame_system::Pallet::<Runtime>::events()[0].event,
@@ -1137,13 +1137,13 @@ fn all_pallets_type_reversed_order_is_correct() {
{
assert_eq!(
AllPalletsWithoutSystemReversed::on_initialize(1),
Weight::from_ref_time(10)
Weight::from_parts(10, 0)
);
AllPalletsWithoutSystemReversed::on_finalize(1);
assert_eq!(
AllPalletsWithoutSystemReversed::on_runtime_upgrade(),
Weight::from_ref_time(30)
Weight::from_parts(30, 0)
);
}
@@ -1219,7 +1219,7 @@ fn migrate_from_pallet_version_to_storage_version() {
};
// `pallet_num` pallets, 2 writes and every write costs 5 weight.
assert_eq!(Weight::from_ref_time(pallet_num * 2 * 5), weight);
assert_eq!(Weight::from_parts(pallet_num * 2 * 5, 0), weight);
// All pallet versions should be removed
assert!(sp_io::storage::get(&pallet_version_key(Example::name())).is_none());