mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Companion for paritytech/substrate#12868 (#6406)
* Replace WEIGHT_PER_* with WEIGHT_REF_TIME_PER_* * cargo fmt * Update substrate
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{mock::*, test_utils::*, *};
|
||||
use frame_support::{assert_err, weights::constants::WEIGHT_PER_SECOND};
|
||||
use frame_support::{assert_err, weights::constants::WEIGHT_REF_TIME_PER_SECOND};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::{traits::*, Config, XcmExecutor};
|
||||
|
||||
@@ -676,8 +676,8 @@ fn weight_trader_tuple_should_work() {
|
||||
pub const PARA_2: MultiLocation = X1(Parachain(2)).into();
|
||||
|
||||
parameter_types! {
|
||||
pub static HereWeightPrice: (AssetId, u128) = (Here.into().into(), WEIGHT_PER_SECOND.ref_time().into());
|
||||
pub static PARA1WeightPrice: (AssetId, u128) = (PARA_1.into(), WEIGHT_PER_SECOND.ref_time().into());
|
||||
pub static HereWeightPrice: (AssetId, u128) = (Here.into().into(), WEIGHT_REF_TIME_PER_SECOND.into());
|
||||
pub static PARA1WeightPrice: (AssetId, u128) = (PARA_1.into(), WEIGHT_REF_TIME_PER_SECOND.into());
|
||||
}
|
||||
|
||||
type Traders = (
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use frame_support::{
|
||||
dispatch::GetDispatchInfo,
|
||||
traits::{tokens::currency::Currency as CurrencyT, Get, OnUnbalanced as OnUnbalancedT},
|
||||
weights::{constants::WEIGHT_PER_SECOND, WeightToFee as WeightToFeeT},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, WeightToFee as WeightToFeeT},
|
||||
};
|
||||
use parity_scale_codec::Decode;
|
||||
use sp_runtime::traits::{SaturatedConversion, Saturating, Zero};
|
||||
@@ -153,7 +153,7 @@ impl<T: Get<(MultiLocation, u128)>, R: TakeRevenue> WeightTrader
|
||||
weight, payment,
|
||||
);
|
||||
let (id, units_per_second) = T::get();
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||
let unused =
|
||||
payment.checked_sub((id, amount).into()).map_err(|_| XcmError::TooExpensive)?;
|
||||
self.0 = self.0.saturating_add(weight);
|
||||
@@ -165,7 +165,7 @@ impl<T: Get<(MultiLocation, u128)>, R: TakeRevenue> WeightTrader
|
||||
log::trace!(target: "xcm::weight", "FixedRateOfConcreteFungible::refund_weight weight: {:?}", weight);
|
||||
let (id, units_per_second) = T::get();
|
||||
let weight = weight.min(self.0);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||
self.0 -= weight;
|
||||
self.1 = self.1.saturating_sub(amount);
|
||||
if amount > 0 {
|
||||
@@ -205,7 +205,7 @@ impl<T: Get<(AssetId, u128)>, R: TakeRevenue> WeightTrader for FixedRateOfFungib
|
||||
weight, payment,
|
||||
);
|
||||
let (id, units_per_second) = T::get();
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||
if amount == 0 {
|
||||
return Ok(payment)
|
||||
}
|
||||
@@ -220,7 +220,7 @@ impl<T: Get<(AssetId, u128)>, R: TakeRevenue> WeightTrader for FixedRateOfFungib
|
||||
log::trace!(target: "xcm::weight", "FixedRateOfFungible::refund_weight weight: {:?}", weight);
|
||||
let (id, units_per_second) = T::get();
|
||||
let weight = weight.min(self.0);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
||||
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||
self.0 -= weight;
|
||||
self.1 = self.1.saturating_sub(amount);
|
||||
if amount > 0 {
|
||||
|
||||
@@ -20,7 +20,7 @@ use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
||||
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
||||
pub const ReservedXcmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||
pub const ReservedDmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -20,7 +20,7 @@ use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
||||
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
||||
pub const ReservedXcmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||
pub const ReservedDmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
Reference in New Issue
Block a user