mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Remove RefTimeWeight (#12157)
* update api * update * remove unused * remove `one` api * fix unused * fmt * add saturating accrue * remove `Weight::new()` * use some macros * div makes no sense * Update weight_v2.rs * missed some * more patch * fixes * more fixes * more fix * more fix * remove RefTimeWeight * Update frame/contracts/src/storage.rs Co-authored-by: Alexander Theißen <alex.theissen@me.com> * not needed * Fixes Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -31,10 +31,7 @@ impl SomeAssociation for u64 {
|
||||
mod pallet_old {
|
||||
use super::SomeAssociation;
|
||||
use frame_support::{
|
||||
decl_error, decl_event, decl_module, decl_storage,
|
||||
traits::Get,
|
||||
weights::{RefTimeWeight, Weight},
|
||||
Parameter,
|
||||
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
|
||||
};
|
||||
use frame_system::ensure_root;
|
||||
|
||||
@@ -43,7 +40,7 @@ mod pallet_old {
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<RefTimeWeight>
|
||||
+ Into<u64>
|
||||
+ Default
|
||||
+ SomeAssociation;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
@@ -78,7 +75,7 @@ mod pallet_old {
|
||||
fn deposit_event() = default;
|
||||
const SomeConst: T::Balance = T::SomeConst::get();
|
||||
|
||||
#[weight = <T::Balance as Into<RefTimeWeight>>::into(new_value.clone())]
|
||||
#[weight = <T::Balance as Into<u64>>::into(new_value.clone())]
|
||||
fn set_dummy(origin, #[compact] new_value: T::Balance) {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -116,7 +113,7 @@ pub mod pallet {
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<RefTimeWeight>
|
||||
+ Into<u64>
|
||||
+ Default
|
||||
+ MaybeSerializeDeserialize
|
||||
+ SomeAssociation
|
||||
@@ -144,7 +141,7 @@ pub mod pallet {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::weight(<T::Balance as Into<RefTimeWeight>>::into(new_value.clone()))]
|
||||
#[pallet::weight(<T::Balance as Into<u64>>::into(new_value.clone()))]
|
||||
pub fn set_dummy(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] new_value: T::Balance,
|
||||
|
||||
@@ -23,16 +23,13 @@ use frame_support::traits::{ConstU32, ConstU64};
|
||||
|
||||
mod pallet_old {
|
||||
use frame_support::{
|
||||
decl_error, decl_event, decl_module, decl_storage,
|
||||
traits::Get,
|
||||
weights::{RefTimeWeight, Weight},
|
||||
Parameter,
|
||||
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
|
||||
};
|
||||
use frame_system::ensure_root;
|
||||
|
||||
pub trait Config<I: Instance = DefaultInstance>: frame_system::Config {
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Balance: Parameter + codec::HasCompact + From<u32> + Into<RefTimeWeight> + Default;
|
||||
type Balance: Parameter + codec::HasCompact + From<u32> + Into<u64> + Default;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
||||
}
|
||||
|
||||
@@ -65,7 +62,7 @@ mod pallet_old {
|
||||
fn deposit_event() = default;
|
||||
const SomeConst: T::Balance = T::SomeConst::get();
|
||||
|
||||
#[weight = <T::Balance as Into<RefTimeWeight>>::into(new_value.clone())]
|
||||
#[weight = <T::Balance as Into<u64>>::into(new_value.clone())]
|
||||
fn set_dummy(origin, #[compact] new_value: T::Balance) {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -102,7 +99,7 @@ pub mod pallet {
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<RefTimeWeight>
|
||||
+ Into<u64>
|
||||
+ Default
|
||||
+ MaybeSerializeDeserialize
|
||||
+ scale_info::StaticTypeInfo;
|
||||
@@ -129,7 +126,7 @@ pub mod pallet {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
#[pallet::weight(<T::Balance as Into<RefTimeWeight>>::into(new_value.clone()))]
|
||||
#[pallet::weight(<T::Balance as Into<u64>>::into(new_value.clone()))]
|
||||
pub fn set_dummy(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] new_value: T::Balance,
|
||||
|
||||
Reference in New Issue
Block a user