Skip to content

Commit

Permalink
Removed unnecessary PoolAssetsPalletLocationV3 and `LocalTeleportab…
Browse files Browse the repository at this point in the history
…leToAssetHubV3`
  • Loading branch information
bkontur committed Feb 29, 2024
1 parent 515cdad commit ea3ebe4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

mod genesis;
pub use genesis::{genesis, ED, PARA_ID_A, PARA_ID_B};
pub use penpal_runtime::xcm_config::{LocalTeleportableToAssetHubV3, XcmConfig};
pub use penpal_runtime::xcm_config::{LocalTeleportableToAssetHub, XcmConfig};

// Substrate
use frame_support::traits::OnInitialize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
// limitations under the License.

use crate::*;
use kusama_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHubV3 as PenpalLocalTeleportableToAssetHubV3;
use kusama_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub;
use sp_runtime::ModuleError;
use system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT;

#[test]
fn swap_locally_on_chain_using_local_assets() {
let asset_native = Box::new(asset_hub_kusama_runtime::xcm_config::KsmLocationV3::get());
let asset_native = Box::new(
v3::Location::try_from(asset_hub_kusama_runtime::xcm_config::KsmLocation::get())
.expect("conversion works"),
);
let asset_one = Box::new(v3::Location::new(
0,
[
Expand Down Expand Up @@ -116,9 +119,14 @@ fn swap_locally_on_chain_using_local_assets() {

#[test]
fn swap_locally_on_chain_using_foreign_assets() {
let asset_native = Box::new(asset_hub_kusama_runtime::xcm_config::KsmLocationV3::get());
let asset_native = Box::new(
v3::Location::try_from(asset_hub_kusama_runtime::xcm_config::KsmLocation::get())
.expect("conversion works"),
);

let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubKusama::para_id());
let asset_location_on_penpal = PenpalLocalTeleportableToAssetHubV3::get();
let asset_location_on_penpal =
v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).expect("conversion works");
let asset_id_on_penpal = match asset_location_on_penpal.last() {
Some(v3::Junction::GeneralIndex(id)) => *id as u32,
_ => unreachable!(),
Expand Down Expand Up @@ -242,11 +250,14 @@ fn swap_locally_on_chain_using_foreign_assets() {

#[test]
fn cannot_create_pool_from_pool_assets() {
let asset_native = asset_hub_kusama_runtime::xcm_config::KsmLocationV3::get();
let mut asset_one = asset_hub_kusama_runtime::xcm_config::PoolAssetsPalletLocationV3::get();
asset_one
.append_with(v3::Junction::GeneralIndex(ASSET_ID.into()))
.expect("pool assets");
let asset_native = asset_hub_kusama_runtime::xcm_config::KsmLocation::get()
.try_into()
.expect("conversion works");
let asset_one = asset_hub_kusama_runtime::xcm_config::PoolAssetsPalletLocation::get()
.appended_with(GeneralIndex(ASSET_ID.into()))
.expect("valid location")
.try_into()
.expect("conversion works");

AssetHubKusama::execute_with(|| {
let pool_owner_account_id = asset_hub_kusama_runtime::AssetConversionOrigin::get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::*;
use asset_hub_kusama_runtime::xcm_config::XcmConfig as AssetHubKusamaXcmConfig;
use emulated_integration_tests_common::xcm_helpers::non_fee_asset;
use kusama_runtime::xcm_config::XcmConfig as KusamaXcmConfig;
use kusama_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHubV3 as PenpalLocalTeleportableToAssetHubV3;
use kusama_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub;

fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Kusama as Chain>::RuntimeEvent;
Expand Down Expand Up @@ -559,7 +559,8 @@ fn teleport_to_other_system_parachains_works() {
#[test]
fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubKusama::para_id());
let asset_location_on_penpal = PenpalLocalTeleportableToAssetHubV3::get();
let asset_location_on_penpal =
v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).expect("conversion works");
let asset_id_on_penpal = match asset_location_on_penpal.last() {
Some(v3::Junction::GeneralIndex(id)) => *id as u32,
_ => unreachable!(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::*;
use asset_hub_polkadot_runtime::xcm_config::XcmConfig as AssetHubPolkadotXcmConfig;
use emulated_integration_tests_common::xcm_helpers::non_fee_asset;
use polkadot_runtime::xcm_config::XcmConfig as PolkadotXcmConfig;
use polkadot_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHubV3 as PenpalLocalTeleportableToAssetHubV3;
use polkadot_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub;

fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Polkadot as Chain>::RuntimeEvent;
Expand Down Expand Up @@ -559,7 +559,8 @@ fn teleport_to_other_system_parachains_works() {
#[test]
fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
let ah_as_seen_by_penpal = PenpalB::sibling_location_of(AssetHubPolkadot::para_id());
let asset_location_on_penpal = PenpalLocalTeleportableToAssetHubV3::get();
let asset_location_on_penpal =
v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).expect("conversion works");
let asset_id_on_penpal = match asset_location_on_penpal.last() {
Some(v3::Junction::GeneralIndex(id)) => *id as u32,
_ => unreachable!(),
Expand Down
4 changes: 2 additions & 2 deletions relay/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() {
panic!("can't decode XCM blob")
};
let old_xcm_v3: xcm::v3::Xcm<super::RuntimeCall> =
old_xcm_v2.try_into().expect("conversion from v2 to v3 failed");
old_xcm_v2.try_into().expect("conversion from v2 to v3 works");
let mut xcm: Xcm<super::RuntimeCall> =
old_xcm_v3.try_into().expect("conversion from v3 to latest failed");
old_xcm_v3.try_into().expect("conversion from v3 to latest works");
let weight = <XcmConfig as xcm_executor::Config>::Weigher::weight(&mut xcm)
.expect("weighing XCM failed");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ parameter_types! {
PalletInstance(<ForeignAssets as PalletInfoAccess>::index() as u8).into();
pub PoolAssetsPalletLocation: Location =
PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into();
pub PoolAssetsPalletLocationV3: xcm::v3::Location =
xcm::v3::Junction::PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: Location = Location::parent();
pub const FellowshipLocation: Location = Location::parent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ fn receive_reserve_asset_deposited_ksm_from_asset_hub_kusama_fees_paid_by_suffic
)
}


#[test]
fn reserve_transfer_native_asset_to_non_teleport_para_works() {
asset_test_utils::test_cases::reserve_transfer_native_asset_to_non_teleport_para_works::<
Expand Down

0 comments on commit ea3ebe4

Please sign in to comment.