Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pallet_xcm_bridge_hub::SuspendedBridges #2505

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ impl pallet_xcm_bridge_hub::Config<WithRialtoXcmBridgeHubInstance> for Runtime {
type BridgedNetworkId = xcm_config::RialtoNetwork;
type BridgeMessagesPalletInstance = WithRialtoMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = xcm_config::SovereignAccountOf;

Expand All @@ -587,7 +586,6 @@ impl pallet_xcm_bridge_hub::Config<WithRialtoParachainXcmBridgeHubInstance> for
type BridgedNetworkId = xcm_config::RialtoParachainNetwork;
type BridgeMessagesPalletInstance = WithRialtoParachainMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = xcm_config::SovereignAccountOf;

Expand Down
38 changes: 30 additions & 8 deletions bin/millau/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ use super::{
AccountId, AllPalletsWithSystem, Balances, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
XcmPallet,
};
use bp_millau::WeightToFee;
use bp_xcm_bridge_hub::{BridgeId, BridgeLocations};
use bp_millau::{Millau, WeightToFee};
use bp_xcm_bridge_hub::{Bridge, BridgeId};
use bridge_runtime_common::CustomNetworkId;
use frame_support::{
parameter_types,
traits::{ConstU32, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
use sp_std::prelude::*;
use xcm::latest::prelude::*;
use xcm_builder::{
Account32Hash, AccountId32Aliases, CurrencyAdapter as XcmCurrencyAdapter, IsConcrete,
Expand Down Expand Up @@ -202,7 +201,7 @@ impl pallet_xcm::Config for Runtime {
pub struct ToRialtoOrRialtoParachainSwitchExporter;

impl ExportXcm for ToRialtoOrRialtoParachainSwitchExporter {
type Ticket = (NetworkId, (Box<BridgeLocations>, sp_std::prelude::Vec<u8>, XcmHash));
type Ticket = (NetworkId, (BridgeId, Bridge<Millau>, sp_std::prelude::Vec<u8>, XcmHash));

fn validate(
network: NetworkId,
Expand Down Expand Up @@ -277,15 +276,18 @@ impl bp_xcm_bridge_hub::LocalXcmChannelManager for EmulatedSiblingXcmpChannel {
mod tests {
use super::*;
use crate::{
WithRialtoMessagesInstance, WithRialtoParachainMessagesInstance, XcmRialtoBridgeHub,
XcmRialtoParachainBridgeHub,
WithRialtoMessagesInstance, WithRialtoParachainMessagesInstance,
WithRialtoParachainXcmBridgeHubInstance, WithRialtoXcmBridgeHubInstance,
XcmRialtoBridgeHub, XcmRialtoParachainBridgeHub,
};
use bp_messages::{
target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch},
LaneId, MessageKey, OutboundLaneData,
};
use bp_xcm_bridge_hub::BridgeState;
use codec::Encode;
use pallet_bridge_messages::OutboundLanes;
use pallet_xcm_bridge_hub::Bridges;
use sp_runtime::BuildStorage;
use xcm_executor::XcmExecutor;

Expand All @@ -308,7 +310,17 @@ mod tests {
fn xcm_messages_to_rialto_are_sent_using_bridge_exporter() {
new_test_ext().execute_with(|| {
// ensure that the there are no messages queued
let lane_id = crate::rialto_messages::Bridge::get().lane_id();
let bridge_id = crate::rialto_messages::Bridge::get();
let lane_id = bridge_id.lane_id();
Bridges::<Runtime, WithRialtoXcmBridgeHubInstance>::insert(
bridge_id,
Bridge {
bridge_origin_relative_location: Box::new(MultiLocation::new(0, Here).into()),
state: BridgeState::Opened,
bridge_owner_account: [0u8; 32].into(),
reserve: 0,
},
);
OutboundLanes::<Runtime, WithRialtoMessagesInstance>::insert(
lane_id,
OutboundLaneData::opened(),
Expand Down Expand Up @@ -345,7 +357,17 @@ mod tests {
fn xcm_messages_to_rialto_parachain_are_sent_using_bridge_exporter() {
new_test_ext().execute_with(|| {
// ensure that the there are no messages queued
let lane_id = crate::rialto_parachain_messages::Lane::get();
let bridge_id = crate::rialto_parachain_messages::Bridge::get();
let lane_id = bridge_id.lane_id();
Bridges::<Runtime, WithRialtoParachainXcmBridgeHubInstance>::insert(
bridge_id,
Bridge {
bridge_origin_relative_location: Box::new(MultiLocation::new(0, Here).into()),
state: BridgeState::Opened,
bridge_owner_account: [0u8; 32].into(),
reserve: 0,
},
);
OutboundLanes::<Runtime, WithRialtoParachainMessagesInstance>::insert(
lane_id,
OutboundLaneData::opened(),
Expand Down
15 changes: 13 additions & 2 deletions bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ impl pallet_xcm_bridge_hub::Config<WithMillauXcmBridgeHubInstance> for Runtime {
type BridgedNetworkId = MillauNetwork;
type BridgeMessagesPalletInstance = WithMillauMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = LocationToAccountId;

Expand Down Expand Up @@ -871,9 +870,11 @@ mod tests {
MessageKey, OutboundLaneData,
};
use bp_runtime::Chain;
use bp_xcm_bridge_hub::{Bridge, BridgeState};
use bridge_runtime_common::integrity::check_additional_signed;
use codec::Encode;
use pallet_bridge_messages::OutboundLanes;
use pallet_xcm_bridge_hub::Bridges;
use sp_runtime::generic::Era;
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -904,7 +905,17 @@ mod tests {
fn xcm_messages_to_millau_are_sent_using_bridge_exporter() {
new_test_ext().execute_with(|| {
// ensure that the there are no messages queued
let lane_id = crate::millau_messages::Bridge::get().lane_id();
let bridge_id = crate::millau_messages::Bridge::get();
let lane_id = bridge_id.lane_id();
Bridges::<Runtime, WithMillauXcmBridgeHubInstance>::insert(
bridge_id,
Bridge {
bridge_origin_relative_location: Box::new(MultiLocation::new(0, Here).into()),
state: BridgeState::Opened,
bridge_owner_account: [0u8; 32].into(),
reserve: 0,
},
);
OutboundLanes::<Runtime, WithMillauMessagesInstance>::insert(
lane_id,
OutboundLaneData::opened(),
Expand Down
1 change: 0 additions & 1 deletion bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ impl pallet_xcm_bridge_hub::Config<WithMillauXcmBridgeHubInstance> for Runtime {
type BridgedNetworkId = xcm_config::MillauNetwork;
type BridgeMessagesPalletInstance = WithMillauMessagesInstance;

type MaxSuspendedBridges = ConstU32<1>;
type OpenBridgeOrigin = frame_support::traits::NeverEnsureOrigin<xcm::latest::MultiLocation>;
type BridgeOriginAccountIdConverter = xcm_config::SovereignAccountOf;

Expand Down
16 changes: 14 additions & 2 deletions bin/rialto/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,15 @@ impl pallet_xcm::Config for Runtime {
#[cfg(test)]
mod tests {
use super::*;
use crate::{WithMillauMessagesInstance, XcmMillauBridgeHub};
use crate::{WithMillauMessagesInstance, WithMillauXcmBridgeHubInstance, XcmMillauBridgeHub};
use bp_messages::{
target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch},
MessageKey, OutboundLaneData,
};
use bp_xcm_bridge_hub::{Bridge, BridgeState};
use codec::Encode;
use pallet_bridge_messages::OutboundLanes;
use pallet_xcm_bridge_hub::Bridges;
use sp_runtime::BuildStorage;
use xcm_executor::XcmExecutor;

Expand All @@ -224,7 +226,17 @@ mod tests {
fn xcm_messages_to_millau_are_sent_using_bridge_exporter() {
new_test_ext().execute_with(|| {
// ensure that the there are no messages queued
let lane_id = crate::millau_messages::Bridge::get().lane_id();
let bridge_id = crate::millau_messages::Bridge::get();
let lane_id = bridge_id.lane_id();
Bridges::<Runtime, WithMillauXcmBridgeHubInstance>::insert(
bridge_id,
Bridge {
bridge_origin_relative_location: Box::new(MultiLocation::new(0, Here).into()),
state: BridgeState::Opened,
bridge_owner_account: [0u8; 32].into(),
reserve: 0,
},
);
OutboundLanes::<Runtime, WithMillauMessagesInstance>::insert(
lane_id,
OutboundLaneData::opened(),
Expand Down
Loading