Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Mar 19, 2024
1 parent 890f49d commit 3bd0619
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bp_bridge_hub_kusama::snowbridge::{
CreateAssetCall, CreateAssetDeposit, InboundQueuePalletInstance,
};
use bridge_hub_kusama_runtime::{
EthereumBeaconClient, EthereumGatewayAddress, EthereumInboundQueue, RuntimeOrigin,
EthereumBeaconClient, EthereumGatewayAddress, EthereumInboundQueue, Runtime, RuntimeOrigin,
};
use codec::{Decode, Encode};
use emulated_integration_tests_common::xcm_emulator::ConvertLocation;
Expand All @@ -30,19 +30,23 @@ use kusama_system_emulated_network::{
};
use snowbridge_beacon_primitives::CompactExecutionHeader;
use snowbridge_core::{
gwei,
inbound::{Log, Message, Proof},
meth,
outbound::OperatingMode,
Rewards,
};
use snowbridge_pallet_inbound_queue_fixtures::{
register_token_with_insufficient_fee::make_register_token_with_infufficient_fee_message,
InboundQueueFixture,
};
use snowbridge_pallet_system::PricingParametersOf;
use snowbridge_router_primitives::inbound::{
Command, Destination, GlobalConsensusEthereumConvertsFor, MessageV1, VersionedMessage,
};
use sp_core::{H160, H256};
use sp_runtime::{DispatchError::Token, TokenError::FundsUnavailable};
use system_parachains_constants::kusama::snowbridge::EthereumNetwork;
use sp_runtime::{DispatchError::Token, FixedU128, TokenError::FundsUnavailable};
use system_parachains_constants::kusama::{currency::UNITS, snowbridge::EthereumNetwork};

const INITIAL_FUND: u128 = 5_000_000_000 * KUSAMA_ED;
const CHAIN_ID: u64 = 1;
Expand Down Expand Up @@ -455,6 +459,20 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
BridgeHubKusama::execute_with(|| {
type RuntimeEvent = <BridgeHubKusama as Chain>::RuntimeEvent;

assert_ok!(
<BridgeHubKusama as BridgeHubKusamaPallet>::EthereumSystem::set_pricing_parameters(
<BridgeHubKusama as Chain>::RuntimeOrigin::root(),
PricingParametersOf::<Runtime> {
exchange_rate: FixedU128::from_rational(1, 75),
fee_per_gas: gwei(20),
rewards: Rewards {
local: (1 * UNITS / 100).into(), // 0.01 KSM
remote: meth(1),
},
}
)
);

assert_ok!(<BridgeHubKusama as Chain>::System::set_storage(
<BridgeHubKusama as Chain>::RuntimeOrigin::root(),
vec![(EthereumGatewayAddress::key().to_vec(), H160(GATEWAY_ADDRESS).encode())],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bp_bridge_hub_polkadot::snowbridge::{
CreateAssetCall, CreateAssetDeposit, InboundQueuePalletInstance,
};
use bridge_hub_polkadot_runtime::{
EthereumBeaconClient, EthereumGatewayAddress, EthereumInboundQueue, RuntimeOrigin,
EthereumBeaconClient, EthereumGatewayAddress, EthereumInboundQueue, Runtime, RuntimeOrigin,
};
use codec::{Decode, Encode};
use emulated_integration_tests_common::xcm_emulator::ConvertLocation;
Expand All @@ -30,19 +30,23 @@ use polkadot_system_emulated_network::{
};
use snowbridge_beacon_primitives::CompactExecutionHeader;
use snowbridge_core::{
gwei,
inbound::{Log, Message, Proof},
meth,
outbound::OperatingMode,
Rewards,
};
use snowbridge_pallet_inbound_queue_fixtures::{
register_token_with_insufficient_fee::make_register_token_with_infufficient_fee_message,
InboundQueueFixture,
};
use snowbridge_pallet_system::PricingParametersOf;
use snowbridge_router_primitives::inbound::{
Command, Destination, GlobalConsensusEthereumConvertsFor, MessageV1, VersionedMessage,
};
use sp_core::{H160, H256};
use sp_runtime::{DispatchError::Token, TokenError::FundsUnavailable};
use system_parachains_constants::polkadot::snowbridge::EthereumNetwork;
use sp_runtime::{DispatchError::Token, FixedU128, TokenError::FundsUnavailable};
use system_parachains_constants::polkadot::{currency::UNITS, snowbridge::EthereumNetwork};

const INITIAL_FUND: u128 = 5_000_000_000 * POLKADOT_ED;
const CHAIN_ID: u64 = 1;
Expand Down Expand Up @@ -455,6 +459,20 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
BridgeHubPolkadot::execute_with(|| {
type RuntimeEvent = <BridgeHubPolkadot as Chain>::RuntimeEvent;

assert_ok!(
<BridgeHubPolkadot as BridgeHubPolkadotPallet>::EthereumSystem::set_pricing_parameters(
<BridgeHubPolkadot as Chain>::RuntimeOrigin::root(),
PricingParametersOf::<Runtime> {
exchange_rate: FixedU128::from_rational(1, 75),
fee_per_gas: gwei(20),
rewards: Rewards {
local: (1 * UNITS / 100).into(), // 0.01 DOT
remote: meth(1),
},
}
)
);

assert_ok!(<BridgeHubPolkadot as Chain>::System::set_storage(
<BridgeHubPolkadot as Chain>::RuntimeOrigin::root(),
vec![(EthereumGatewayAddress::key().to_vec(), H160(GATEWAY_ADDRESS).encode())],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ use frame_support::{
traits::{OnFinalize, OnInitialize},
};
use frame_system::pallet_prelude::BlockNumberFor;
use polkadot_runtime_constants::currency::UNITS;
use parachains_common::{AccountId, AuraId, Balance};
pub use parachains_runtimes_test_utils::test_cases::change_storage_constant_by_governance_works;
use parachains_runtimes_test_utils::{
AccountIdOf, CollatorSessionKeys, ExtBuilder, XcmReceivedFrom,
};
use polkadot_runtime_constants::currency::UNITS;
use snowbridge_core::{gwei, meth, ChannelId, ParaId, Rewards};
use snowbridge_pallet_ethereum_client::WeightInfo;
use snowbridge_pallet_system::{
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn send_transfer_token_message_failure<Runtime, XcmConfig>(
exchange_rate: FixedU128::from_rational(1, 75),
fee_per_gas: gwei(20),
rewards: Rewards {
local: (1 * UNITS / 100).into(), // 0.01 KSM
local: (1 * UNITS / 100).into(), // 0.01 DOT
remote: meth(1),
},
}
Expand Down

0 comments on commit 3bd0619

Please sign in to comment.