mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -159,7 +159,7 @@ use sp_std::{cmp, result, mem, fmt::Debug, ops::BitOr, convert::Infallible};
|
||||
use codec::{Codec, Encode, Decode};
|
||||
use frame_support::{
|
||||
StorageValue, Parameter, decl_event, decl_storage, decl_module, decl_error, ensure,
|
||||
weights::SimpleDispatchInfo, traits::{
|
||||
traits::{
|
||||
Currency, OnKilledAccount, OnUnbalanced, TryDrop, StoredMap,
|
||||
WithdrawReason, WithdrawReasons, LockIdentifier, LockableCurrency, ExistenceRequirement,
|
||||
Imbalance, SignedImbalance, ReservableCurrency, Get, ExistenceRequirement::KeepAlive,
|
||||
@@ -433,7 +433,7 @@ decl_module! {
|
||||
/// check that the transfer will not kill the origin account.
|
||||
///
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1_000_000)]
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 200_000_000]
|
||||
pub fn transfer(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -457,7 +457,7 @@ decl_module! {
|
||||
/// - Independent of the arguments.
|
||||
/// - Contains a limited number of reads and writes.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(50_000)]
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 100_000_000]
|
||||
fn set_balance(
|
||||
origin,
|
||||
who: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -495,7 +495,11 @@ decl_module! {
|
||||
|
||||
/// Exactly as `transfer`, except the origin must be root and the source account may be
|
||||
/// specified.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1_000_000)]
|
||||
/// # <weight>
|
||||
/// - Same as transfer, but additional read and write because the source account is
|
||||
/// not assumed to be in the overlay.
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(2, 2) + 200_000_000]
|
||||
pub fn force_transfer(
|
||||
origin,
|
||||
source: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -514,7 +518,7 @@ decl_module! {
|
||||
/// 99% of the time you want [`transfer`] instead.
|
||||
///
|
||||
/// [`transfer`]: struct.Module.html#method.transfer
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1_000_000)]
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 150_000_000]
|
||||
pub fn transfer_keep_alive(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -842,6 +846,7 @@ impl<T: Subtrait<I>, I: Instance> frame_system::Trait for ElevatedTrait<T, I> {
|
||||
type Event = ();
|
||||
type BlockHashCount = T::BlockHashCount;
|
||||
type MaximumBlockWeight = T::MaximumBlockWeight;
|
||||
type DbWeight = T::DbWeight;
|
||||
type MaximumBlockLength = T::MaximumBlockLength;
|
||||
type AvailableBlockRatio = T::AvailableBlockRatio;
|
||||
type Version = T::Version;
|
||||
|
||||
@@ -36,7 +36,7 @@ macro_rules! decl_tests {
|
||||
($test:ty, $ext_builder:ty, $existential_deposit:expr) => {
|
||||
|
||||
use crate::*;
|
||||
use sp_runtime::{Fixed64, traits::{SignedExtension, BadOrigin}};
|
||||
use sp_runtime::{Fixed128, traits::{SignedExtension, BadOrigin}};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, assert_err,
|
||||
traits::{
|
||||
@@ -153,7 +153,7 @@ macro_rules! decl_tests {
|
||||
.monied(true)
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
pallet_transaction_payment::NextFeeMultiplier::put(Fixed64::from_natural(1));
|
||||
pallet_transaction_payment::NextFeeMultiplier::put(Fixed128::from_natural(1));
|
||||
Balances::set_lock(ID_1, &1, 10, WithdrawReason::Reserve.into());
|
||||
assert_noop!(
|
||||
<Balances as Currency<_>>::transfer(&1, &2, 1, AllowDeath),
|
||||
|
||||
@@ -67,6 +67,7 @@ impl frame_system::Trait for Test {
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type Version = ();
|
||||
|
||||
@@ -67,6 +67,7 @@ impl frame_system::Trait for Test {
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type Version = ();
|
||||
|
||||
Reference in New Issue
Block a user