From 3308601697f85072cde95d3ca99b80fea03d2862 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 1 Nov 2023 22:45:14 +0200 Subject: [PATCH] remove gateway contract location --- .../assets/asset-hub-rococo/src/lib.rs | 4 ++-- .../assets/asset-hub-rococo/src/xcm_config.rs | 20 +++++-------------- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- .../bridge-hub-rococo/src/xcm_config.rs | 12 +---------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 895c4794675db..a273ea3758670 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -97,7 +97,7 @@ use xcm::latest::prelude::*; use xcm_executor::XcmExecutor; use crate::xcm_config::{ - bridging::to_rococo::EthereumGatewayLocation, ForeignCreatorsSovereignAccountOf, + bridging::to_rococo::EthereumLocation, ForeignCreatorsSovereignAccountOf, LocalAndForeignAssetsMultiLocationMatcher, TrustBackedAssetsPalletLocation, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; @@ -391,7 +391,7 @@ impl pallet_assets::Config for Runtime { ( FromSiblingParachain>, snowbridge_router_primitives::inbound::FromEthereumGlobalConsensus< - EthereumGatewayLocation, + EthereumLocation, >, ), ForeignCreatorsSovereignAccountOf, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index c6ea9f3fdd5d0..106426011f93e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -41,7 +41,7 @@ use parachains_common::{ use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::xcm_sender::ExponentialPrice; use rococo_runtime_constants::system_parachain::SystemParachains; -use snowbridge_router_primitives::inbound::GlobalConsensusEthereumAccountConvertsFor; +use snowbridge_router_primitives::inbound::GlobalConsensusEthereumConvertsFor; use sp_runtime::traits::{AccountIdConversion, ConvertInto}; use xcm::latest::prelude::*; use xcm_builder::{ @@ -113,7 +113,7 @@ pub type LocationToAccountId = ( GlobalConsensusParachainConvertsFor, // Ethereum contract sovereign account. // (Used to get convert ethereum contract locations to sovereign account) - GlobalConsensusEthereumAccountConvertsFor, + GlobalConsensusEthereumConvertsFor, ); /// Means for transacting the native currency on this chain. @@ -699,7 +699,7 @@ pub type ForeignCreatorsSovereignAccountOf = ( SiblingParachainConvertsVia, AccountId32Aliases, ParentIsPreset, - GlobalConsensusEthereumAccountConvertsFor, + GlobalConsensusEthereumConvertsFor, ); /// Simple conversion of `u32` into an `AssetId` for use in benchmarking. @@ -872,17 +872,7 @@ pub mod bridging { pub AssetHubRococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(RococoNetwork::get()), Parachain(bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID))); pub RocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(RococoNetwork::get()))); pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 }; - pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get()))); // TODO: Maybe registry address belongs here - - pub const EthereumGatewayAddress: [u8; 20] = hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"); - // The Registry contract for the bridge which is also the origin for reserves and the prefix of all assets. - pub EthereumGatewayLocation: MultiLocation = EthereumLocation::get() - .pushed_with_interior( - AccountKey20 { - network: None, - key: EthereumGatewayAddress::get(), - } - ).unwrap(); + pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get()))); pub RocFromAssetHubRococo: (MultiAssetFilter, MultiLocation) = ( Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }), @@ -923,7 +913,7 @@ pub mod bridging { ]; pub AllowedReserveTransferAssetsToEthereum: sp_std::vec::Vec = sp_std::vec![ - Wild(AllOf { fun: WildFungible, id: Concrete(EthereumGatewayLocation::get()) }), + Wild(AllOf { fun: WildFungible, id: Concrete(EthereumLocation::get()) }), ]; /// Universal aliases 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 d40ed9de24194..1939f06595926 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 @@ -86,7 +86,7 @@ use pallet_xcm::EnsureXcm; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; pub use sp_runtime::{MultiAddress, Perbill, Permill}; use xcm::VersionedMultiLocation; -use xcm_config::{EthereumGatewayAddress, XcmConfig, XcmOriginToTransactDispatchOrigin}; +use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; use bp_runtime::HeaderId; @@ -500,7 +500,7 @@ impl pallet_message_queue::Config for Runtime { parameter_types! { pub const Reward: u128 = 10; - pub const GatewayAddress: H160 = H160(EthereumGatewayAddress::get()); + pub const GatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39")); pub const CreateAssetCall: [u8;2] = [53, 0]; pub const CreateAssetExecutionFee: u128 = 2_000_000_000; pub const SendTokenExecutionFee: u128 = 1_000_000_000; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 5571432fc0302..b29ef15a58ee4 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -85,16 +85,6 @@ parameter_types! { // Network and location for the local Ethereum testnet. pub const EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 }; pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get()))); - - pub const EthereumGatewayAddress: [u8; 20] = hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"); - // The Registry contract for the bridge which is also the origin for reserves and the prefix of all assets. - pub EthereumGatewayLocation: MultiLocation = EthereumLocation::get() - .pushed_with_interior( - AccountKey20 { - network: None, - key: EthereumGatewayAddress::get(), - } - ).unwrap(); } /// Adapter for resolving `NetworkId` based on `pub storage Flavor: RuntimeFlavor`. @@ -428,7 +418,7 @@ pub type AgentIdOf = HashedDescription pub type SnowbridgeExporter = EthereumBlobExporter< UniversalLocation, - EthereumGatewayLocation, + EthereumLocation, snowbridge_outbound_queue::Pallet, AgentIdOf, >;