From 97ff40a1ee40064e5bfc6cd2c65c5a06f0993d02 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Fri, 6 Sep 2024 15:31:37 +0200 Subject: [PATCH] test fixes --- .../asset-hub-paseo/tests/snowbridge.rs | 6 ++--- .../asset-hub-paseo/tests/tests.rs | 16 ++++++------- .../asset-hub-paseo/tests/weight_trader.rs | 23 ++++++++++--------- .../bridge-hub-paseo/tests/snowbridge.rs | 10 +++++--- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/system-parachains/asset-hub-paseo/tests/snowbridge.rs b/system-parachains/asset-hub-paseo/tests/snowbridge.rs index 05dff0b..7c410c1 100644 --- a/system-parachains/asset-hub-paseo/tests/snowbridge.rs +++ b/system-parachains/asset-hub-paseo/tests/snowbridge.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use asset_hub_polkadot_runtime::xcm_config::bridging::{ +use asset_hub_paseo_runtime::xcm_config::bridging::{ to_ethereum::{BridgeHubEthereumBaseFee, BridgeTable, EthereumNetwork}, SiblingBridgeHub, XcmBridgeHubRouterFeeAssetId, }; @@ -54,8 +54,8 @@ fn network_export_table_works() { .into(), None, ), - // From Ethereum with the Sepolia chain ID instead of Mainnet, not matched. - (NetworkId::Ethereum { chain_id: 11155111 }, Junctions::Here, None), + // From Ethereum with the Mainnet chain ID instead of Sepolia, not matched. + (NetworkId::Ethereum { chain_id: 1 }, Junctions::Here, None), ]; for (network, remote_location, expected_result) in test_data { diff --git a/system-parachains/asset-hub-paseo/tests/tests.rs b/system-parachains/asset-hub-paseo/tests/tests.rs index a4e6c93..049ec29 100644 --- a/system-parachains/asset-hub-paseo/tests/tests.rs +++ b/system-parachains/asset-hub-paseo/tests/tests.rs @@ -19,23 +19,23 @@ use asset_hub_paseo_runtime::{ xcm_config::{ - bridging::{self, XcmBridgeHubRouterFeeAssetId}, + bridging::self, CheckingAccount, DotLocation, ForeignCreatorsSovereignAccountOf, LocationToAccountId, - RelayTreasuryLocation, RelayTreasuryPalletAccount, StakingPot, + RelayTreasuryLocation, RelayTreasuryPalletAccount, TrustBackedAssetsPalletLocation, XcmConfig, }, AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, - ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, + ParachainSystem, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, TrustBackedAssetsInstance, XcmpQueue, }; use asset_test_utils::{ - test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder, + CollatorSessionKey, CollatorSessionKeys, ExtBuilder, }; use codec::{Decode, Encode}; use frame_support::{assert_ok, traits::fungibles::InspectEnumerable}; use parachains_common::{ - AccountId, AssetHubPaseoAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, + AccountId, AuraId, AssetIdForTrustBackedAssets, Balance, }; use parachains_runtimes_test_utils::SlotDurations; use sp_consensus_aura::SlotDuration; @@ -60,7 +60,7 @@ fn collator_session_key(account: [u8; 32]) -> CollatorSessionKey { CollatorSessionKey::new( AccountId::from(account), AccountId::from(account), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(account)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(account)) }, ) } @@ -128,7 +128,7 @@ fn test_ed_is_one_hundredth_of_relay() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -147,7 +147,7 @@ fn test_assets_balances_api_works() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { diff --git a/system-parachains/asset-hub-paseo/tests/weight_trader.rs b/system-parachains/asset-hub-paseo/tests/weight_trader.rs index a7732b0..e5e8613 100644 --- a/system-parachains/asset-hub-paseo/tests/weight_trader.rs +++ b/system-parachains/asset-hub-paseo/tests/weight_trader.rs @@ -15,7 +15,7 @@ //! Tests for `WeighTrader` type of XCM Executor. -use asset_hub_polkadot_runtime::{ +use asset_hub_paseo_runtime::{ xcm_config::{ AssetFeeAsExistentialDepositMultiplierFeeCharger, DotLocation, DotLocationV3, StakingPot, TrustBackedAssetsPalletLocation, TrustBackedAssetsPalletLocationV3, XcmConfig, @@ -34,9 +34,10 @@ use frame_support::{ }, weights::WeightToFee as WeightToFeeT, }; -use parachains_common::{AccountId, AssetHubPolkadotAuraId as AuraId}; +use parachains_common::{AccountId, AuraId}; +use paseo_runtime_constants::currency::UNITS; use sp_runtime::traits::MaybeEquivalence; -use system_parachains_constants::polkadot::{currency::*, fee::WeightToFee}; +use system_parachains_constants::paseo::fee::WeightToFee; use xcm::latest::prelude::*; use xcm_executor::traits::WeightTrader; @@ -55,7 +56,7 @@ fn test_asset_xcm_trader() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -136,7 +137,7 @@ fn test_asset_xcm_trader_with_refund() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -220,7 +221,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -276,7 +277,7 @@ fn test_that_buying_ed_refund_does_not_refund() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -342,7 +343,7 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -405,7 +406,7 @@ fn test_buy_and_refund_weight_with_native() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -463,7 +464,7 @@ fn test_buy_and_refund_weight_with_swap_local_asset_xcm_trader() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { @@ -565,7 +566,7 @@ fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { .with_session_keys(vec![( AccountId::from(ALICE), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, )]) .build() .execute_with(|| { diff --git a/system-parachains/bridge-hub-paseo/tests/snowbridge.rs b/system-parachains/bridge-hub-paseo/tests/snowbridge.rs index 1352c0e..5bf4d48 100644 --- a/system-parachains/bridge-hub-paseo/tests/snowbridge.rs +++ b/system-parachains/bridge-hub-paseo/tests/snowbridge.rs @@ -168,8 +168,8 @@ fn test_xcm_fee_manager_from_components_bh_origin_in_waived_locations() { /// Fee is waived when origin is in waived location with Export message, but not to Ethereum. #[test] -fn test_xcm_fee_manager_from_components_bh_origin_in_waived_locations_with_export_to_paseo_reason( -) { +fn test_xcm_fee_manager_from_components_bh_origin_in_waived_locations_with_export_to_paseo_reason() +{ assert!(TestXcmFeeManager::is_waived( Some(&Location::new(1, [Parachain(2)])), FeeReason::Export { network: Polkadot, destination: Here } @@ -398,7 +398,11 @@ where let xcm = Xcm(vec![ WithdrawAsset(Assets::from(vec![fee.clone()])), BuyExecution { fees: fee, weight_limit: Unlimited }, - ExportMessage { network: Ethereum { chain_id: 11155111 }, destination: Here, xcm: inner_xcm }, + ExportMessage { + network: Ethereum { chain_id: 11155111 }, + destination: Here, + xcm: inner_xcm, + }, ]); // execute XCM