Skip to content

Commit 09290c8

Browse files
authored
Merge branch 'stable2412' into ib-remove-pallet-revive-from-sdk
2 parents 0ca6dfe + d713296 commit 09290c8

File tree

6 files changed

+15
-279
lines changed

6 files changed

+15
-279
lines changed

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

-82
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
1818
use crate::imports::*;
1919

20-
use assets_common::runtime_api::runtime_decl_for_fungibles_api::FungiblesApiV2;
2120
use emulated_integration_tests_common::test_chain_can_claim_assets;
22-
use frame_support::traits::fungible::Mutate;
2321
use xcm_executor::traits::DropAssets;
2422

2523
#[test]
@@ -35,83 +33,3 @@ fn assets_can_be_claimed() {
3533
amount
3634
);
3735
}
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-
}

polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ benchmarks! {
240240
let instruction = Instruction::ExecuteWithOrigin { descendant_origin: Some(who.clone()), xcm: Xcm(vec![]) };
241241
let xcm = Xcm(vec![instruction]);
242242
}: {
243-
executor.bench_process(xcm)?;
243+
executor
244+
.bench_process(xcm)
245+
.map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?;
244246
} verify {
245247
assert_eq!(
246248
executor.origin(),

polkadot/xcm/xcm-executor/src/lib.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -1049,24 +1049,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
10491049
},
10501050
DescendOrigin(who) => self.do_descend_origin(who),
10511051
ClearOrigin => self.do_clear_origin(),
1052-
ExecuteWithOrigin { descendant_origin, xcm } => {
1053-
let previous_origin = self.context.origin.clone();
1054-
1055-
// Set new temporary origin.
1056-
if let Some(who) = descendant_origin {
1057-
self.do_descend_origin(who)?;
1058-
} else {
1059-
self.do_clear_origin()?;
1060-
}
1061-
// Process instructions.
1062-
let result = self.process(xcm).map_err(|error| {
1063-
tracing::error!(target: "xcm::execute", ?error, actual_origin = ?self.context.origin, original_origin = ?previous_origin, "ExecuteWithOrigin inner xcm failure");
1064-
error.xcm_error
1065-
});
1066-
// Reset origin to previous one.
1067-
self.context.origin = previous_origin;
1068-
result
1069-
},
1052+
ExecuteWithOrigin { .. } => Err(XcmError::Unimplemented),
10701053
ReportError(response_info) => {
10711054
// Report the given result by sending a QueryResponse XCM to a previously given
10721055
// outcome destination if one was registered.

polkadot/xcm/xcm-executor/src/tests/execute_with_origin.rs

-177
This file was deleted.

polkadot/xcm/xcm-executor/src/tests/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//! `xcm-emulator` based tests in the cumulus folder.
2121
//! These tests deal with internal state changes of the XCVM.
2222
23-
mod execute_with_origin;
2423
mod initiate_transfer;
2524
mod mock;
2625
mod pay_fees;

prdoc/pr_7899.prdoc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: Remove execute_with_origin implementation in the XCM executor
2+
doc:
3+
- audience: Runtime Dev
4+
description: |
5+
The XCM executor will not support the `ExecuteWithOrigin` instruction from the start.
6+
It might be added later when more time can be spent on it.
7+
crates:
8+
- name: pallet-xcm-benchmarks
9+
bump: patch
10+
- name: staging-xcm-executor
11+
bump: patch

0 commit comments

Comments
 (0)