From 756d00b6acb67908e866a258e2cc45c792ade930 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Thu, 21 Mar 2024 08:24:57 +0200 Subject: [PATCH] move test --- .../bridge-hub-kusama/tests/snowbridge.rs | 16 +++++++++++-- .../bridge-hub-kusama/tests/tests.rs | 23 +++---------------- .../bridge-hub-polkadot/tests/snowbridge.rs | 16 +++++++++++-- .../bridge-hub-polkadot/tests/tests.rs | 23 +++---------------- 4 files changed, 34 insertions(+), 44 deletions(-) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs index 18ad72c0a4..160ccbb27c 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs @@ -21,8 +21,9 @@ use bridge_hub_kusama_runtime::{ bridge_to_ethereum_config::EthereumNetwork, bridge_to_polkadot_config::RefundBridgeHubPolkadotMessages, xcm_config::{XcmConfig, XcmFeeManagerFromComponentsBridgeHub}, - BridgeRejectObsoleteHeadersAndMessages, Executive, MessageQueueServiceWeight, Runtime, - RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, UncheckedExtrinsic, + BridgeRejectObsoleteHeadersAndMessages, EthereumGatewayAddress, Executive, + MessageQueueServiceWeight, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, + UncheckedExtrinsic, }; use bridge_hub_test_utils::ValidatorIdOf; use codec::{Decode, Encode}; @@ -131,6 +132,17 @@ pub fn transfer_token_to_ethereum_insufficient_fund() { ) } +#[test] +fn change_ethereum_gateway_by_governance_works() { + change_storage_constant_by_governance_works::( + collator_session_keys(), + bp_bridge_hub_kusama::BRIDGE_HUB_KUSAMA_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || (EthereumGatewayAddress::key().to_vec(), EthereumGatewayAddress::get()), + |_| [1; 20].into(), + ) +} + /// Fee is not waived when origin is none. #[test] fn test_xcm_fee_manager_from_components_bh_origin_none() { diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs index 0fc9e4208f..74e0f4c4a2 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -27,17 +27,15 @@ use bridge_hub_kusama_runtime::{ KsmRelayLocation, LocationToAccountId, RelayNetwork, RelayTreasuryLocation, RelayTreasuryPalletAccount, XcmConfig, }, - AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, EthereumGatewayAddress, - Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, SessionKeys, SignedExtra, TransactionPayment, UncheckedExtrinsic, - SLOT_DURATION, + AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit, + ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, + SignedExtra, TransactionPayment, UncheckedExtrinsic, SLOT_DURATION, }; use bridge_hub_test_utils::{test_cases::from_parachain, SlotDurations}; use codec::{Decode, Encode}; use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8}; use parachains_common::{AccountId, AuraId, Balance}; use sp_consensus_aura::SlotDuration; -use sp_core::H160; use sp_keyring::AccountKeyring::Alice; use sp_runtime::{ generic::{Era, SignedPayload}, @@ -328,21 +326,6 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() { ) } -#[test] -fn change_ethereum_gateway_by_governance_works() { - bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< - Runtime, - EthereumGatewayAddress, - H160, - >( - collator_session_keys(), - bp_bridge_hub_kusama::BRIDGE_HUB_KUSAMA_PARACHAIN_ID, - Box::new(|call| RuntimeCall::System(call).encode()), - || (EthereumGatewayAddress::key().to_vec(), EthereumGatewayAddress::get()), - |_| [1; 20].into(), - ) -} - #[test] pub fn can_calculate_fee_for_complex_message_delivery_transaction() { check_sane_fees_values( diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs index be84c05cf3..29f8ad5ad4 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs @@ -21,8 +21,9 @@ use bridge_hub_polkadot_runtime::{ bridge_to_ethereum_config::EthereumNetwork, bridge_to_kusama_config::RefundBridgeHubKusamaMessages, xcm_config::{XcmConfig, XcmFeeManagerFromComponentsBridgeHub}, - BridgeRejectObsoleteHeadersAndMessages, Executive, MessageQueueServiceWeight, Runtime, - RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, UncheckedExtrinsic, + BridgeRejectObsoleteHeadersAndMessages, EthereumGatewayAddress, Executive, + MessageQueueServiceWeight, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, + UncheckedExtrinsic, }; use bridge_hub_test_utils::ValidatorIdOf; use codec::{Decode, Encode}; @@ -131,6 +132,17 @@ pub fn transfer_token_to_ethereum_insufficient_fund() { ) } +#[test] +fn change_ethereum_gateway_by_governance_works() { + change_storage_constant_by_governance_works::( + collator_session_keys(), + bp_bridge_hub_polkadot::BRIDGE_HUB_POLKADOT_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || (EthereumGatewayAddress::key().to_vec(), EthereumGatewayAddress::get()), + |_| [1; 20].into(), + ) +} + /// Fee is not waived when origin is none. #[test] fn test_xcm_fee_manager_from_components_bh_origin_none() { diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs index b89fedf188..0f03bd3415 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -28,17 +28,15 @@ use bridge_hub_polkadot_runtime::{ DotRelayLocation, LocationToAccountId, RelayNetwork, RelayTreasuryLocation, RelayTreasuryPalletAccount, XcmConfig, }, - AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, EthereumGatewayAddress, - Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, SessionKeys, SignedExtra, TransactionPayment, UncheckedExtrinsic, - SLOT_DURATION, + AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit, + ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, + SignedExtra, TransactionPayment, UncheckedExtrinsic, SLOT_DURATION, }; use bridge_hub_test_utils::{test_cases::from_parachain, SlotDurations}; use codec::{Decode, Encode}; use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8}; use parachains_common::{AccountId, AuraId, Balance}; use sp_consensus_aura::SlotDuration; -use sp_core::H160; use sp_keyring::AccountKeyring::Alice; use sp_runtime::{ generic::{Era, SignedPayload}, @@ -329,21 +327,6 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() { ) } -#[test] -fn change_ethereum_gateway_by_governance_works() { - bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< - Runtime, - EthereumGatewayAddress, - H160, - >( - collator_session_keys(), - bp_bridge_hub_kusama::BRIDGE_HUB_KUSAMA_PARACHAIN_ID, - Box::new(|call| RuntimeCall::System(call).encode()), - || (EthereumGatewayAddress::key().to_vec(), EthereumGatewayAddress::get()), - |_| [1; 20].into(), - ) -} - #[test] pub fn can_calculate_fee_for_complex_message_delivery_transaction() { check_sane_fees_values(