Skip to content

Commit

Permalink
add bridge integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Oct 2, 2024
1 parent 31fde9f commit 9c52940
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation,
PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};
Expand Down Expand Up @@ -77,10 +78,17 @@ pub fn genesis() -> Storage {
},
foreign_assets: asset_hub_rococo_runtime::ForeignAssetsConfig {
assets: vec![
// Penpal's teleportable asset representation
// PenpalA's teleportable asset representation
(
PenpalTeleportableAssetLocation::get(),
PenpalSiblingSovereignAccount::get(),
PenpalATeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
),
// PenpalB's teleportable asset representation
(
PenpalBTeleportableAssetLocation::get(),
PenpalBSiblingSovereignAccount::get(),
false,
ED,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation,
PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};
Expand Down Expand Up @@ -75,10 +75,17 @@ pub fn genesis() -> Storage {
},
foreign_assets: asset_hub_westend_runtime::ForeignAssetsConfig {
assets: vec![
// Penpal's teleportable asset representation
// PenpalA's teleportable asset representation
(
PenpalTeleportableAssetLocation::get(),
PenpalSiblingSovereignAccount::get(),
PenpalATeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
),
// PenpalB's teleportable asset representation
(
PenpalBTeleportableAssetLocation::get(),
PenpalBSiblingSovereignAccount::get(),
false,
ED,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,26 @@ pub const TELEPORTABLE_ASSET_ID: u32 = 2;
// USDT registered on AH as (trust-backed) Asset and reserve-transferred between Parachain and AH
pub const USDT_ID: u32 = 1984;

pub const PENPAL_ID: u32 = 2000;
pub const PENPAL_A_ID: u32 = 2000;
pub const PENPAL_B_ID: u32 = 2001;
pub const ASSETS_PALLET_ID: u8 = 50;

parameter_types! {
pub PenpalTeleportableAssetLocation: xcm::v5::Location
pub PenpalATeleportableAssetLocation: xcm::v5::Location
= xcm::v5::Location::new(1, [
xcm::v5::Junction::Parachain(PENPAL_ID),
xcm::v5::Junction::Parachain(PENPAL_A_ID),
xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
pub PenpalBTeleportableAssetLocation: xcm::v5::Location
= xcm::v5::Location::new(1, [
xcm::v5::Junction::Parachain(PENPAL_B_ID),
xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalASiblingSovereignAccount: AccountId = Sibling::from(PENPAL_A_ID).into_account_truncating();
pub PenpalBSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_B_ID).into_account_truncating();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ mod imports {
penpal_emulated_chain::{
penpal_runtime::xcm_config::{
CustomizableAssetFromSystemAssetHub as PenpalCustomizableAssetFromSystemAssetHub,
LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub,
UniversalLocation as PenpalUniversalLocation,
},
PenpalAssetOwner, PenpalBParaPallet as PenpalBPallet,
Expand Down
Loading

0 comments on commit 9c52940

Please sign in to comment.