Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xcm-v5] implement RFC#122: InitiateTransfer can alias XCM original origin on destination #5971

Merged
merged 23 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
23965f1
xcm: add preserve origin capabilities to InitiateTransfer
acatangiu Oct 4, 2024
0b650f1
add origin alias helpers
acatangiu Oct 5, 2024
75da437
asset hub can proxy transact between two sibling parachains
acatangiu Oct 7, 2024
223b948
fix executor
acatangiu Oct 7, 2024
72e9fcc
fix AH transact proxy test
acatangiu Oct 7, 2024
6f17e4e
fix merge dmg
acatangiu Oct 22, 2024
55bf5da
add helper macros
acatangiu Oct 22, 2024
2113ebb
e2e test: add test for transacting on Parachain as user from Ethereum
acatangiu Oct 24, 2024
148f9a1
fix: conflicts and tests
franciscoaguirre Oct 25, 2024
4e6267f
fix: fix missing weights
franciscoaguirre Oct 25, 2024
245eae5
doc: add prdoc
franciscoaguirre Oct 25, 2024
1670e70
fix: benchmarks
franciscoaguirre Oct 25, 2024
05a4ac7
fix(asset-hub-rococo): add alias_origin benchmark
franciscoaguirre Oct 25, 2024
a05bc31
".git/.scripts/commands/fmt/fmt.sh"
Oct 25, 2024
24486a3
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2024
aacf800
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2024
530d10f
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2024
b9975d9
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2024
516f0cb
fix: clippy
franciscoaguirre Oct 25, 2024
c0701a1
fix(asset-hub-rococo): enable benchmark for alias_origin
franciscoaguirre Oct 28, 2024
22ee919
fix: clippy
franciscoaguirre Oct 28, 2024
d431a1d
fix: clippy
franciscoaguirre Oct 28, 2024
c0edd03
Merge branch 'xcm-v5' into impl-rfc-122
bkontur Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
".git/.scripts/commands/fmt/fmt.sh"
  • Loading branch information
