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-executor: allow deposit of multiple assets if at least one of them satisfies ED #4460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2de5654
check if at least one of the transactions satisfy existential deposit
jpserrat May 14, 2024
b9643e5
refactor deposit failed due to ED to a helper function
jpserrat Jun 9, 2024
487cf05
minor fixes
jpserrat Jul 18, 2024
1d26287
remove unused import
jpserrat Jul 18, 2024
f2be9eb
Merge branch 'master' of github.com:paritytech/polkadot-sdk into jpse…
jpserrat Aug 3, 2024
a4eb3be
retry only if there is at least one sucessufull deposit
jpserrat Aug 4, 2024
52682e4
Merge branch 'master' of github.com:paritytech/polkadot-sdk into jpse…
acatangiu Aug 7, 2024
d0ae626
address comments
acatangiu Aug 7, 2024
1a89812
add prdoc
acatangiu Aug 7, 2024
5567e0c
emulated-tests: AH test assets not sufficient
acatangiu Aug 7, 2024
895bd62
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 8, 2024
90906b1
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=ro…
Aug 8, 2024
521aab4
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=we…
Aug 8, 2024
235b86c
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 8, 2024
c4b5495
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 8, 2024
899a52b
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 8, 2024
cd1942f
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 8, 2024
e76eea7
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 8, 2024
b068eac
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 8, 2024
bba43d9
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 8, 2024
d576c4a
fix: people chains had odd weight files for xcm
franciscoaguirre Aug 8, 2024
bc0759e
fix: typos and missing functions
franciscoaguirre Aug 8, 2024
3d80dc8
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 8, 2024
62a40a3
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 8, 2024
0036c93
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 9, 2024
516bed8
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 9, 2024
636e06d
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 9, 2024
d5c9d4b
emulated tests: add regression test
acatangiu Aug 9, 2024
c9ae0c2
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 9, 2024
22e50b2
fix test after new weights
acatangiu Aug 9, 2024
8b960a4
Merge branch 'master' of github.com:paritytech/polkadot-sdk into jpse…
acatangiu Aug 9, 2024
955f4ac
update prdoc
acatangiu Aug 9, 2024
e565f31
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 9, 2024
fe142fa
fix people emulated tests after weights update
acatangiu Aug 9, 2024
948db98
fix(people): remove unnecessary import
franciscoaguirre Aug 9, 2024
e628819
Merge branch 'master' into jpserrat/depositing-multiple-assets
franciscoaguirre Aug 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub mod accounts {
pub const EVE_STASH: &str = "Eve//stash";
pub const FERDIE_STASH: &str = "Ferdie//stash";
pub const FERDIE_BEEFY: &str = "Ferdie//stash";
pub const DUMMY_EMPTY: &str = "JohnDoe";

pub fn init_balances() -> Vec<AccountId> {
vec![
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ mod imports {
// Cumulus
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter,
accounts::DUMMY_EMPTY,
get_account_id_from_seed, test_parachain_is_trusted_teleporter,
xcm_emulator::{
assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
TestArgs, TestContext, TestExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,9 @@ fn reserve_transfer_assets_from_system_para_to_para() {

/// Reserve Transfers of a random asset and native asset from Parachain to System Para should
/// work
/// Receiver is empty account to show deposit works as long as transfer includes enough DOT for ED.
/// Once we have https://github.com/paritytech/polkadot-sdk/issues/5298,
/// we should do equivalent test with USDT instead of DOT.
#[test]
fn reserve_transfer_assets_from_para_to_system_para() {
// Init values for Parachain
Expand All @@ -965,24 +968,23 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Fund Parachain's sender account with some foreign assets
PenpalA::mint_foreign_asset(
penpal_asset_owner_signer.clone(),
asset_location_on_penpal,
asset_location_on_penpal.clone(),
sender.clone(),
asset_amount_to_send * 2,
);
// Fund Parachain's sender account with some system assets
PenpalA::mint_foreign_asset(
penpal_asset_owner_signer,
system_asset_location_on_penpal,
system_asset_location_on_penpal.clone(),
sender.clone(),
fee_amount_to_send * 2,
);

// Beneficiary is a new (empty) account
let receiver = get_account_id_from_seed::<sp_runtime::testing::sr25519::Public>(DUMMY_EMPTY);
// Init values for System Parachain
let receiver = AssetHubRococoReceiver::get();
let penpal_location_as_seen_by_ahr = AssetHubRococo::sibling_location_of(PenpalA::para_id());
let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
let system_para_native_asset_location = RelayLocation::get();
let system_para_foreign_asset_location = PenpalLocalReservableFromAssetHub::get();
let ah_asset_owner = AssetHubRococoAssetOwner::get();
let ah_asset_owner_signer = <AssetHubRococo as Chain>::RuntimeOrigin::signed(ah_asset_owner);

Expand Down Expand Up @@ -1017,11 +1019,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Query initial balances
let sender_system_assets_before = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &sender)
<ForeignAssets as Inspect<_>>::balance(system_asset_location_on_penpal.clone(), &sender)
});
let sender_foreign_assets_before = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location.clone(), &sender)
<ForeignAssets as Inspect<_>>::balance(asset_location_on_penpal.clone(), &sender)
});
let receiver_balance_before = test.receiver.balance;
let receiver_assets_before = AssetHubRococo::execute_with(|| {
Expand All @@ -1038,11 +1040,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Query final balances
let sender_system_assets_after = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &sender)
<ForeignAssets as Inspect<_>>::balance(system_asset_location_on_penpal, &sender)
});
let sender_foreign_assets_after = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location, &sender)
<ForeignAssets as Inspect<_>>::balance(asset_location_on_penpal, &sender)
});
let receiver_balance_after = test.receiver.balance;
let receiver_assets_after = AssetHubRococo::execute_with(|| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ mod imports {
// Cumulus
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter,
accounts::DUMMY_EMPTY,
get_account_id_from_seed, test_parachain_is_trusted_teleporter,
xcm_emulator::{
assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
TestArgs, TestContext, TestExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,9 @@ fn reserve_transfer_assets_from_system_para_to_para() {

/// Reserve Transfers of a random asset and native asset from Parachain to System Para should
/// work
/// Receiver is empty account to show deposit works as long as transfer includes enough DOT for ED.
/// Once we have https://github.com/paritytech/polkadot-sdk/issues/5298,
/// we should do equivalent test with USDT instead of DOT.
#[test]
fn reserve_transfer_assets_from_para_to_system_para() {
// Init values for Parachain
Expand All @@ -966,25 +969,24 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Fund Parachain's sender account with some foreign assets
PenpalA::mint_foreign_asset(
penpal_asset_owner_signer.clone(),
asset_location_on_penpal,
asset_location_on_penpal.clone(),
sender.clone(),
asset_amount_to_send * 2,
);
// Fund Parachain's sender account with some system assets
PenpalA::mint_foreign_asset(
penpal_asset_owner_signer,
system_asset_location_on_penpal,
system_asset_location_on_penpal.clone(),
sender.clone(),
fee_amount_to_send * 2,
);

// Beneficiary is a new (empty) account
let receiver = get_account_id_from_seed::<sp_runtime::testing::sr25519::Public>(DUMMY_EMPTY);
// Init values for System Parachain
let receiver = AssetHubWestendReceiver::get();
let penpal_location_as_seen_by_ahr = AssetHubWestend::sibling_location_of(PenpalA::para_id());
let sov_penpal_on_ahr =
AssetHubWestend::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
let system_para_native_asset_location = RelayLocation::get();
let system_para_foreign_asset_location = PenpalLocalReservableFromAssetHub::get();
let ah_asset_owner = AssetHubWestendAssetOwner::get();
let ah_asset_owner_signer = <AssetHubWestend as Chain>::RuntimeOrigin::signed(ah_asset_owner);

Expand Down Expand Up @@ -1019,11 +1021,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Query initial balances
let sender_system_assets_before = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &sender)
<ForeignAssets as Inspect<_>>::balance(system_asset_location_on_penpal.clone(), &sender)
});
let sender_foreign_assets_before = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location.clone(), &sender)
<ForeignAssets as Inspect<_>>::balance(asset_location_on_penpal.clone(), &sender)
});
let receiver_balance_before = test.receiver.balance;
let receiver_assets_before = AssetHubWestend::execute_with(|| {
Expand All @@ -1040,11 +1042,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
// Query final balances
let sender_system_assets_after = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location, &sender)
<ForeignAssets as Inspect<_>>::balance(system_asset_location_on_penpal, &sender)
});
let sender_foreign_assets_after = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location, &sender)
<ForeignAssets as Inspect<_>>::balance(asset_location_on_penpal, &sender)
});
let receiver_balance_after = test.receiver.balance;
let receiver_assets_after = AssetHubWestend::execute_with(|| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ fn send_token_from_ethereum_to_non_existent_account_on_asset_hub_with_insufficie
#[test]
fn send_token_from_ethereum_to_non_existent_account_on_asset_hub_with_sufficient_fee_but_do_not_satisfy_ed(
) {
// On AH the xcm fee is 33_873_024 and the ED is 3_300_000
send_token_from_ethereum_to_asset_hub_with_fee([1; 32], 36_000_000);
// On AH the xcm fee is 26_789_690 and the ED is 3_300_000
send_token_from_ethereum_to_asset_hub_with_fee([1; 32], 30_000_000);

AssetHubRococo::execute_with(|| {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mod imports {
// Substrate
pub use frame_support::{
assert_ok,
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchResult},
traits::fungibles::Inspect,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::imports::*;

fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Rococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(627_959_000, 7_200)));
Rococo::assert_xcm_pallet_attempted_complete(None);

assert_expected_events!(
Rococo,
Expand All @@ -39,11 +39,7 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {
fn relay_dest_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;

Rococo::assert_ump_queue_processed(
true,
Some(PeopleRococo::para_id()),
Some(Weight::from_parts(304_266_000, 7_186)),
);
Rococo::assert_ump_queue_processed(true, Some(PeopleRococo::para_id()), None);

assert_expected_events!(
Rococo,
Expand All @@ -62,20 +58,13 @@ fn relay_dest_assertions(t: SystemParaToRelayTest) {
}

fn relay_dest_assertions_fail(_t: SystemParaToRelayTest) {
Rococo::assert_ump_queue_processed(
false,
Some(PeopleRococo::para_id()),
Some(Weight::from_parts(157_718_000, 3_593)),
);
Rococo::assert_ump_queue_processed(false, Some(PeopleRococo::para_id()), None);
}

fn para_origin_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <PeopleRococo as Chain>::RuntimeEvent;

PeopleRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
600_000_000,
7_000,
)));
PeopleRococo::assert_xcm_pallet_attempted_complete(None);

PeopleRococo::assert_parachain_system_ump_sent();

Expand All @@ -94,7 +83,7 @@ fn para_origin_assertions(t: SystemParaToRelayTest) {
fn para_dest_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <PeopleRococo as Chain>::RuntimeEvent;

PeopleRococo::assert_dmp_queue_complete(Some(Weight::from_parts(162_456_000, 0)));
PeopleRococo::assert_dmp_queue_complete(None);

assert_expected_events!(
PeopleRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mod imports {
// Substrate
pub use frame_support::{
assert_ok,
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchResult},
traits::fungibles::Inspect,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::imports::*;

fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Westend as Chain>::RuntimeEvent;
Westend::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(627_959_000, 7_200)));
Westend::assert_xcm_pallet_attempted_complete(None);

assert_expected_events!(
Westend,
Expand All @@ -39,11 +39,7 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {
fn relay_dest_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <Westend as Chain>::RuntimeEvent;

Westend::assert_ump_queue_processed(
true,
Some(PeopleWestend::para_id()),
Some(Weight::from_parts(304_266_000, 7_186)),
);
Westend::assert_ump_queue_processed(true, Some(PeopleWestend::para_id()), None);

assert_expected_events!(
Westend,
Expand All @@ -62,20 +58,13 @@ fn relay_dest_assertions(t: SystemParaToRelayTest) {
}

fn relay_dest_assertions_fail(_t: SystemParaToRelayTest) {
Westend::assert_ump_queue_processed(
false,
Some(PeopleWestend::para_id()),
Some(Weight::from_parts(157_718_000, 3_593)),
);
Westend::assert_ump_queue_processed(false, Some(PeopleWestend::para_id()), None);
}

fn para_origin_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <PeopleWestend as Chain>::RuntimeEvent;

PeopleWestend::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
351_425_000,
3_593,
)));
PeopleWestend::assert_xcm_pallet_attempted_complete(None);

PeopleWestend::assert_parachain_system_ump_sent();

Expand All @@ -94,7 +83,7 @@ fn para_origin_assertions(t: SystemParaToRelayTest) {
fn para_dest_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <PeopleWestend as Chain>::RuntimeEvent;

PeopleWestend::assert_dmp_queue_complete(Some(Weight::from_parts(162_456_000, 0)));
PeopleWestend::assert_dmp_queue_complete(None);

assert_expected_events!(
PeopleWestend,
Expand Down
Loading
Loading