mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
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:
committed by
GitHub
parent
7981d4aa59
commit
9e56e1acdd
@@ -508,7 +508,7 @@ fn call_weight_should_attach_to_call_enum() {
|
||||
assert_eq!(
|
||||
module3::Call::<Runtime>::operational {}.get_dispatch_info(),
|
||||
DispatchInfo {
|
||||
weight: Weight::from_ref_time(5),
|
||||
weight: Weight::from_parts(5, 0),
|
||||
class: DispatchClass::Operational,
|
||||
pays_fee: Pays::Yes
|
||||
},
|
||||
@@ -517,7 +517,7 @@ fn call_weight_should_attach_to_call_enum() {
|
||||
assert_eq!(
|
||||
module3::Call::<Runtime>::aux_4 {}.get_dispatch_info(),
|
||||
DispatchInfo {
|
||||
weight: Weight::from_ref_time(3),
|
||||
weight: Weight::from_parts(3, 0),
|
||||
class: DispatchClass::Normal,
|
||||
pays_fee: Pays::Yes
|
||||
},
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -85,7 +85,7 @@ mod pallet_old {
|
||||
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
<Dummy<T>>::put(T::Balance::from(10));
|
||||
Weight::from_ref_time(10)
|
||||
Weight::from_parts(10, 0)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
@@ -131,7 +131,7 @@ pub mod pallet {
|
||||
impl<T: Config> Hooks<T::BlockNumber> for Pallet<T> {
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
<Dummy<T>>::put(T::Balance::from(10));
|
||||
Weight::from_ref_time(10)
|
||||
Weight::from_parts(10, 0)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
|
||||
@@ -72,7 +72,7 @@ mod pallet_old {
|
||||
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
<Dummy<T, I>>::put(T::Balance::from(10));
|
||||
Weight::from_ref_time(10)
|
||||
Weight::from_parts(10, 0)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
@@ -117,7 +117,7 @@ pub mod pallet {
|
||||
impl<T: Config<I>, I: 'static> Hooks<T::BlockNumber> for Pallet<T, I> {
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
<Dummy<T, I>>::put(T::Balance::from(10));
|
||||
Weight::from_ref_time(10)
|
||||
Weight::from_parts(10, 0)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
|
||||
@@ -54,10 +54,10 @@ pub mod pallet {
|
||||
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
|
||||
if TypeId::of::<I>() == TypeId::of::<()>() {
|
||||
Self::deposit_event(Event::Something(10));
|
||||
Weight::from_ref_time(10)
|
||||
Weight::from_parts(10, 0)
|
||||
} else {
|
||||
Self::deposit_event(Event::Something(11));
|
||||
Weight::from_ref_time(11)
|
||||
Weight::from_parts(11, 0)
|
||||
}
|
||||
}
|
||||
fn on_finalize(_: BlockNumberFor<T>) {
|
||||
@@ -70,10 +70,10 @@ pub mod pallet {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
if TypeId::of::<I>() == TypeId::of::<()>() {
|
||||
Self::deposit_event(Event::Something(30));
|
||||
Weight::from_ref_time(30)
|
||||
Weight::from_parts(30, 0)
|
||||
} else {
|
||||
Self::deposit_event(Event::Something(31));
|
||||
Weight::from_ref_time(31)
|
||||
Weight::from_parts(31, 0)
|
||||
}
|
||||
}
|
||||
fn integrity_test() {}
|
||||
@@ -83,7 +83,7 @@ pub mod pallet {
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
/// 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,
|
||||
@@ -356,7 +356,7 @@ fn call_expand() {
|
||||
assert_eq!(
|
||||
call_foo.get_dispatch_info(),
|
||||
DispatchInfo {
|
||||
weight: Weight::from_ref_time(3),
|
||||
weight: Weight::from_parts(3, 0),
|
||||
class: DispatchClass::Normal,
|
||||
pays_fee: Pays::Yes
|
||||
}
|
||||
@@ -368,7 +368,7 @@ fn call_expand() {
|
||||
assert_eq!(
|
||||
call_foo.get_dispatch_info(),
|
||||
DispatchInfo {
|
||||
weight: Weight::from_ref_time(3),
|
||||
weight: Weight::from_parts(3, 0),
|
||||
class: DispatchClass::Normal,
|
||||
pays_fee: Pays::Yes
|
||||
}
|
||||
@@ -649,10 +649,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(21));
|
||||
assert_eq!(AllPalletsWithoutSystem::on_initialize(1), Weight::from_parts(21, 0));
|
||||
AllPalletsWithoutSystem::on_finalize(1);
|
||||
|
||||
assert_eq!(AllPalletsWithoutSystem::on_runtime_upgrade(), Weight::from_ref_time(61));
|
||||
assert_eq!(AllPalletsWithoutSystem::on_runtime_upgrade(), Weight::from_parts(61, 0));
|
||||
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
|
||||
Reference in New Issue
Block a user