diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index eb06422fe17..d443d3632cd 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -56,8 +56,8 @@ use sp_version::RuntimeVersion; use frame_support::{ construct_runtime, - parameter_types, dispatch::DispatchClass, + parameter_types, traits::{ConstBool, ConstU32, ConstU64, ConstU8, Everything}, weights::{ConstantMultiplier, Weight}, PalletId, @@ -72,15 +72,11 @@ 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::{EthereumGatewayAddress, XcmConfig, XcmOriginToTransactDispatchOrigin}; use crate::xcm_config::RelayLocation; use bp_parachains::SingleParaStoredHeaderDataBuilder; use bp_runtime::HeaderId; -use snowbridge_router_primitives::inbound::MessageToXcm; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -111,6 +107,7 @@ use parachains_common::{ }; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::AgentId; +use snowbridge_router_primitives::inbound::MessageToXcm; use xcm_executor::XcmExecutor; /// The address format for describing accounts. @@ -589,6 +586,8 @@ parameter_types! { pub const Reward: u128 = 10; pub const GatewayAddress: H160 = H160(EthereumGatewayAddress::get()); pub const CreateAssetCall: [u8;2] = [53, 0]; + pub const CreateAssetExecutionFee: u128 = 2_000_000_000; + pub const SendTokenExecutionFee: u128 = 1_000_000_000; } #[cfg(feature = "runtime-benchmarks")] @@ -611,10 +610,10 @@ impl snowbridge_inbound_queue::Config for Runtime { type GatewayAddress = GatewayAddress; #[cfg(feature = "runtime-benchmarks")] type Helper = Runtime; - type MessageConverter = MessageToXcm; + type MessageConverter = + MessageToXcm; } - pub const GWEI: u128 = 1_000_000_000; parameter_types! { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index ac2f1539a47..2ef7990e478 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -34,18 +34,17 @@ use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom use polkadot_parachain::primitives::Sibling; use snowbridge_outbound_queue; use snowbridge_router_primitives::outbound::EthereumBlobExporter; -use sp_core::{H256, Get}; +use sp_core::{Get, H256}; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, - CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, - IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, - WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, + CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, + DescribeFamily, EnsureXcmOrigin, HashedDescription, IsConcrete, ParentAsSuperuser, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; -use xcm_builder::{HashedDescription, DescribeFamily, DescribeAllTerminal}; use xcm_executor::{ traits::{ExportXcm, WithOriginFilter}, @@ -182,44 +181,44 @@ impl Contains for SafeCallFilter { matches!( call, - RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) - | RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } - | frame_system::Call::set_code { .. } - | frame_system::Call::set_code_without_checks { .. } - | frame_system::Call::kill_prefix { .. }, - ) | RuntimeCall::ParachainSystem(..) - | RuntimeCall::Timestamp(..) - | RuntimeCall::Balances(..) - | RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } - | pallet_collator_selection::Call::set_candidacy_bond { .. } - | pallet_collator_selection::Call::register_as_candidate { .. } - | pallet_collator_selection::Call::leave_intent { .. } - | pallet_collator_selection::Call::set_invulnerables { .. } - | pallet_collator_selection::Call::add_invulnerable { .. } - | pallet_collator_selection::Call::remove_invulnerable { .. }, - ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) - | RuntimeCall::XcmpQueue(..) - | RuntimeCall::DmpQueue(..) - | RuntimeCall::Utility(..) - | RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< + RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(..) | + RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< Runtime, BridgeGrandpaRococoInstance, - >::initialize { .. }) - | RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< + >::initialize { .. }) | + RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< Runtime, BridgeGrandpaWococoInstance, - >::initialize { .. }) - | RuntimeCall::EthereumBeaconClient( - snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. } - | snowbridge_ethereum_beacon_client::Call::set_owner { .. } - | snowbridge_ethereum_beacon_client::Call::set_operating_mode { .. }, + >::initialize { .. }) | + RuntimeCall::EthereumBeaconClient( + snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. } | + snowbridge_ethereum_beacon_client::Call::set_owner { .. } | + snowbridge_ethereum_beacon_client::Call::set_operating_mode { .. }, ) | RuntimeCall::EthereumInboundQueue( - snowbridge_inbound_queue::Call::set_owner { .. } - | snowbridge_inbound_queue::Call::set_operating_mode { .. }, - ) | RuntimeCall::EthereumOutboundQueue(..) - | RuntimeCall::EthereumControl(..) + snowbridge_inbound_queue::Call::set_owner { .. } | + snowbridge_inbound_queue::Call::set_operating_mode { .. }, + ) | RuntimeCall::EthereumOutboundQueue(..) | + RuntimeCall::EthereumControl(..) ) } } @@ -302,12 +301,17 @@ pub type XcmRouter = WithUniqueTopic<( #[cfg(feature = "runtime-benchmarks")] pub(crate) mod benchmark_helper { - use crate::xcm_config::{MultiAssets, MultiLocation, SendError, SendResult, SendXcm, Xcm, XcmHash}; + use crate::xcm_config::{ + MultiAssets, MultiLocation, SendError, SendResult, SendXcm, Xcm, XcmHash, + }; pub struct DoNothingRouter; impl SendXcm for DoNothingRouter { type Ticket = (); - fn validate(_dest: &mut Option, _msg: &mut Option>) -> SendResult<()> { + fn validate( + _dest: &mut Option, + _msg: &mut Option>, + ) -> SendResult<()> { Ok(((), MultiAssets::new())) } fn deliver(_: ()) -> Result { @@ -399,7 +403,7 @@ impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter { message, ) .map(|result| ((Wococo, result.0), result.1)), - location if location == EthereumNetwork::get() && relay == NetworkId::Rococo => { + location if location == EthereumNetwork::get() && relay == NetworkId::Rococo => SnowbridgeExporter::validate( network, channel, @@ -407,8 +411,7 @@ impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter { destination, message, ) - .map(|result| ((EthereumNetwork::get(), (result.0, XcmHash::default())), result.1)) - }, + .map(|result| ((EthereumNetwork::get(), (result.0, XcmHash::default())), result.1)), _ => unimplemented!("Unsupported network: {:?}", network), } } @@ -419,9 +422,8 @@ impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter { match network { Rococo => ToBridgeHubRococoHaulBlobExporter::deliver(ticket), Wococo => ToBridgeHubWococoHaulBlobExporter::deliver(ticket), - location if location == EthereumNetwork::get() && relay == NetworkId::Rococo => { - SnowbridgeExporter::deliver(ticket.0) - }, + location if location == EthereumNetwork::get() && relay == NetworkId::Rococo => + SnowbridgeExporter::deliver(ticket.0), _ => unimplemented!("Unsupported network: {:?}", network), } }