diff --git a/Cargo.lock b/Cargo.lock index 75fc69d7f2f9..c967093238f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1979,6 +1979,7 @@ dependencies = [ "scale-info", "snowbridge-core", "snowbridge-pallet-inbound-queue", + "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "snowbridge-router-primitives", @@ -17748,6 +17749,7 @@ dependencies = [ "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", + "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-router-primitives", "sp-core", "sp-io", @@ -17758,6 +17760,20 @@ dependencies = [ "staging-xcm-executor", ] +[[package]] +name = "snowbridge-pallet-inbound-queue-fixtures" +version = "0.9.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hex-literal", + "snowbridge-beacon-primitives", + "snowbridge-core", + "sp-core", + "sp-std 8.0.0", +] + [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.9.0" diff --git a/cumulus/parachains/integration-tests/emulated/common/src/lib.rs b/cumulus/parachains/integration-tests/emulated/common/src/lib.rs index ad69d5576aae..882a188e0f75 100644 --- a/cumulus/parachains/integration-tests/emulated/common/src/lib.rs +++ b/cumulus/parachains/integration-tests/emulated/common/src/lib.rs @@ -100,7 +100,7 @@ pub mod accounts { pub const CHARLIE: &str = "Charlie"; pub const DAVE: &str = "Dave"; pub const EVE: &str = "Eve"; - pub const FERDIE: &str = "Ferdei"; + pub const FERDIE: &str = "Ferdie"; pub const ALICE_STASH: &str = "Alice//stash"; pub const BOB_STASH: &str = "Bob//stash"; pub const CHARLIE_STASH: &str = "Charlie//stash"; diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml index a7d3bfe2fcbd..1972eb5091f7 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml @@ -49,5 +49,6 @@ asset-hub-rococo-runtime = { path = "../../../../../runtimes/assets/asset-hub-ro snowbridge-core = { path = "../../../../../../../../parachain/primitives/core", default-features = false } snowbridge-router-primitives = { path = "../../../../../../../../parachain/primitives/router", default-features = false } snowbridge-pallet-system = { path = "../../../../../../../../parachain/pallets/system", default-features = false } -snowbridge-pallet-inbound-queue = { path = "../../../../../../../../parachain/pallets/inbound-queue", default-features = false } snowbridge-pallet-outbound-queue = { path = "../../../../../../../../parachain/pallets/outbound-queue", default-features = false } +snowbridge-pallet-inbound-queue = { path = "../../../../../../../../parachain/pallets/inbound-queue", default-features = false } +snowbridge-pallet-inbound-queue-fixtures = { path = "../../../../../../../../parachain/pallets/inbound-queue/fixtures" } diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs index 944be9c399ff..27c4ee830064 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs @@ -13,12 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. use crate::*; +use bridge_hub_rococo_runtime::EthereumBeaconClient; use codec::{Decode, Encode}; use emulated_integration_tests_common::xcm_emulator::ConvertLocation; use frame_support::pallet_prelude::TypeInfo; use hex_literal::hex; use parachains_common::rococo::snowbridge::EthereumNetwork; +use rococo_westend_system_emulated_network::BridgeHubRococoParaSender as BridgeHubRococoSender; use snowbridge_core::outbound::OperatingMode; +use snowbridge_pallet_inbound_queue_fixtures::{ + register_token::make_register_token_message, send_token::make_send_token_message, +}; use snowbridge_pallet_system; use snowbridge_router_primitives::inbound::{ Command, Destination, GlobalConsensusEthereumConvertsFor, MessageV1, VersionedMessage, @@ -187,21 +192,26 @@ fn register_weth_token_from_ethereum_to_asset_hub() { // Fund AssetHub sovereign account so that it can pay execution fees. BridgeHubRococo::fund_para_sovereign(AssetHubRococo::para_id().into(), INITIAL_FUND); - let message_id: H256 = [1; 32].into(); - BridgeHubRococo::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; + type RuntimeOrigin = ::RuntimeOrigin; type EthereumInboundQueue = ::EthereumInboundQueue; - let message = VersionedMessage::V1(MessageV1 { - chain_id: CHAIN_ID, - command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE }, - }); - let (xcm, fee) = EthereumInboundQueue::do_convert(message_id, message).unwrap(); - assert_ok!(EthereumInboundQueue::burn_fees(AssetHubRococo::para_id().into(), fee)); + let register_asset_message = make_register_token_message(); - let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap(); + EthereumBeaconClient::store_execution_header( + register_asset_message.message.proof.block_hash, + register_asset_message.execution_header, + 0, + H256::default(), + ); + + EthereumInboundQueue::submit( + RuntimeOrigin::signed(BridgeHubRococoSender::get()), + register_asset_message.message, + ) + .unwrap(); assert_expected_events!( BridgeHubRococo, @@ -346,36 +356,42 @@ fn send_token_from_ethereum_to_asset_hub() { // Fund ethereum sovereign on AssetHub AssetHubRococo::fund_accounts(vec![(AssetHubRococoReceiver::get(), INITIAL_FUND)]); - let message_id: H256 = [1; 32].into(); - BridgeHubRococo::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; + type RuntimeOrigin = ::RuntimeOrigin; type EthereumInboundQueue = ::EthereumInboundQueue; - // Construct RegisterToken message - let message = VersionedMessage::V1(MessageV1 { - chain_id: CHAIN_ID, - command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE }, - }); - // Convert the message to XCM - let (xcm, _) = EthereumInboundQueue::do_convert(message_id, message).unwrap(); - // Send the XCM - let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap(); + + let register_asset_message = make_register_token_message(); + + EthereumBeaconClient::store_execution_header( + register_asset_message.message.proof.block_hash, + register_asset_message.execution_header, + 0, + H256::default(), + ); + + EthereumInboundQueue::submit( + RuntimeOrigin::signed(BridgeHubRococoSender::get()), + register_asset_message.message, + ) + .unwrap(); // Construct SendToken message - let message = VersionedMessage::V1(MessageV1 { - chain_id: CHAIN_ID, - command: Command::SendToken { - token: WETH.into(), - destination: Destination::AccountId32 { id: AssetHubRococoReceiver::get().into() }, - amount: 1_000_000_000, - fee: XCM_FEE, - }, - }); - // Convert the message to XCM - let (xcm, _) = EthereumInboundQueue::do_convert(message_id, message).unwrap(); - // Send the XCM - let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap(); + let send_token_message = make_send_token_message(); + + EthereumBeaconClient::store_execution_header( + send_token_message.message.proof.block_hash, + send_token_message.execution_header, + 0, + H256::default(), + ); + + EthereumInboundQueue::submit( + RuntimeOrigin::signed(BridgeHubRococoSender::get()), + send_token_message.message, + ) + .unwrap(); // Check that the message was sent assert_expected_events!( @@ -436,7 +452,8 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE }, }); // Converts the versioned message to XCM - let (xcm, _) = EthereumInboundQueue::do_convert(message_id_register_token, message).unwrap(); + let (xcm, _) = + EthereumInboundQueue::do_convert(message_id_register_token, message).unwrap(); let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap(); // Check that the register token message was sent using xcm diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 553a45aeb3fb..287436f05bc0 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -490,13 +490,6 @@ impl pallet_utility::Config for Runtime { } // Ethereum Bridge - -#[cfg(not(feature = "runtime-benchmarks"))] -parameter_types! { - pub storage EthereumGatewayAddress: H160 = H160::zero(); -} - -#[cfg(feature = "runtime-benchmarks")] parameter_types! { pub storage EthereumGatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39")); }