From 9ba3d6d050b67952a7d5132333152bf96264dee6 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Wed, 21 Feb 2024 16:16:40 +0200 Subject: [PATCH] fixes after 1.7.0 --- Cargo.lock | 86 ++++++++- integration-tests/emulated/chains/Cargo.toml | 1 + integration-tests/emulated/chains/src/lib.rs | 10 +- .../emulated/common/src/xcm_helpers.rs | 2 +- .../asset-hub-kusama/src/xcm_config.rs | 10 +- .../asset-hub-polkadot/src/xcm_config.rs | 12 +- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 2 + .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 9 +- .../bridge-hub-kusama/src/xcm_config.rs | 3 +- .../bridge-hub-kusama/tests/snowbridge.rs | 173 ++++++++++++++++++ .../bridge-hub-kusama/tests/tests.rs | 6 +- .../bridge-hub-polkadot/src/lib.rs | 9 +- .../bridge-hub-polkadot/src/xcm_config.rs | 7 +- 13 files changed, 293 insertions(+), 37 deletions(-) create mode 100644 system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs diff --git a/Cargo.lock b/Cargo.lock index 8f42cf178e..d3f8193fc1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1561,6 +1561,7 @@ dependencies = [ "snowbridge-pallet-system", "snowbridge-router-primitives", "snowbridge-runtime-common", + "snowbridge-runtime-test-common", "snowbridge-system-runtime-api", "sp-api 27.0.0", "sp-block-builder 27.0.0", @@ -3448,6 +3449,7 @@ version = "1.0.0" dependencies = [ "asset-hub-kusama-runtime", "asset-hub-polkadot-runtime", + "bridge-hub-common", "bridge-hub-kusama-runtime", "bridge-hub-polkadot-runtime", "collectives-polkadot-runtime", @@ -13202,7 +13204,7 @@ dependencies = [ "sp-std 14.0.0", "staging-xcm 8.0.0", "staging-xcm-builder 8.0.0", - "staging-xcm-executor 8.0.0", + "staging-xcm-executor 8.0.1", ] [[package]] @@ -13266,7 +13268,7 @@ dependencies = [ "sp-std 14.0.0", "staging-xcm 8.0.0", "staging-xcm-builder 8.0.0", - "staging-xcm-executor 8.0.0", + "staging-xcm-executor 8.0.1", ] [[package]] @@ -13290,7 +13292,7 @@ dependencies = [ "sp-std 14.0.0", "staging-xcm 8.0.0", "staging-xcm-builder 8.0.0", - "staging-xcm-executor 8.0.0", + "staging-xcm-executor 8.0.1", ] [[package]] @@ -13308,7 +13310,83 @@ dependencies = [ "sp-std 14.0.0", "staging-xcm 8.0.0", "staging-xcm-builder 8.0.0", - "staging-xcm-executor 8.0.0", + "staging-xcm-executor 8.0.1", +] + +[[package]] +name = "snowbridge-runtime-test-common" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bce50af98162e76b5ae50a2beb215bcde2a199eb5ea579ba4752b91278e655b1" +dependencies = [ + "assets-common", + "cumulus-pallet-aura-ext 0.8.0", + "cumulus-pallet-parachain-system 0.8.0", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm 0.8.0", + "cumulus-pallet-xcmp-queue 0.8.0", + "cumulus-primitives-core 0.8.0", + "cumulus-primitives-utility 0.8.0", + "frame-benchmarking 29.0.0", + "frame-executive 29.0.0", + "frame-support 29.0.0", + "frame-system 29.0.0", + "frame-system-benchmarking 29.0.0", + "frame-system-rpc-runtime-api 27.0.0", + "frame-try-runtime 0.35.0", + "hex-literal", + "log", + "pallet-aura 28.0.0", + "pallet-authorship 29.0.0", + "pallet-balances 29.0.0", + "pallet-collator-selection 10.0.0", + "pallet-message-queue 32.0.0", + "pallet-multisig", + "pallet-session 29.0.0", + "pallet-timestamp 28.0.0", + "pallet-transaction-payment 29.0.0", + "pallet-transaction-payment-rpc-runtime-api 29.0.0", + "pallet-utility 29.0.0", + "pallet-xcm 8.0.0", + "pallet-xcm-benchmarks 8.0.0", + "parachains-common 8.0.0", + "parachains-runtimes-test-utils", + "parity-scale-codec", + "polkadot-core-primitives 8.0.0", + "polkadot-parachain-primitives 7.0.0", + "polkadot-runtime-common 8.0.0", + "scale-info", + "serde", + "smallvec", + "snowbridge-beacon-primitives", + "snowbridge-core", + "snowbridge-outbound-queue-runtime-api", + "snowbridge-pallet-ethereum-client", + "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-inbound-queue", + "snowbridge-pallet-outbound-queue", + "snowbridge-pallet-system", + "snowbridge-router-primitives", + "snowbridge-system-runtime-api", + "sp-api 27.0.0", + "sp-block-builder 27.0.0", + "sp-consensus-aura 0.33.0", + "sp-core 29.0.0", + "sp-genesis-builder 0.8.0", + "sp-inherents 27.0.0", + "sp-io 31.0.0", + "sp-keyring 32.0.0", + "sp-offchain 27.0.0", + "sp-runtime 32.0.0", + "sp-session 28.0.0", + "sp-std 14.0.0", + "sp-storage 20.0.0", + "sp-transaction-pool 27.0.0", + "sp-version 30.0.0", + "staging-parachain-info 0.8.0", + "staging-xcm 8.0.0", + "staging-xcm-builder 8.0.0", + "staging-xcm-executor 8.0.1", ] [[package]] diff --git a/integration-tests/emulated/chains/Cargo.toml b/integration-tests/emulated/chains/Cargo.toml index 71e4becbf8..2aa001e7a8 100644 --- a/integration-tests/emulated/chains/Cargo.toml +++ b/integration-tests/emulated/chains/Cargo.toml @@ -25,6 +25,7 @@ polkadot-runtime-parachains = { version = "8.0.0" } polkadot-parachain-primitives = { version = "7.0.0" } # Cumulus +bridge-hub-common = { version = "0.1.0" } parachains-common = { version = "8.0.0" } cumulus-primitives-core = { version = "0.8.0" } xcm-emulator = { version = "0.6.0" } diff --git a/integration-tests/emulated/chains/src/lib.rs b/integration-tests/emulated/chains/src/lib.rs index 4e09349582..51245dc2dd 100644 --- a/integration-tests/emulated/chains/src/lib.rs +++ b/integration-tests/emulated/chains/src/lib.rs @@ -120,10 +120,13 @@ decl_test_parachains! { XcmpMessageHandler: bridge_hub_polkadot_runtime::XcmpQueue, LocationToAccountId: bridge_hub_polkadot_runtime::xcm_config::LocationToAccountId, ParachainInfo: bridge_hub_polkadot_runtime::ParachainInfo, - MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, + MessageOrigin: bridge_hub_common::AggregateMessageOrigin, }, pallets = { PolkadotXcm: bridge_hub_polkadot_runtime::PolkadotXcm, + EthereumSystem: bridge_hub_polkadot_runtime::EthereumSystem, + EthereumInboundQueue: bridge_hub_polkadot_runtime::EthereumInboundQueue, + EthereumOutboundQueue: bridge_hub_polkadot_runtime::EthereumOutboundQueue, } }, pub struct PenpalPolkadotA { @@ -194,10 +197,13 @@ decl_test_parachains! { XcmpMessageHandler: bridge_hub_kusama_runtime::XcmpQueue, LocationToAccountId: bridge_hub_kusama_runtime::xcm_config::LocationToAccountId, ParachainInfo: bridge_hub_kusama_runtime::ParachainInfo, - MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, + MessageOrigin: bridge_hub_common::AggregateMessageOrigin, }, pallets = { PolkadotXcm: bridge_hub_kusama_runtime::PolkadotXcm, + EthereumSystem: bridge_hub_kusama_runtime::EthereumSystem, + EthereumInboundQueue: bridge_hub_kusama_runtime::EthereumInboundQueue, + EthereumOutboundQueue: bridge_hub_kusama_runtime::EthereumOutboundQueue, } }, pub struct PenpalKusamaA { diff --git a/integration-tests/emulated/common/src/xcm_helpers.rs b/integration-tests/emulated/common/src/xcm_helpers.rs index 501ba502bd..cf3590cc3d 100644 --- a/integration-tests/emulated/common/src/xcm_helpers.rs +++ b/integration-tests/emulated/common/src/xcm_helpers.rs @@ -37,7 +37,7 @@ pub fn xcm_transact_paid_execution( assets: All.into(), beneficiary: Location { parents: 0, - interior: X1(AccountId32 { network: None, id: beneficiary.into() }), + interior: [ AccountId32 { network: None, id: beneficiary.into() }].into(), }, }, ])) diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 68278c73c7..c4ca4bf47d 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -801,12 +801,12 @@ pub mod bridging { /// Configure the fee to max Balance so that it is disabled. pub const DefaultBridgeHubEthereumBaseFee: Balance = Balance::MAX; pub storage BridgeHubEthereumBaseFee: Balance = DefaultBridgeHubEthereumBaseFee::get(); - pub SiblingBridgeHubWithEthereumInboundQueueInstance: MultiLocation = MultiLocation::new( - 1, - X2( + pub SiblingBridgeHubWithEthereumInboundQueueInstance: Location = Location::new( + 2, + [ Parachain(SiblingBridgeHubParaId::get()), PalletInstance(system_parachains_constants::kusama::snowbridge::INBOUND_QUEUE_PALLET_INDEX), - ) + ] ); /// Set up exporters configuration. @@ -824,7 +824,7 @@ pub mod bridging { ]; /// Universal aliases - pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter( + pub UniversalAliases: BTreeSet<(Location, Junction)> = BTreeSet::from_iter( sp_std::vec![ (SiblingBridgeHubWithEthereumInboundQueueInstance::get(), GlobalConsensus(EthereumNetwork::get())), ] diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 013461041f..687fdf686b 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -730,12 +730,12 @@ pub mod bridging { /// Configure the fee to max Balance so that it is disabled. pub const DefaultBridgeHubEthereumBaseFee: Balance = Balance::MAX; pub storage BridgeHubEthereumBaseFee: Balance = DefaultBridgeHubEthereumBaseFee::get(); - pub SiblingBridgeHubWithEthereumInboundQueueInstance: MultiLocation = MultiLocation::new( - 1, - X2( + pub SiblingBridgeHubWithEthereumInboundQueueInstance: Location = Location::new( + 2, + [ Parachain(SiblingBridgeHubParaId::get()), - PalletInstance(system_parachains_constants::polkadot::snowbridge::INBOUND_QUEUE_PALLET_INDEX) - ) + PalletInstance(system_parachains_constants::polkadot::snowbridge::INBOUND_QUEUE_PALLET_INDEX), + ], ); /// Set up exporters configuration. @@ -753,7 +753,7 @@ pub mod bridging { ]; /// Universal aliases - pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter( + pub UniversalAliases: BTreeSet<(Location, Junction)> = BTreeSet::from_iter( sp_std::vec![ (SiblingBridgeHubWithEthereumInboundQueueInstance::get(), GlobalConsensus(EthereumNetwork::get())), ] diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml index 415a9a085d..a453bb5680 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -117,6 +117,7 @@ bridge-hub-test-utils = { version = "0.8.0" } bridge-runtime-common = { version = "0.8.0", features = ["integrity-test"] } sp-keyring = { version = "32.0.0" } static_assertions = { version = "1.1.0" } +snowbridge-runtime-test-common = { version = "0.1.0" } [features] default = [ "std" ] @@ -244,6 +245,7 @@ runtime-benchmarks = [ "snowbridge-pallet-outbound-queue/runtime-benchmarks", "snowbridge-router-primitives/runtime-benchmarks", "snowbridge-runtime-common/runtime-benchmarks", + "snowbridge-runtime-test-common/runtime-benchmarks", "snowbridge-pallet-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index bc9e6a0dbe..f5050fa377 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -27,10 +27,9 @@ pub mod bridge_to_polkadot_config; mod weights; pub mod xcm_config; -use bridge_hub_common::AggregateMessageOrigin; +use bridge_hub_common::message_queue::{AggregateMessageOrigin, NarrowOriginToSibling, ParaIdToSibling}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_primitives_core::ParaId; -use parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::{ gwei, meth, outbound::Message, AgentId, AllowSiblingsOnly, PricingParameters, Rewards, @@ -77,12 +76,12 @@ use xcm_config::{ pub use sp_runtime::BuildStorage; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; -use polkadot_runtime_constants::system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID}; +use kusama_runtime_constants::{currency::EXISTENTIAL_DEPOSIT, system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID}}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, message_queue::*, AccountId, Balance, BlockNumber, Hash, Header, Nonce, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, }; @@ -718,7 +717,7 @@ construct_runtime!( // Ethereum bridge pallets. EthereumInboundQueue: snowbridge_pallet_inbound_queue = 80, - EthereumOutboundQueue: snowbridge_pallet_inbound_queue = 81, + EthereumOutboundQueue: snowbridge_pallet_outbound_queue = 81, EthereumBeaconClient: snowbridge_pallet_ethereum_client = 82, EthereumSystem: snowbridge_pallet_system = 83, diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index d74eae60c2..de5348c5f4 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -23,7 +23,7 @@ use super::{ RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ - parameter_types, + parameter_types, StoragePrefixedMap, traits::{ConstU32, Contains, Equals, Everything, Nothing}, }; use frame_system::EnsureRoot; @@ -37,7 +37,6 @@ use parachains_common::{ }; use polkadot_parachain_primitives::primitives::Sibling; use snowbridge_runtime_common::XcmExportFeeToSibling; -use sp_core::Get; use sp_runtime::traits::AccountIdConversion; use sp_std::marker::PhantomData; use system_parachains_constants::{kusama::snowbridge::EthereumNetwork, TREASURY_PALLET_ID}; diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs new file mode 100644 index 0000000000..ee24797049 --- /dev/null +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs @@ -0,0 +1,173 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +#![cfg(test)] + +use bp_polkadot_core::Signature; +use bridge_hub_kusama_runtime::{ + bridge_to_polkadot_config::RefundBridgeHubPolkadotMessages, + xcm_config::XcmConfig, BridgeRejectObsoleteHeadersAndMessages, Executive, + MessageQueueServiceWeight, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, + UncheckedExtrinsic, +}; +use codec::{Decode, Encode}; +use cumulus_primitives_core::XcmError::{FailedToTransactAsset, NotHoldingFees}; +use frame_support::parameter_types; +use parachains_common::{AccountId, AuraId, Balance}; +use snowbridge_pallet_ethereum_client::WeightInfo; +use sp_core::H160; +use sp_keyring::AccountKeyring::Alice; +use sp_runtime::{ + generic::{Era, SignedPayload}, + AccountId32, +}; + +parameter_types! { + pub const DefaultBridgeHubEthereumBaseFee: Balance = 2_750_872_500_000; +} + +fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys { + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(Alice), + AccountId::from(Alice), + SessionKeys { aura: AuraId::from(Alice.public()) }, + ) +} + +#[test] +pub fn transfer_token_to_ethereum_works() { + snowbridge_runtime_test_common::send_transfer_token_message_success::( + collator_session_keys(), + 1013, + 1000, + H160::random(), + H160::random(), + DefaultBridgeHubEthereumBaseFee::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::EthereumOutboundQueue(event)) => Some(event), + _ => None, + } + }), + ) +} + +#[test] +pub fn unpaid_transfer_token_to_ethereum_fails_with_barrier() { + snowbridge_runtime_test_common::send_unpaid_transfer_token_message::( + collator_session_keys(), + 1013, + 1000, + H160::random(), + H160::random(), + ) +} + +#[test] +pub fn transfer_token_to_ethereum_fee_not_enough() { + snowbridge_runtime_test_common::send_transfer_token_message_failure::( + collator_session_keys(), + 1013, + 1000, + DefaultBridgeHubEthereumBaseFee::get() + 1_000_000_000, + H160::random(), + H160::random(), + // fee not enough + 1_000_000_000, + NotHoldingFees, + ) +} + +#[test] +pub fn transfer_token_to_ethereum_insufficient_fund() { + snowbridge_runtime_test_common::send_transfer_token_message_failure::( + collator_session_keys(), + 1013, + 1000, + 1_000_000_000, + H160::random(), + H160::random(), + DefaultBridgeHubEthereumBaseFee::get(), + FailedToTransactAsset("Funds are unavailable"), + ) +} + +#[test] +fn max_message_queue_service_weight_is_more_than_beacon_extrinsic_weights() { + let max_message_queue_weight = MessageQueueServiceWeight::get(); + let force_checkpoint = + ::WeightInfo::force_checkpoint(); + let submit_checkpoint = + ::WeightInfo::submit(); + max_message_queue_weight.all_gt(force_checkpoint); + max_message_queue_weight.all_gt(submit_checkpoint); +} + +#[test] +fn ethereum_client_consensus_extrinsics_work() { + snowbridge_runtime_test_common::ethereum_extrinsic( + collator_session_keys(), + 1013, + construct_and_apply_extrinsic, + ); +} + +#[test] +fn ethereum_to_polkadot_message_extrinsics_work() { + snowbridge_runtime_test_common::ethereum_to_polkadot_message_extrinsics_work( + collator_session_keys(), + 1013, + construct_and_apply_extrinsic, + ); +} + +fn construct_extrinsic( + sender: sp_keyring::AccountKeyring, + call: RuntimeCall, +) -> UncheckedExtrinsic { + let account_id = AccountId32::from(sender.public()); + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::immortal()), + frame_system::CheckNonce::::from( + frame_system::Pallet::::account(&account_id).nonce, + ), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + BridgeRejectObsoleteHeadersAndMessages::default(), + (RefundBridgeHubPolkadotMessages::default()), + ); + let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); + let signature = payload.using_encoded(|e| sender.sign(e)); + UncheckedExtrinsic::new_signed( + call, + account_id.into(), + Signature::Sr25519(signature.clone()), + extra, + ) +} + +fn construct_and_apply_extrinsic( + origin: sp_keyring::AccountKeyring, + call: RuntimeCall, +) -> sp_runtime::DispatchOutcome { + let xt = construct_extrinsic(origin, call); + let r = Executive::apply_extrinsic(xt); + r.unwrap() +} 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 499e884a66..b4d2ab8fe1 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -26,7 +26,7 @@ use bridge_hub_kusama_runtime::{ xcm_config::{KsmRelayLocation, RelayNetwork, XcmConfig}, AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, - SignedExtra, TransactionPayment, UncheckedExtrinsic, SLOT_DURATION, + SignedExtra, TransactionPayment, UncheckedExtrinsic, EthereumGatewayAddress, }; use bridge_hub_test_utils::{test_cases::from_parachain, SlotDurations}; use codec::{Decode, Encode}; @@ -39,9 +39,9 @@ use sp_runtime::{ generic::{Era, SignedPayload}, AccountId32, }; -use system_parachains_constants::kusama::{ +use system_parachains_constants::{kusama::{ consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, fee::WeightToFee, -}; +}, SLOT_DURATION}; use xcm::latest::prelude::*; // Para id of sibling chain used in tests. diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 31aeddae6b..6f1c740561 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -27,10 +27,9 @@ pub mod bridge_to_kusama_config; mod weights; pub mod xcm_config; -use bridge_hub_common::AggregateMessageOrigin; +use bridge_hub_common::message_queue::{AggregateMessageOrigin, NarrowOriginToSibling, ParaIdToSibling}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_primitives_core::ParaId; -use parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::{ gwei, meth, outbound::Message, AgentId, AllowSiblingsOnly, PricingParameters, Rewards, @@ -78,12 +77,12 @@ pub use sp_runtime::BuildStorage; // Polkadot imports use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; -use polkadot_runtime_constants::system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID}; +use polkadot_runtime_constants::{currency::EXISTENTIAL_DEPOSIT, system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID}}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, message_queue::*, AccountId, Balance, BlockNumber, Hash, Header, Nonce, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, }; @@ -719,7 +718,7 @@ construct_runtime!( // Ethereum bridge pallets. EthereumInboundQueue: snowbridge_pallet_inbound_queue = 80, - EthereumOutboundQueue: snowbridge_pallet_inbound_queue = 81, + EthereumOutboundQueue: snowbridge_pallet_outbound_queue = 81, EthereumBeaconClient: snowbridge_pallet_ethereum_client = 82, EthereumSystem: snowbridge_pallet_system = 83, diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index bf4a7fe7e0..fcb5fcad91 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -23,7 +23,7 @@ use super::{ RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ - parameter_types, + parameter_types, StoragePrefixedMap, traits::{ConstU32, Contains, Equals, Everything, Nothing}, }; use frame_system::EnsureRoot; @@ -38,7 +38,6 @@ use parachains_common::{ use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_constants::system_parachain; use snowbridge_runtime_common::XcmExportFeeToSibling; -use sp_core::Get; use sp_runtime::traits::AccountIdConversion; use sp_std::marker::PhantomData; use system_parachains_constants::{polkadot::snowbridge::EthereumNetwork, TREASURY_PALLET_ID}; @@ -47,7 +46,7 @@ use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FrameTransactionalProcessor, - FungibleAdapter, HashedDescription, IsConcrete, ParentAsSuperuser, ParentIsPreset, + FungibleAdapter, HandleFee, HashedDescription, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, @@ -314,7 +313,7 @@ impl xcm_executor::Config for XcmConfig { XcmExportFeeToSibling< bp_polkadot::Balance, AccountId, - TokenLocation, + DotRelayLocation, EthereumNetwork, Self::AssetTransactor, crate::EthereumOutboundQueue,