Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Oct 18, 2023
1 parent d89108e commit b818643
Showing 1 changed file with 50 additions and 48 deletions.
98 changes: 50 additions & 48 deletions parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -182,44 +181,44 @@ impl Contains<RuntimeCall> 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(..)
)
}
}
Expand Down Expand Up @@ -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<MultiLocation>, _msg: &mut Option<Xcm<()>>) -> SendResult<()> {
fn validate(
_dest: &mut Option<MultiLocation>,
_msg: &mut Option<Xcm<()>>,
) -> SendResult<()> {
Ok(((), MultiAssets::new()))
}
fn deliver(_: ()) -> Result<XcmHash, SendError> {
Expand Down Expand Up @@ -399,16 +403,15 @@ 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,
universal_source,
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),
}
}
Expand All @@ -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),
}
}
Expand Down

0 comments on commit b818643

Please sign in to comment.