Skip to content

Commit

Permalink
build fixes + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Jan 26, 2024
1 parent 1ce2488 commit b88a5ca
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 45 deletions.
34 changes: 17 additions & 17 deletions polkadot/runtime/rococo/src/weights/pallet_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use core::marker::PhantomData;

/// Weight functions for `pallet_xcm`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo<T> {
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
/// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0)
/// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::SupportedVersion` (r:1 w:0)
Expand All @@ -57,7 +57,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn send() -> Weight {
fn send() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3607`
Expand All @@ -66,21 +66,21 @@ impl<T: frame_system::Config> WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
pub(crate) fn teleport_assets() -> Weight {
fn teleport_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 15_957_000 picoseconds.
Weight::from_parts(16_456_000, 0)
}
pub(crate) fn reserve_transfer_assets() -> Weight {
fn reserve_transfer_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 14_784_000 picoseconds.
Weight::from_parts(15_393_000, 0)
}
pub(crate) fn execute() -> Weight {
fn execute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -89,15 +89,15 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::SupportedVersion` (r:0 w:1)
/// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_xcm_version() -> Weight {
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_473_000 picoseconds.
Weight::from_parts(7_917_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
pub(crate) fn force_default_xcm_version() -> Weight {
fn force_default_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -118,7 +118,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::Queries` (r:0 w:1)
/// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_subscribe_version_notify() -> Weight {
fn force_subscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3607`
Expand All @@ -139,7 +139,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::Queries` (r:0 w:1)
/// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_unsubscribe_version_notify() -> Weight {
fn force_unsubscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `322`
// Estimated: `3787`
Expand All @@ -150,7 +150,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1)
/// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub(crate) fn force_suspension() -> Weight {
fn force_suspension() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -160,7 +160,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::SupportedVersion` (r:4 w:2)
/// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_supported_version() -> Weight {
fn migrate_supported_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `26`
// Estimated: `10916`
Expand All @@ -171,7 +171,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifiers` (r:4 w:2)
/// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_version_notifiers() -> Weight {
fn migrate_version_notifiers() -> Weight {
// Proof Size summary in bytes:
// Measured: `30`
// Estimated: `10920`
Expand All @@ -182,7 +182,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn already_notified_target() -> Weight {
fn already_notified_target() -> Weight {
// Proof Size summary in bytes:
// Measured: `40`
// Estimated: `13405`
Expand All @@ -200,7 +200,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn notify_current_targets() -> Weight {
fn notify_current_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `178`
// Estimated: `6118`
Expand All @@ -211,7 +211,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:3 w:0)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn notify_target_migration_fail() -> Weight {
fn notify_target_migration_fail() -> Weight {
// Proof Size summary in bytes:
// Measured: `69`
// Estimated: `8484`
Expand All @@ -221,7 +221,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:4 w:2)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_version_notify_targets() -> Weight {
fn migrate_version_notify_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `37`
// Estimated: `10927`
Expand All @@ -240,7 +240,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_and_notify_old_targets() -> Weight {
fn migrate_and_notify_old_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `182`
// Estimated: `11072`
Expand Down
34 changes: 17 additions & 17 deletions polkadot/runtime/westend/src/weights/pallet_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use core::marker::PhantomData;

/// Weight functions for `pallet_xcm`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo<T> {
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
/// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0)
/// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::SupportedVersion` (r:1 w:0)
Expand All @@ -57,7 +57,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn send() -> Weight {
fn send() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
Expand All @@ -66,14 +66,14 @@ impl<T: frame_system::Config> WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
pub(crate) fn teleport_assets() -> Weight {
fn teleport_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 17_191_000 picoseconds.
Weight::from_parts(17_470_000, 0)
}
pub(crate) fn reserve_transfer_assets() -> Weight {
fn reserve_transfer_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -82,7 +82,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `Benchmark::Override` (r:0 w:0)
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn execute() -> Weight {
fn execute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -91,15 +91,15 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::SupportedVersion` (r:0 w:1)
/// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_xcm_version() -> Weight {
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_524_000 picoseconds.
Weight::from_parts(7_854_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
pub(crate) fn force_default_xcm_version() -> Weight {
fn force_default_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -120,7 +120,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::Queries` (r:0 w:1)
/// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_subscribe_version_notify() -> Weight {
fn force_subscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
Expand All @@ -141,7 +141,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `XcmPallet::Queries` (r:0 w:1)
/// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn force_unsubscribe_version_notify() -> Weight {
fn force_unsubscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `289`
// Estimated: `3754`
Expand All @@ -152,7 +152,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1)
/// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub(crate) fn force_suspension() -> Weight {
fn force_suspension() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand All @@ -162,7 +162,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::SupportedVersion` (r:4 w:2)
/// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_supported_version() -> Weight {
fn migrate_supported_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `26`
// Estimated: `10916`
Expand All @@ -173,7 +173,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifiers` (r:4 w:2)
/// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_version_notifiers() -> Weight {
fn migrate_version_notifiers() -> Weight {
// Proof Size summary in bytes:
// Measured: `30`
// Estimated: `10920`
Expand All @@ -184,7 +184,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn already_notified_target() -> Weight {
fn already_notified_target() -> Weight {
// Proof Size summary in bytes:
// Measured: `40`
// Estimated: `13405`
Expand All @@ -202,7 +202,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn notify_current_targets() -> Weight {
fn notify_current_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `6085`
Expand All @@ -213,7 +213,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:3 w:0)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn notify_target_migration_fail() -> Weight {
fn notify_target_migration_fail() -> Weight {
// Proof Size summary in bytes:
// Measured: `69`
// Estimated: `8484`
Expand All @@ -223,7 +223,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
}
/// Storage: `XcmPallet::VersionNotifyTargets` (r:4 w:2)
/// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_version_notify_targets() -> Weight {
fn migrate_version_notify_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `37`
// Estimated: `10927`
Expand All @@ -242,7 +242,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub(crate) fn migrate_and_notify_old_targets() -> Weight {
fn migrate_and_notify_old_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `149`
// Estimated: `11039`
Expand Down
4 changes: 1 addition & 3 deletions polkadot/xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,7 @@ impl<T: Config> Pallet<T> {
BuyExecution { fees, weight_limit },
DepositAsset { assets: Wild(AllCounted(max_assets)), beneficiary },
]);
let mut message = Xcm(vec![
TransferReserveAsset { assets, dest, xcm },
]);
let mut message = Xcm(vec![TransferReserveAsset { assets, dest, xcm }]);
let weight =
T::Weigher::weight(&mut message).map_err(|()| Error::<T>::UnweighableMessage)?;
let hash = message.using_encoded(sp_io::hashing::blake2_256);
Expand Down
16 changes: 8 additions & 8 deletions polkadot/xcm/xcm-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ impl<Config: config::Config> XcmExecutor<Config> {
}
Ok(())
},
// This will fail unless `jit_withdraw` has been set and there are enough funds remaining in the
// origin account to pay for delivery fees.
// This will fail unless `jit_withdraw` has been set and there are enough funds
// remaining in the origin account to pay for delivery fees.
TransferReserveAsset { mut assets, dest, xcm } => {
let origin = self.origin_ref().ok_or(XcmError::BadOrigin)?;
// Take `assets` from the origin account (on-chain) and place into dest account.
Expand Down Expand Up @@ -660,15 +660,15 @@ impl<Config: config::Config> XcmExecutor<Config> {
let maybe_delivery_fee = if self.fees_mode.jit_withdraw {
None
} else {
// we need to do this take/put cycle to solve wildcards and get exact assets to be
// weighed
// we need to do this take/put cycle to solve wildcards and get exact assets to
// be weighed
let to_weigh = self.holding.saturating_take(assets.clone());
self.holding.subsume_assets(to_weigh.clone());

let mut message_to_weigh =
vec![WithdrawAsset(to_weigh.into()), ClearOrigin];
let mut message_to_weigh = vec![WithdrawAsset(to_weigh.into()), ClearOrigin];
message_to_weigh.extend(xcm.0.clone().into_iter());
let (_, fee) = validate_send::<Config::XcmSender>(reserve, Xcm(message_to_weigh))?;
let (_, fee) =
validate_send::<Config::XcmSender>(reserve, Xcm(message_to_weigh))?;
// set aside fee to be charged by XcmSender
Some(self.holding.saturating_take(fee.into()))
};
Expand All @@ -683,7 +683,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
);
let mut message = vec![WithdrawAsset(assets), ClearOrigin];
message.extend(xcm.0.into_iter());

if let Some(fee) = maybe_delivery_fee {
// put back delivery fee in holding register to be charged by XcmSender
self.holding.subsume_assets(fee);
Expand Down

0 comments on commit b88a5ca

Please sign in to comment.