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 33 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 @@ -16,10 +16,10 @@

//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-696hpswk-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -54,8 +54,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `3593`
// Minimum execution time: 21_643_000 picoseconds.
Weight::from_parts(22_410_000, 3593)
// Minimum execution time: 34_180_000 picoseconds.
Weight::from_parts(34_745_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
Expand All @@ -65,8 +65,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `6196`
// Minimum execution time: 43_758_000 picoseconds.
Weight::from_parts(44_654_000, 6196)
// Minimum execution time: 42_638_000 picoseconds.
Weight::from_parts(43_454_000, 6196)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
Expand All @@ -90,20 +90,17 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `246`
// Estimated: `8799`
// Minimum execution time: 87_978_000 picoseconds.
Weight::from_parts(88_517_000, 8799)
// Minimum execution time: 102_916_000 picoseconds.
Weight::from_parts(105_699_000, 8799)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(5))
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
pub fn reserve_asset_deposited() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1489`
// Minimum execution time: 6_883_000 picoseconds.
Weight::from_parts(6_979_000, 1489)
.saturating_add(T::DbWeight::get().reads(1))
// Estimated: `0`
// Minimum execution time: 1_805_000 picoseconds.
Weight::from_parts(1_901_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
Expand All @@ -125,31 +122,29 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 198_882_000 picoseconds.
Weight::from_parts(199_930_000, 6196)
// Minimum execution time: 108_018_000 picoseconds.
Weight::from_parts(110_310_000, 6196)
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
pub fn receive_teleported_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_343_000 picoseconds.
Weight::from_parts(3_487_000, 0)
// Minimum execution time: 3_507_000 picoseconds.
Weight::from_parts(3_724_000, 0)
}
// Storage: `System::Account` (r:1 w:1)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
pub fn deposit_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 19_399_000 picoseconds.
Weight::from_parts(19_659_000, 3593)
// Minimum execution time: 26_269_000 picoseconds.
Weight::from_parts(26_706_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
Expand All @@ -160,6 +155,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
Expand All @@ -168,8 +165,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `6196`
// Minimum execution time: 59_017_000 picoseconds.
Weight::from_parts(60_543_000, 6196)
// Minimum execution time: 84_759_000 picoseconds.
Weight::from_parts(86_157_000, 6196)
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
Expand All @@ -193,8 +190,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 45_409_000 picoseconds.
Weight::from_parts(47_041_000, 3610)
// Minimum execution time: 50_876_000 picoseconds.
Weight::from_parts(51_512_000, 3610)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(3))
}
Expand Down
Loading
Loading