mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Deprecate FunctionOf and remove its users (#6340)
* Deprecate FunctionOf and remove users * Remove unused import
This commit is contained in:
committed by
GitHub
parent
56e2cec02c
commit
7d3f1fe6ea
@@ -93,7 +93,7 @@ use sp_runtime::{DispatchResult, traits::{StaticLookup, Dispatchable}};
|
||||
use frame_support::{
|
||||
Parameter, decl_module, decl_event, decl_storage, decl_error, ensure,
|
||||
};
|
||||
use frame_support::weights::{Weight, GetDispatchInfo, FunctionOf, Pays};
|
||||
use frame_support::weights::{Weight, GetDispatchInfo};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -126,11 +126,7 @@ decl_module! {
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + 10,000.
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().weight + 10_000,
|
||||
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().class,
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
|
||||
fn sudo(origin, call: Box<<T as Trait>::Call>) {
|
||||
// This is a public call, so we ensure that the origin is some signed account.
|
||||
let sender = ensure_signed(origin)?;
|
||||
@@ -150,11 +146,7 @@ decl_module! {
|
||||
/// - O(1).
|
||||
/// - The weight of this call is defined by the caller.
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|(_, &weight): (&Box<<T as Trait>::Call>,&Weight,)| weight,
|
||||
|(call, _): (&Box<<T as Trait>::Call>,&Weight,)| call.get_dispatch_info().class,
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = (*_weight, call.get_dispatch_info().class)]
|
||||
fn sudo_unchecked_weight(origin, call: Box<<T as Trait>::Call>, _weight: Weight) {
|
||||
// This is a public call, so we ensure that the origin is some signed account.
|
||||
let sender = ensure_signed(origin)?;
|
||||
@@ -195,15 +187,7 @@ decl_module! {
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + 10,000.
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|args: (&<T::Lookup as StaticLookup>::Source, &Box<<T as Trait>::Call>,)| {
|
||||
args.1.get_dispatch_info().weight + 10_000
|
||||
},
|
||||
|args: (&<T::Lookup as StaticLookup>::Source, &Box<<T as Trait>::Call>,)| {
|
||||
args.1.get_dispatch_info().class
|
||||
},
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
|
||||
fn sudo_as(origin, who: <T::Lookup as StaticLookup>::Source, call: Box<<T as Trait>::Call>) {
|
||||
// This is a public call, so we ensure that the origin is some signed account.
|
||||
let sender = ensure_signed(origin)?;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use super::*;
|
||||
use frame_support::{
|
||||
impl_outer_origin, impl_outer_dispatch, impl_outer_event, parameter_types,
|
||||
weights::{Weight, DispatchClass}
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_core::H256;
|
||||
// The testing primitives are very useful for avoiding having to work with signatures
|
||||
@@ -56,11 +56,7 @@ pub mod logger {
|
||||
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin {
|
||||
fn deposit_event() = default;
|
||||
|
||||
#[weight = FunctionOf(
|
||||
|args: (&i32, &Weight)| *args.1,
|
||||
DispatchClass::Normal,
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = *weight]
|
||||
fn privileged_i32_log(origin, i: i32, weight: Weight){
|
||||
// Ensure that the `origin` is `Root`.
|
||||
ensure_root(origin)?;
|
||||
@@ -68,11 +64,7 @@ pub mod logger {
|
||||
Self::deposit_event(RawEvent::AppendI32(i, weight));
|
||||
}
|
||||
|
||||
#[weight = FunctionOf(
|
||||
|args: (&i32, &Weight)| *args.1,
|
||||
DispatchClass::Normal,
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = *weight]
|
||||
fn non_privileged_log(origin, i: i32, weight: Weight){
|
||||
// Ensure that the `origin` is some signed account.
|
||||
let sender = ensure_signed(origin)?;
|
||||
|
||||
Reference in New Issue
Block a user