Skip to content

Commit

Permalink
change(integration-tests/asset-hub-kusama): remove test references to…
Browse files Browse the repository at this point in the history
… Sepolia testnet, and use mainnet instead.
  • Loading branch information
pandres95 committed Oct 28, 2024
1 parent 595ce90 commit 93fb88b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1055,3 +1055,58 @@ fn reserve_transfer_ksm_from_para_to_para_through_relay() {
// Receiver's balance is increased
assert!(receiver_assets_after > receiver_assets_before);
}

/// Reserve Withdraw Native Asset from AssetHub to Parachain fails.
#[test]
fn reserve_withdraw_from_untrusted_reserve_fails() {
// Init values for Parachain Origin
let destination = AssetHubKusama::sibling_location_of(PenpalA::para_id());
let signed_origin =
<AssetHubKusama as Chain>::RuntimeOrigin::signed(AssetHubKusamaSender::get().into());
let ksm_to_send: Balance = KUSAMA_ED * 10000;
let ksm_location = KsmLocation::get();

// Assets to send
let assets: Vec<Asset> = vec![(ksm_location.clone(), ksm_to_send).into()];
let fee_id: AssetId = ksm_location.into();

// this should fail
AssetHubKusama::execute_with(|| {
let result = <AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
signed_origin.clone(),
bx!(destination.clone().into()),
bx!(assets.clone().into()),
bx!(TransferType::DestinationReserve),
bx!(fee_id.into()),
bx!(TransferType::DestinationReserve),
bx!(VersionedXcm::from(Xcm::<()>::new())),
Unlimited,
);
assert_err!(
result,
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [22, 0, 0, 0],
message: Some("InvalidAssetUnsupportedReserve")
})
);
});

// this should also fail
AssetHubKusama::execute_with(|| {
let xcm: Xcm<asset_hub_kusama_runtime::RuntimeCall> = Xcm(vec![
WithdrawAsset(assets.into()),
InitiateReserveWithdraw {
assets: Wild(All),
reserve: destination,
xcm: Xcm::<()>::new(),
},
]);
let result = <AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::execute(
signed_origin,
bx!(xcm::VersionedXcm::V4(xcm)),
Weight::MAX,
);
assert!(result.is_err());
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod send_xcm;
mod teleport;

mod snowbridge {
pub const CHAIN_ID: u64 = 11155111;
pub const CHAIN_ID: u64 = 1;
pub const WETH: [u8; 20] = hex_literal::hex!("87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ pub mod bridging {
pub const EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 1 };
// TODO: @bkontur or @acatangiu, please confirm if this should be in the configuration, or if
// this `chain_id` is just for testing purposes.
pub const EthereumNetworkSnowbridgeChain: NetworkId = NetworkId::Ethereum { chain_id: 11155111 };
pub EthereumEcosystem: Location = Location::new(2, [GlobalConsensus(EthereumNetwork::get())]);
pub EthereumSnowbridge: Location = Location::new(2, [GlobalConsensus(EthereumNetworkSnowbridgeChain::get())]);
pub DotLocation: Location = Location::new(2, [GlobalConsensus(PolkadotNetwork::get())]);
pub AssetHubPolkadot: Location = Location::new(
2,
Expand Down Expand Up @@ -564,11 +562,7 @@ pub mod bridging {
/// Allow any asset native to the Polkadot or Ethereum ecosystems if it comes from Polkadot
/// Asset Hub.
pub type PolkadotOrEthereumAssetFromAssetHubPolkadot = RemoteAssetFromLocation<
(
StartsWith<DotLocation>,
StartsWith<EthereumEcosystem>,
StartsWith<EthereumSnowbridge>,
),
(StartsWith<DotLocation>, StartsWith<EthereumEcosystem>),
AssetHubPolkadot,
>;

Expand Down

0 comments on commit 93fb88b

Please sign in to comment.