mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 03:07:56 +00:00
Weight v1.5: Opaque Struct (#12138)
* initial idea * update frame_support * update a bunch more * add ord * adjust RuntimeDbWeight * frame_system builds * re-export * frame_support tests pass * frame_executive compile * frame_executive builds * frame_system tests passing * pallet-utility tests pass * fix a bunch of pallets * more * phragmen * state-trie-migration * scheduler and referenda * pallet-election-provider-multi-phase * aura * staking * more * babe * balances * bunch more * sudo * transaction-payment * asset-tx-payment * last pallets * fix alliance merge * fix node template runtime * fix pallet-contracts cc @athei * fix node runtime * fix compile on runtime-benchmarks feature * comment * fix frame-support-test * fix more tests * weight regex * frame system works * fix a bunch * more * more * more * more * more * more fixes * update templates * fix contracts benchmarks * Update lib.rs * Update lib.rs * fix ui * make scalar saturating mul const * more const functions * scalar div * refactor using constant functions * move impl * fix overhead template * use compactas * Update lib.rs
This commit is contained in:
@@ -31,7 +31,10 @@ impl SomeAssociation for u64 {
|
||||
mod pallet_old {
|
||||
use super::SomeAssociation;
|
||||
use frame_support::{
|
||||
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
|
||||
decl_error, decl_event, decl_module, decl_storage,
|
||||
traits::Get,
|
||||
weights::{RefTimeWeight, Weight},
|
||||
Parameter,
|
||||
};
|
||||
use frame_system::ensure_root;
|
||||
|
||||
@@ -40,7 +43,7 @@ mod pallet_old {
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<Weight>
|
||||
+ Into<RefTimeWeight>
|
||||
+ Default
|
||||
+ SomeAssociation;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
@@ -75,7 +78,7 @@ mod pallet_old {
|
||||
fn deposit_event() = default;
|
||||
const SomeConst: T::Balance = T::SomeConst::get();
|
||||
|
||||
#[weight = <T::Balance as Into<Weight>>::into(new_value.clone())]
|
||||
#[weight = <T::Balance as Into<RefTimeWeight>>::into(new_value.clone())]
|
||||
fn set_dummy(origin, #[compact] new_value: T::Balance) {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -85,7 +88,7 @@ mod pallet_old {
|
||||
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
<Dummy<T>>::put(T::Balance::from(10));
|
||||
10
|
||||
Weight::from_ref_time(10)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
@@ -113,7 +116,7 @@ pub mod pallet {
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<Weight>
|
||||
+ Into<RefTimeWeight>
|
||||
+ Default
|
||||
+ MaybeSerializeDeserialize
|
||||
+ SomeAssociation
|
||||
@@ -131,7 +134,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));
|
||||
10
|
||||
Weight::from_ref_time(10)
|
||||
}
|
||||
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
@@ -141,7 +144,7 @@ pub mod pallet {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::weight(<T::Balance as Into<Weight>>::into(new_value.clone()))]
|
||||
#[pallet::weight(<T::Balance as Into<RefTimeWeight>>::into(new_value.clone()))]
|
||||
pub fn set_dummy(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] new_value: T::Balance,
|
||||
|
||||
Reference in New Issue
Block a user