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:
Shawn Tabrizi
2022-08-31 13:24:42 +01:00
committed by GitHub
parent 1ab196df49
commit 3fb9c8a7be
118 changed files with 2005 additions and 1885 deletions
+9 -4
View File
@@ -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) =