Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Mar 21, 2024
1 parent 904345c commit 756d00b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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::<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(),
)
}

/// Fee is not waived when origin is none.
#[test]
fn test_xcm_fee_manager_from_components_bh_origin_none() {
Expand Down
23 changes: 3 additions & 20 deletions system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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::<Runtime, EthereumGatewayAddress, H160>(
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() {
Expand Down
23 changes: 3 additions & 20 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 756d00b

Please sign in to comment.