mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +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:
@@ -18,7 +18,7 @@
|
||||
|
||||
use sp_runtime::{generic, traits::{BlakeTwo256, Block as _, Verify}, DispatchError};
|
||||
use sp_core::{H256, sr25519};
|
||||
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
|
||||
use frame_support::weights::MINIMUM_WEIGHT;
|
||||
|
||||
mod system;
|
||||
|
||||
@@ -33,7 +33,7 @@ mod module1 {
|
||||
pub struct Module<T: Trait<I>, I: Instance = DefaultInstance> for enum Call
|
||||
where origin: <T as system::Trait>::Origin
|
||||
{
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
pub fn fail(_origin) -> frame_support::dispatch::DispatchResult {
|
||||
Err(Error::<T, I>::Something.into())
|
||||
}
|
||||
@@ -60,7 +60,7 @@ mod module2 {
|
||||
pub struct Module<T: Trait> for enum Call
|
||||
where origin: <T as system::Trait>::Origin
|
||||
{
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
pub fn fail(_origin) -> frame_support::dispatch::DispatchResult {
|
||||
Err(Error::<T>::Something.into())
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use frame_support::{
|
||||
DecodeDifferent, StorageMetadata, StorageEntryModifier, StorageEntryType, DefaultByteGetter,
|
||||
StorageEntryMetadata, StorageHasher,
|
||||
},
|
||||
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
|
||||
weights::MINIMUM_WEIGHT,
|
||||
StorageValue, StorageMap, StorageDoubleMap,
|
||||
};
|
||||
use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier, MakeFatalError};
|
||||
@@ -56,7 +56,7 @@ mod module1 {
|
||||
|
||||
fn deposit_event() = default;
|
||||
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn one(origin) {
|
||||
system::ensure_root(origin)?;
|
||||
Self::deposit_event(RawEvent::AnotherVariant(3));
|
||||
|
||||
@@ -2,7 +2,7 @@ macro_rules! reserved {
|
||||
($($reserved:ident)*) => {
|
||||
$(
|
||||
mod $reserved {
|
||||
pub use frame_support::{dispatch, weights::{SimpleDispatchInfo, MINIMUM_WEIGHT}};
|
||||
pub use frame_support::{dispatch, weights::MINIMUM_WEIGHT};
|
||||
|
||||
pub trait Trait {
|
||||
type Origin;
|
||||
@@ -19,7 +19,7 @@ macro_rules! reserved {
|
||||
|
||||
frame_support::decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn $reserved(_origin) -> dispatch::DispatchResult { unreachable!() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user