command-bot committed Oct 25, 2024
commit a05bc3132394ca2e95293d98bf7de93213f14af2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mod imports {
xcm_helpers::{
get_amount_from_versioned_assets, non_fee_asset, xcm_transact_paid_execution,
},
ASSETS_PALLET_ID, RESERVABLE_ASSET_ID, XCM_V3, USDT_ID,
ASSETS_PALLET_ID, RESERVABLE_ASSET_ID, USDT_ID, XCM_V3,
};
pub use parachains_common::{AccountId, Balance};
pub use westend_system_emulated_network::{
Expand Down
15 changes: 7 additions & 8 deletions polkadot/xcm/src/v4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,12 @@ impl TryFrom<NewResponse> for Response {
Ok(match new {
Null => Self::Null,
Assets(assets) => Self::Assets(assets.try_into()?),
ExecutionResult(result) =>
Self::ExecutionResult(
result
.map(|(num, new_error)| (num, new_error.try_into()))
.map(|(num, result)| result.map(|inner| (num, inner)))
.transpose()?
),
ExecutionResult(result) => Self::ExecutionResult(
result
.map(|(num, new_error)| (num, new_error.try_into()))
.map(|(num, result)| result.map(|inner| (num, inner)))
.transpose()?,
),
Version(version) => Self::Version(version),
PalletsInfo(pallet_info) => {
let inner = pallet_info
Expand Down Expand Up @@ -1390,7 +1389,7 @@ impl<Call> TryFrom<NewInstruction<Call>> for Instruction<Call> {
maybe_error
.map(|(num, new_error)| (num, new_error.try_into()))
.map(|(num, result)| result.map(|inner| (num, inner)))
.transpose()?
.transpose()?,
),
ExpectTransactStatus(maybe_error_code) => Self::ExpectTransactStatus(maybe_error_code),
QueryPallet { module_name, response_info } =>
Expand Down
13 changes: 6 additions & 7 deletions polkadot/xcm/src/v5/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,12 @@ impl TryFrom<OldResponse> for Response {
Ok(match old {
Null => Self::Null,
Assets(assets) => Self::Assets(assets.try_into()?),
ExecutionResult(result) =>
Self::ExecutionResult(
result
.map(|(num, old_error)| (num, old_error.try_into()))
.map(|(num, result)| result.map(|inner| (num, inner)))
.transpose()?
),
ExecutionResult(result) => Self::ExecutionResult(
result
.map(|(num, old_error)| (num, old_error.try_into()))
.map(|(num, result)| result.map(|inner| (num, inner)))
.transpose()?,
),
Version(version) => Self::Version(version),
PalletsInfo(pallet_info) => {
let inner = pallet_info
Expand Down
41 changes: 34 additions & 7 deletions polkadot/xcm/xcm-builder/src/tests/aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ fn alias_trusted_root_location() {
}
}

type AliceOnAssetHubAliasesSiblingAccounts = AliasOriginRootUsingFilter<AliceOnAssetHub, MatchSiblingAccounts>;
type AssetHubAliasesSiblingAccounts = AliasOriginRootUsingFilter<SystemAssetHubLocation, MatchSiblingAccounts>;
type AssetHubAliasesOtherGlobalConsensus = AliasOriginRootUsingFilter<SystemAssetHubLocation, MatchOtherGlobalConsensus>;
type AliceOnAssetHubAliasesSiblingAccounts =
AliasOriginRootUsingFilter<AliceOnAssetHub, MatchSiblingAccounts>;
type AssetHubAliasesSiblingAccounts =
AliasOriginRootUsingFilter<SystemAssetHubLocation, MatchSiblingAccounts>;
type AssetHubAliasesOtherGlobalConsensus =
AliasOriginRootUsingFilter<SystemAssetHubLocation, MatchOtherGlobalConsensus>;

// Fails if origin is not the root of a chain.
assert!(!AliceOnAssetHubAliasesSiblingAccounts::contains(
Expand All @@ -188,7 +191,13 @@ fn alias_trusted_root_location() {
));
assert!(!AliceOnAssetHubAliasesSiblingAccounts::contains(
&Location::new(1, [Parachain(1000), AccountId32 { id: ALICE, network: None }]),
&Location::new(2, [GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }), AccountKey20 { key: BOB_ON_ETH, network: None }]),
&Location::new(
2,
[
GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }),
AccountKey20 { key: BOB_ON_ETH, network: None }
]
),
));
// Fails if origin doesn't match.
assert!(!AssetHubAliasesSiblingAccounts::contains(
Expand All @@ -197,7 +206,13 @@ fn alias_trusted_root_location() {
));
assert!(!AssetHubAliasesOtherGlobalConsensus::contains(
&Location::new(1, [Parachain(1001)]),
&Location::new(2, [GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }), AccountKey20 { key: BOB_ON_ETH, network: None }]),
&Location::new(
2,
[
GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }),
AccountKey20 { key: BOB_ON_ETH, network: None }
]
),
));
// Fails if filter doesn't match.
assert!(!AssetHubAliasesSiblingAccounts::contains(
Expand All @@ -206,7 +221,13 @@ fn alias_trusted_root_location() {
));
assert!(!AssetHubAliasesSiblingAccounts::contains(
&Location::new(1, [Parachain(1000)]),
&Location::new(2, [GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }), AccountKey20 { key: BOB_ON_ETH, network: None }]),
&Location::new(
2,
[
GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }),
AccountKey20 { key: BOB_ON_ETH, network: None }
]
),
));
assert!(!AssetHubAliasesOtherGlobalConsensus::contains(
&Location::new(1, [Parachain(1000)]),
Expand All @@ -219,6 +240,12 @@ fn alias_trusted_root_location() {
));
assert!(AssetHubAliasesOtherGlobalConsensus::contains(
&Location::new(1, [Parachain(1000)]),
&Location::new(2, [GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }), AccountKey20 { key: BOB_ON_ETH, network: None }]),
&Location::new(
2,
[
GlobalConsensus(NetworkId::Ethereum { chain_id: 1 }),
AccountKey20 { key: BOB_ON_ETH, network: None }
]
),
));
}
Loading