mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 20:47:56 +00:00
Migrate away from SimpleDispatchInfo (#5686)
* Migrate away from SimpleDispatchInfo * Fix imports * Better doc * Update lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -256,10 +256,7 @@
|
||||
use sp_std::marker::PhantomData;
|
||||
use frame_support::{
|
||||
dispatch::DispatchResult, decl_module, decl_storage, decl_event,
|
||||
weights::{
|
||||
SimpleDispatchInfo, DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee,
|
||||
MINIMUM_WEIGHT,
|
||||
},
|
||||
weights::{DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee, MINIMUM_WEIGHT},
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
@@ -469,7 +466,7 @@ decl_module! {
|
||||
// weight (a numeric representation of pure execution time and difficulty) of the
|
||||
// transaction and the latter demonstrates the [`DispatchClass`] of the call. A higher
|
||||
// weight means a larger transaction (less of which can be placed in a single block).
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn accumulate_dummy(origin, increase_by: T::Balance) -> DispatchResult {
|
||||
// This is a public call, so we ensure that the origin is some signed account.
|
||||
let _sender = ensure_signed(origin)?;
|
||||
@@ -518,8 +515,7 @@ decl_module! {
|
||||
|
||||
// The signature could also look like: `fn on_initialize()`.
|
||||
// This function could also very well have a weight annotation, similar to any other. The
|
||||
// only difference being that if it is not annotated, the default is
|
||||
// `SimpleDispatchInfo::zero()`, which resolves into no weight.
|
||||
// only difference is that it mut be returned, not annotated.
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
// Anything that needs to be done at the start of the block.
|
||||
// We don't do anything here.
|
||||
|
||||
Reference in New Issue
Block a user