mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-23 18:57:59 +00:00
Companion for Weight v1.5 (#1581)
* cargo test -p cumulus-primitives-utility
* cargo test -p cumulus-pallet-xcmp-queue
* cargo test -p cumulus-pallet-xcm
* cargo test -p cumulus-pallet-dmp-queue
* cargo test -p pallet-template
* cargo test -p cumulus-test-runtime
* fix weights
* fix more weights
* cargo test -p parachains-common
* cargo test -p parachain-template-runtime
* fix weights import
* cargo test -p collectives-polkadot-runtime
* cargo test -p contracts-rococo-runtime
* more
* unused
* fixes
* Update benchmarking.rs
* Update lib.rs
* Update lib.rs
* fix
* fix bug in conversion
* update lockfile for {"polkadot", "substrate"}
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -28,7 +28,10 @@ use frame_support::{
|
||||
use sp_runtime::{traits::Saturating, SaturatedConversion};
|
||||
|
||||
use sp_std::marker::PhantomData;
|
||||
use xcm::{latest::prelude::*, WrapVersion};
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XCMWeight},
|
||||
WrapVersion,
|
||||
};
|
||||
use xcm_builder::TakeRevenue;
|
||||
use xcm_executor::traits::{MatchesFungibles, TransactAsset, WeightTrader};
|
||||
/// Xcm router which recognises the `Parent` destination and handles it by sending the message into
|
||||
@@ -105,7 +108,7 @@ impl<
|
||||
// If everything goes well, we charge.
|
||||
fn buy_weight(
|
||||
&mut self,
|
||||
weight: Weight,
|
||||
weight: XCMWeight,
|
||||
payment: xcm_executor::Assets,
|
||||
) -> Result<xcm_executor::Assets, XcmError> {
|
||||
log::trace!(target: "xcm::weight", "TakeFirstAssetTrader::buy_weight weight: {:?}, payment: {:?}", weight, payment);
|
||||
@@ -115,6 +118,8 @@ impl<
|
||||
return Err(XcmError::NotWithdrawable)
|
||||
}
|
||||
|
||||
let weight = Weight::from_ref_time(weight);
|
||||
|
||||
// We take the very first multiasset from payment
|
||||
let multiassets: MultiAssets = payment.clone().into();
|
||||
|
||||
@@ -155,14 +160,14 @@ impl<
|
||||
Ok(unused)
|
||||
}
|
||||
|
||||
fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {
|
||||
fn refund_weight(&mut self, weight: XCMWeight) -> Option<MultiAsset> {
|
||||
log::trace!(target: "xcm::weight", "TakeFirstAssetTrader::refund_weight weight: {:?}", weight);
|
||||
if let Some(AssetTraderRefunder {
|
||||
mut weight_outstanding,
|
||||
outstanding_concrete_asset: MultiAsset { id, fun },
|
||||
}) = self.0.clone()
|
||||
{
|
||||
let weight = weight.min(weight_outstanding);
|
||||
let weight = Weight::from_ref_time(weight).min(weight_outstanding);
|
||||
|
||||
// Get the local asset id in which we can refund fees
|
||||
let (local_asset_id, outstanding_balance) =
|
||||
|
||||
Reference in New Issue
Block a user