diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/lib.rs index 634686ae122d..043e617a4247 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/lib.rs @@ -24,7 +24,6 @@ mod imports { latest::{ParentThen, ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH}, prelude::{AccountId32 as AccountId32Junction, *}, v5, - v5::NetworkId::Westend as WestendId, }; pub use xcm_executor::traits::TransferType; diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/lib.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/lib.rs index 51694fa4a7ce..72daa95de8c6 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/lib.rs @@ -23,7 +23,7 @@ mod imports { pub use xcm::{ latest::{ParentThen, ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH}, prelude::{AccountId32 as AccountId32Junction, *}, - v5::{self, NetworkId::Rococo as RococoId}, + v5, }; pub use xcm_executor::traits::TransferType; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 4bddf307e911..7a7ab5c76c4e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -1125,8 +1125,10 @@ fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_pool_s let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT); let staking_pot = StakingPot::get(); - let foreign_asset_id_location = - xcm::v5::Location::new(2, [xcm::v5::Junction::GlobalConsensus(xcm::v5::NetworkId::Rococo)]); + let foreign_asset_id_location = xcm::v5::Location::new( + 2, + [xcm::v5::Junction::GlobalConsensus(xcm::v5::NetworkId::ByGenesis(ROCOCO_GENESIS_HASH))], + ); let foreign_asset_id_minimum_balance = 1_000_000_000; // sovereign account as foreign asset owner (can be whoever for this scenario) let foreign_asset_owner = LocationToAccountId::convert_location(&Location::parent()).unwrap(); @@ -1194,8 +1196,10 @@ fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_suffic let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT); let staking_pot = StakingPot::get(); - let foreign_asset_id_location = - xcm::v5::Location::new(2, [xcm::v5::Junction::GlobalConsensus(xcm::v5::NetworkId::Rococo)]); + let foreign_asset_id_location = xcm::v5::Location::new( + 2, + [xcm::v5::Junction::GlobalConsensus(xcm::v5::NetworkId::ByGenesis(ROCOCO_GENESIS_HASH))], + ); let foreign_asset_id_minimum_balance = 1_000_000_000; // sovereign account as foreign asset owner (can be whoever for this scenario) let foreign_asset_owner = LocationToAccountId::convert_location(&Location::parent()).unwrap(); 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 61b7c20e0347..93f8addf6146 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 @@ -91,7 +91,10 @@ use bridge_hub_common::{ use pallet_xcm::EnsureXcm; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; pub use sp_runtime::{MultiAddress, Perbill, Permill}; -use xcm::{latest::WESTEND_GENESIS_HASH, VersionedLocation}; +use xcm::{ + latest::{ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH}, + VersionedLocation, +}; use xcm_config::{TreasuryAccount, XcmOriginToTransactDispatchOrigin, XcmRouter}; #[cfg(any(feature = "std", test))] @@ -1439,7 +1442,7 @@ impl_runtime_apis! { Runtime, bridge_common_config::BridgeGrandpaWestendInstance, bridge_to_westend_config::WithBridgeHubWestendMessagesInstance, - >(params, generate_xcm_builder_bridge_message_sample([GlobalConsensus(Rococo), Parachain(42)].into())) + >(params, generate_xcm_builder_bridge_message_sample([GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)), Parachain(42)].into())) } fn prepare_message_delivery_proof( @@ -1474,7 +1477,7 @@ impl_runtime_apis! { Runtime, bridge_common_config::BridgeGrandpaRococoBulletinInstance, bridge_to_bulletin_config::WithRococoBulletinMessagesInstance, - >(params, generate_xcm_builder_bridge_message_sample([GlobalConsensus(Rococo), Parachain(42)].into())) + >(params, generate_xcm_builder_bridge_message_sample([GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)), Parachain(42)].into())) } fn prepare_message_delivery_proof( diff --git a/polkadot/xcm/src/v3/junction.rs b/polkadot/xcm/src/v3/junction.rs index a6eaf0d9b770..24e9c16bf699 100644 --- a/polkadot/xcm/src/v3/junction.rs +++ b/polkadot/xcm/src/v3/junction.rs @@ -56,6 +56,10 @@ pub enum NetworkId { Polkadot, /// The Kusama canary-net Relay-chain. Kusama, + /// The Westend testnet Relay-chain. + Westend, + /// The Rococo testnet Relay-chain. + Rococo, /// The Wococo testnet Relay-chain. Wococo, /// An Ethereum network specified by its chain ID. @@ -86,6 +90,8 @@ impl From for NetworkId { ByFork { block_number, block_hash } => Self::ByFork { block_number, block_hash }, Polkadot => Self::Polkadot, Kusama => Self::Kusama, + Westend => Self::Westend, + Rococo => Self::Rococo, Wococo => Self::Wococo, Ethereum { chain_id } => Self::Ethereum { chain_id }, BitcoinCore => Self::BitcoinCore, diff --git a/polkadot/xcm/src/v4/junction.rs b/polkadot/xcm/src/v4/junction.rs index 5fe21cbfb1c1..88125b03ef0c 100644 --- a/polkadot/xcm/src/v4/junction.rs +++ b/polkadot/xcm/src/v4/junction.rs @@ -25,7 +25,6 @@ use crate::{ }; use bounded_collections::{BoundedSlice, BoundedVec, ConstU32}; use codec::{self, Decode, Encode, MaxEncodedLen}; -use hex_literal::hex; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; @@ -129,12 +128,6 @@ impl From for NetworkId { } } -pub const WESTEND_GENESIS_HASH: [u8; 32] = - hex!["e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e"]; - -pub const ROCOCO_GENESIS_HASH: [u8; 32] = - hex!["6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e"]; - /// A global identifier of a data structure existing within consensus. /// /// Maintenance note: Networks with global consensus and which are practically bridgeable within the @@ -163,6 +156,10 @@ pub enum NetworkId { Polkadot, /// The Kusama canary-net Relay-chain. Kusama, + /// The Westend testnet Relay-chain. + Westend, + /// The Rococo testnet Relay-chain. + Rococo, /// The Wococo testnet Relay-chain. Wococo, /// An Ethereum network specified by its chain ID. @@ -193,6 +190,8 @@ impl From for NetworkId { ByFork { block_number, block_hash } => Self::ByFork { block_number, block_hash }, Polkadot => Self::Polkadot, Kusama => Self::Kusama, + Westend => Self::Westend, + Rococo => Self::Rococo, Wococo => Self::Wococo, Ethereum { chain_id } => Self::Ethereum { chain_id }, BitcoinCore => Self::BitcoinCore, diff --git a/polkadot/xcm/src/v4/mod.rs b/polkadot/xcm/src/v4/mod.rs index a6d208361206..778c02f3a735 100644 --- a/polkadot/xcm/src/v4/mod.rs +++ b/polkadot/xcm/src/v4/mod.rs @@ -48,9 +48,7 @@ pub use asset::{ Asset, AssetFilter, AssetId, AssetInstance, Assets, Fungibility, WildAsset, WildFungibility, MAX_ITEMS_IN_ASSETS, }; -pub use junction::{ - BodyId, BodyPart, Junction, NetworkId, ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH, -}; +pub use junction::{BodyId, BodyPart, Junction, NetworkId}; pub use junctions::Junctions; pub use location::{Ancestor, AncestorThen, InteriorLocation, Location, Parent, ParentThen}; pub use traits::{ diff --git a/polkadot/xcm/src/v5/junction.rs b/polkadot/xcm/src/v5/junction.rs index ed57de6f49bd..cfa033e433b8 100644 --- a/polkadot/xcm/src/v5/junction.rs +++ b/polkadot/xcm/src/v5/junction.rs @@ -24,6 +24,7 @@ use crate::{ }; use bounded_collections::{BoundedSlice, BoundedVec, ConstU32}; use codec::{self, Decode, Encode, MaxEncodedLen}; +use hex_literal::hex; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; @@ -102,6 +103,12 @@ pub enum Junction { GlobalConsensus(NetworkId), } +pub const WESTEND_GENESIS_HASH: [u8; 32] = + hex!["e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e"]; + +pub const ROCOCO_GENESIS_HASH: [u8; 32] = + hex!["6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e"]; + /// A global identifier of a data structure existing within consensus. /// /// Maintenance note: Networks with global consensus and which are practically bridgeable within the @@ -130,10 +137,6 @@ pub enum NetworkId { Polkadot, /// The Kusama canary-net Relay-chain. Kusama, - /// The Westend testnet Relay-chain. - Westend, - /// The Rococo testnet Relay-chain. - Rococo, /// The Wococo testnet Relay-chain. Wococo, /// An Ethereum network specified by its chain ID. @@ -164,8 +167,8 @@ impl From for NetworkId { ByFork { block_number, block_hash } => Self::ByFork { block_number, block_hash }, Polkadot => Self::Polkadot, Kusama => Self::Kusama, - Westend => Self::Westend, - Rococo => Self::Rococo, + Westend => Self::ByGenesis(WESTEND_GENESIS_HASH), + Rococo => Self::ByGenesis(ROCOCO_GENESIS_HASH), Wococo => Self::Wococo, Ethereum { chain_id } => Self::Ethereum { chain_id }, BitcoinCore => Self::BitcoinCore, diff --git a/polkadot/xcm/src/v5/mod.rs b/polkadot/xcm/src/v5/mod.rs index 4a23507709f5..2484bcbe6772 100644 --- a/polkadot/xcm/src/v5/mod.rs +++ b/polkadot/xcm/src/v5/mod.rs @@ -42,7 +42,9 @@ pub use asset::{ Asset, AssetFilter, AssetId, AssetInstance, Assets, Fungibility, WildAsset, WildFungibility, MAX_ITEMS_IN_ASSETS, }; -pub use junction::{BodyId, BodyPart, Junction, NetworkId}; +pub use junction::{ + BodyId, BodyPart, Junction, NetworkId, ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH, +}; pub use junctions::Junctions; pub use location::{Ancestor, AncestorThen, InteriorLocation, Location, Parent, ParentThen}; pub use traits::{