Skip to content

Commit efc4c07

Browse files
authored
Merge branch 'stable2412' into george-backport-6418
2 parents dd13399 + 61fc2d1 commit efc4c07

File tree

37 files changed

+670
-158
lines changed

37 files changed

+670
-158
lines changed

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ linked-hash-map = { version = "0.5.4" }
848848
linked_hash_set = { version = "0.1.4" }
849849
linregress = { version = "0.5.1" }
850850
lite-json = { version = "0.2.0", default-features = false }
851-
litep2p = { version = "0.8.0", features = ["websocket"] }
851+
litep2p = { version = "0.8.1", features = ["websocket"] }
852852
log = { version = "0.4.22", default-features = false }
853853
macro_magic = { version = "0.5.1" }
854854
maplit = { version = "1.0.2" }

cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pallet-xcm = { workspace = true }
3737
xcm-runtime-apis = { workspace = true }
3838

3939
# Cumulus
40+
assets-common = { workspace = true }
4041
parachains-common = { workspace = true, default-features = true }
4142
asset-test-utils = { workspace = true, default-features = true }
4243
cumulus-pallet-xcmp-queue = { workspace = true }

cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/claim_assets.rs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
1818
use crate::imports::*;
1919

20+
use assets_common::runtime_api::runtime_decl_for_fungibles_api::FungiblesApiV2;
2021
use emulated_integration_tests_common::test_chain_can_claim_assets;
22+
use frame_support::traits::fungible::Mutate;
2123
use xcm_executor::traits::DropAssets;
2224

2325
#[test]
@@ -33,3 +35,83 @@ fn assets_can_be_claimed() {
3335
amount
3436
);
3537
}
38+
39+
#[test]
40+
fn chain_can_claim_assets_for_its_users() {
41+
// Many Penpal users have assets trapped in AssetHubWestend.
42+
let beneficiaries: Vec<(Location, Assets)> = vec![
43+
// Some WND.
44+
(
45+
Location::new(1, [Parachain(2000), AccountId32 { id: [0u8; 32], network: None }]),
46+
(Parent, 10_000_000_000_000u128).into(),
47+
),
48+
// Some USDT.
49+
(
50+
Location::new(1, [Parachain(2000), AccountId32 { id: [1u8; 32], network: None }]),
51+
([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ID.into())], 100_000_000u128)
52+
.into(),
53+
),
54+
];
55+
56+
// Start with those assets trapped.
57+
AssetHubWestend::execute_with(|| {
58+
for (location, assets) in &beneficiaries {
59+
<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::drop_assets(
60+
location,
61+
assets.clone().into(),
62+
&XcmContext { origin: None, message_id: [0u8; 32], topic: None },
63+
);
64+
}
65+
});
66+
67+
let penpal_to_asset_hub = PenpalA::sibling_location_of(AssetHubWestend::para_id());
68+
let mut builder = Xcm::<()>::builder()
69+
.withdraw_asset((Parent, 1_000_000_000_000u128))
70+
.pay_fees((Parent, 100_000_000_000u128));
71+
72+
// Loop through all beneficiaries.
73+
for (location, assets) in &beneficiaries {
74+
builder = builder.execute_with_origin(
75+
// We take only the last part, the `AccountId32` junction.
76+
Some((*location.interior().last().unwrap()).into()),
77+
Xcm::<()>::builder_unsafe()
78+
.claim_asset(assets.clone(), Location::new(0, [GeneralIndex(5)])) // Means lost assets were version 5.
79+
.deposit_asset(assets.clone(), location.clone())
80+
.build(),
81+
)
82+
}
83+
84+
// Finish assembling the message.
85+
let message = builder.build();
86+
87+
// Fund PenpalA's sovereign account on AssetHubWestend so it can pay for fees.
88+
AssetHubWestend::execute_with(|| {
89+
let penpal_as_seen_by_asset_hub = AssetHubWestend::sibling_location_of(PenpalA::para_id());
90+
let penpal_sov_account_on_asset_hub =
91+
AssetHubWestend::sovereign_account_id_of(penpal_as_seen_by_asset_hub);
92+
type Balances = <AssetHubWestend as AssetHubWestendPallet>::Balances;
93+
assert_ok!(<Balances as Mutate<_>>::mint_into(
94+
&penpal_sov_account_on_asset_hub,
95+
2_000_000_000_000u128,
96+
));
97+
});
98+
99+
// We can send a message from Penpal root that claims all those assets for each beneficiary.
100+
PenpalA::execute_with(|| {
101+
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
102+
<PenpalA as Chain>::RuntimeOrigin::root(),
103+
bx!(penpal_to_asset_hub.into()),
104+
bx!(VersionedXcm::from(message)),
105+
));
106+
});
107+
108+
// We assert beneficiaries have received their funds.
109+
AssetHubWestend::execute_with(|| {
110+
for (location, expected_assets) in &beneficiaries {
111+
let sov_account = AssetHubWestend::sovereign_account_id_of(location.clone());
112+
let actual_assets =
113+
<AssetHubWestend as Chain>::Runtime::query_account_balances(sov_account).unwrap();
114+
assert_eq!(VersionedAssets::from(expected_assets.clone()), actual_assets);
115+
}
116+
});
117+
}

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,7 @@ impl<Call> XcmWeightInfo<Call> for AssetHubRococoXcmWeight<Call> {
253253
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
254254
XcmGeneric::<Runtime>::unpaid_execution()
255255
}
256+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
257+
XcmGeneric::<Runtime>::execute_with_origin()
258+
}
256259
}

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
373373
// Minimum execution time: 668_000 picoseconds.
374374
Weight::from_parts(726_000, 0)
375375
}
376+
pub fn execute_with_origin() -> Weight {
377+
// Proof Size summary in bytes:
378+
// Measured: `0`
379+
// Estimated: `0`
380+
// Minimum execution time: 713_000 picoseconds.
381+
Weight::from_parts(776_000, 0)
382+
}
376383
}

cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,7 @@ impl<Call> XcmWeightInfo<Call> for AssetHubWestendXcmWeight<Call> {
253253
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
254254
XcmGeneric::<Runtime>::unpaid_execution()
255255
}
256+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
257+
XcmGeneric::<Runtime>::execute_with_origin()
258+
}
256259
}

cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
373373
// Minimum execution time: 638_000 picoseconds.
374374
Weight::from_parts(708_000, 0)
375375
}
376+
pub fn execute_with_origin() -> Weight {
377+
// Proof Size summary in bytes:
378+
// Measured: `0`
379+
// Estimated: `0`
380+
// Minimum execution time: 713_000 picoseconds.
381+
Weight::from_parts(776_000, 0)
382+
}
376383
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubRococoXcmWeight<Call> {
256256
fn set_asset_claimer(_location: &Location) -> Weight {
257257
XcmGeneric::<Runtime>::set_asset_claimer()
258258
}
259+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
260+
XcmGeneric::<Runtime>::execute_with_origin()
261+
}
259262
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
380380
// Minimum execution time: 707_000 picoseconds.
381381
Weight::from_parts(749_000, 0)
382382
}
383+
pub fn execute_with_origin() -> Weight {
384+
// Proof Size summary in bytes:
385+
// Measured: `0`
386+
// Estimated: `0`
387+
// Minimum execution time: 713_000 picoseconds.
388+
Weight::from_parts(776_000, 0)
389+
}
383390
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
257257
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
258258
XcmGeneric::<Runtime>::unpaid_execution()
259259
}
260+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
261+
XcmGeneric::<Runtime>::execute_with_origin()
262+
}
260263
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
380380
// Minimum execution time: 707_000 picoseconds.
381381
Weight::from_parts(749_000, 0)
382382
}
383+
pub fn execute_with_origin() -> Weight {
384+
// Proof Size summary in bytes:
385+
// Measured: `0`
386+
// Estimated: `0`
387+
// Minimum execution time: 713_000 picoseconds.
388+
Weight::from_parts(776_000, 0)
389+
}
383390
}

cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,7 @@ impl<Call> XcmWeightInfo<Call> for CoretimeRococoXcmWeight<Call> {
254254
fn set_asset_claimer(_location: &Location) -> Weight {
255255
XcmGeneric::<Runtime>::set_asset_claimer()
256256
}
257+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
258+
XcmGeneric::<Runtime>::execute_with_origin()
259+
}
257260
}

cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
338338
// Minimum execution time: 707_000 picoseconds.
339339
Weight::from_parts(749_000, 0)
340340
}
341+
pub fn execute_with_origin() -> Weight {
342+
// Proof Size summary in bytes:
343+
// Measured: `0`
344+
// Estimated: `0`
345+
// Minimum execution time: 713_000 picoseconds.
346+
Weight::from_parts(776_000, 0)
347+
}
341348
}

cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,7 @@ impl<Call> XcmWeightInfo<Call> for CoretimeWestendXcmWeight<Call> {
254254
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
255255
XcmGeneric::<Runtime>::unpaid_execution()
256256
}
257+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
258+
XcmGeneric::<Runtime>::execute_with_origin()
259+
}
257260
}

cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
338338
// Minimum execution time: 707_000 picoseconds.
339339
Weight::from_parts(749_000, 0)
340340
}
341+
pub fn execute_with_origin() -> Weight {
342+
// Proof Size summary in bytes:
343+
// Measured: `0`
344+
// Estimated: `0`
345+
// Minimum execution time: 713_000 picoseconds.
346+
Weight::from_parts(776_000, 0)
347+
}
341348
}

cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,7 @@ impl<Call> XcmWeightInfo<Call> for PeopleRococoXcmWeight<Call> {
253253
fn set_asset_claimer(_location: &Location) -> Weight {
254254
XcmGeneric::<Runtime>::set_asset_claimer()
255255
}
256+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
257+
XcmGeneric::<Runtime>::execute_with_origin()
258+
}
256259
}

cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
338338
// Minimum execution time: 707_000 picoseconds.
339339
Weight::from_parts(749_000, 0)
340340
}
341+
pub fn execute_with_origin() -> Weight {
342+
// Proof Size summary in bytes:
343+
// Measured: `0`
344+
// Estimated: `0`
345+
// Minimum execution time: 713_000 picoseconds.
346+
Weight::from_parts(776_000, 0)
347+
}
341348
}

cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,7 @@ impl<Call> XcmWeightInfo<Call> for PeopleWestendXcmWeight<Call> {
253253
fn set_asset_claimer(_location: &Location) -> Weight {
254254
XcmGeneric::<Runtime>::set_asset_claimer()
255255
}
256+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
257+
XcmGeneric::<Runtime>::execute_with_origin()
258+
}
256259
}

cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
338338
// Minimum execution time: 707_000 picoseconds.
339339
Weight::from_parts(749_000, 0)
340340
}
341+
pub fn execute_with_origin() -> Weight {
342+
// Proof Size summary in bytes:
343+
// Measured: `0`
344+
// Estimated: `0`
345+
// Minimum execution time: 713_000 picoseconds.
346+
Weight::from_parts(776_000, 0)
347+
}
341348
}

polkadot/runtime/rococo/src/weights/pallet_xcm_benchmarks_generic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,11 @@ impl<T: frame_system::Config> pallet_xcm_benchmarks::generic::WeightInfo for Wei
344344
Weight::from_parts(1_354_000, 0)
345345
.saturating_add(Weight::from_parts(0, 0))
346346
}
347+
fn execute_with_origin() -> Weight {
348+
// Proof Size summary in bytes:
349+
// Measured: `0`
350+
// Estimated: `0`
351+
// Minimum execution time: 713_000 picoseconds.
352+
Weight::from_parts(776_000, 0)
353+
}
347354
}

polkadot/runtime/rococo/src/weights/xcm/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for RococoXcmWeight<RuntimeCall> {
289289
fn set_asset_claimer(_location: &Location) -> Weight {
290290
XcmGeneric::<Runtime>::set_asset_claimer()
291291
}
292+
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<RuntimeCall>) -> Weight {
293+
XcmGeneric::<Runtime>::execute_with_origin()
294+
}
292295
}
293296

294297
#[test]

0 commit comments

Comments
 (0)