mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +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
@@ -127,7 +127,7 @@ use frame_support::{
|
||||
},
|
||||
weights::{
|
||||
Weight, RuntimeDbWeight, DispatchInfo, PostDispatchInfo, DispatchClass,
|
||||
FunctionOf, Pays, extract_actual_weight,
|
||||
extract_actual_weight,
|
||||
},
|
||||
dispatch::DispatchResultWithPostInfo,
|
||||
};
|
||||
@@ -566,11 +566,7 @@ decl_module! {
|
||||
/// A dispatch that will fill the block weight up to the given ratio.
|
||||
// TODO: This should only be available for testing, rather than in general usage, but
|
||||
// that's not possible at present (since it's within the decl_module macro).
|
||||
#[weight = FunctionOf(
|
||||
|(ratio,): (&Perbill,)| *ratio * T::MaximumBlockWeight::get(),
|
||||
DispatchClass::Operational,
|
||||
Pays::Yes,
|
||||
)]
|
||||
#[weight = (*_ratio * T::MaximumBlockWeight::get(), DispatchClass::Operational)]
|
||||
fn fill_block(origin, _ratio: Perbill) {
|
||||
ensure_root(origin)?;
|
||||
}
|
||||
@@ -669,13 +665,10 @@ decl_module! {
|
||||
/// - Base Weight: 0.568 * i µs
|
||||
/// - Writes: Number of items
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|(items,): (&Vec<KeyValue>,)| {
|
||||
T::DbWeight::get().writes(items.len() as Weight)
|
||||
.saturating_add((items.len() as Weight).saturating_mul(600_000))
|
||||
},
|
||||
#[weight = (
|
||||
T::DbWeight::get().writes(items.len() as Weight)
|
||||
.saturating_add((items.len() as Weight).saturating_mul(600_000)),
|
||||
DispatchClass::Operational,
|
||||
Pays::Yes,
|
||||
)]
|
||||
fn set_storage(origin, items: Vec<KeyValue>) {
|
||||
ensure_root(origin)?;
|
||||
@@ -692,13 +685,10 @@ decl_module! {
|
||||
/// - Base Weight: .378 * i µs
|
||||
/// - Writes: Number of items
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|(keys,): (&Vec<Key>,)| {
|
||||
T::DbWeight::get().writes(keys.len() as Weight)
|
||||
.saturating_add((keys.len() as Weight).saturating_mul(400_000))
|
||||
},
|
||||
#[weight = (
|
||||
T::DbWeight::get().writes(keys.len() as Weight)
|
||||
.saturating_add((keys.len() as Weight).saturating_mul(400_000)),
|
||||
DispatchClass::Operational,
|
||||
Pays::Yes,
|
||||
)]
|
||||
fn kill_storage(origin, keys: Vec<Key>) {
|
||||
ensure_root(origin)?;
|
||||
@@ -718,13 +708,10 @@ decl_module! {
|
||||
/// - Base Weight: 0.834 * P µs
|
||||
/// - Writes: Number of subkeys + 1
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|(_, &subkeys): (&Key, &u32)| {
|
||||
T::DbWeight::get().writes(Weight::from(subkeys) + 1)
|
||||
.saturating_add((Weight::from(subkeys) + 1).saturating_mul(850_000))
|
||||
},
|
||||
#[weight = (
|
||||
T::DbWeight::get().writes(Weight::from(*_subkeys) + 1)
|
||||
.saturating_add((Weight::from(*_subkeys) + 1).saturating_mul(850_000)),
|
||||
DispatchClass::Operational,
|
||||
Pays::Yes,
|
||||
)]
|
||||
fn kill_prefix(origin, prefix: Key, _subkeys: u32) {
|
||||
ensure_root(origin)?;
|
||||
@@ -1904,7 +1891,7 @@ pub(crate) mod tests {
|
||||
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, SignedExtension}, testing::Header, DispatchError};
|
||||
use frame_support::{
|
||||
impl_outer_origin, parameter_types, assert_ok, assert_noop, assert_err,
|
||||
weights::WithPostDispatchInfo,
|
||||
weights::{WithPostDispatchInfo, Pays},
|
||||
};
|
||||
|
||||
impl_outer_origin! {
|
||||
|
||||
Reference in New Issue
Block a user