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

Rococo People <> Bulletin bridge fixes #6708

Merged
merged 3 commits into from
Dec 3, 2024
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: 1 addition & 1 deletion bridges/chains/chain-polkadot-bulletin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,4 @@ impl ChainWithMessages for PolkadotBulletin {
}

decl_bridge_finality_runtime_apis!(polkadot_bulletin, grandpa);
decl_bridge_messages_runtime_apis!(polkadot_bulletin, bp_messages::HashedLaneId);
decl_bridge_messages_runtime_apis!(polkadot_bulletin, bp_messages::LegacyLaneId);
7 changes: 4 additions & 3 deletions bridges/relays/utils/src/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ pub fn initialize_logger(with_timestamp: bool) {
format,
);

let env_filter = EnvFilter::from_default_env()
.add_directive(Level::WARN.into())
.add_directive("bridge=info".parse().expect("static filter string is valid"));
let env_filter = EnvFilter::builder()
.with_default_directive(Level::WARN.into())
.with_default_directive("bridge=info".parse().expect("static filter string is valid"))
.from_env_lossy();

let builder = SubscriberBuilder::default().with_env_filter(env_filter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
use crate::{
bridge_common_config::RelayersForPermissionlessLanesInstance, weights,
xcm_config::UniversalLocation, AccountId, Balance, Balances, BridgeRococoBulletinGrandpa,
BridgeRococoBulletinMessages, PolkadotXcm, Runtime, RuntimeEvent, RuntimeHoldReason,
XcmOverRococoBulletin, XcmRouter,
BridgeRococoBulletinMessages, Runtime, RuntimeEvent, RuntimeHoldReason, XcmOverRococoBulletin,
XcmRouter,
};
use bp_messages::{
source_chain::FromBridgedChainMessagesDeliveryProof,
target_chain::FromBridgedChainMessagesProof, HashedLaneId,
target_chain::FromBridgedChainMessagesProof, LegacyLaneId,
};
use bridge_hub_common::xcm_version::XcmVersionOfDestAndRemoteBridge;

use frame_support::{
parameter_types,
Expand All @@ -46,6 +45,7 @@ use testnet_parachains_constants::rococo::currency::UNITS as ROC;
use xcm::{
latest::prelude::*,
prelude::{InteriorLocation, NetworkId},
AlwaysV5,
};
use xcm_builder::{BridgeBlobDispatcher, ParentIsPreset, SiblingParachainConvertsVia};

Expand Down Expand Up @@ -120,7 +120,7 @@ impl pallet_bridge_messages::Config<WithRococoBulletinMessagesInstance> for Runt

type OutboundPayload = XcmAsPlainPayload;
type InboundPayload = XcmAsPlainPayload;
type LaneId = HashedLaneId;
type LaneId = LegacyLaneId;

type DeliveryPayments = ();
type DeliveryConfirmationPayments = ();
Expand All @@ -139,8 +139,7 @@ impl pallet_xcm_bridge_hub::Config<XcmOverPolkadotBulletinInstance> for Runtime
type BridgeMessagesPalletInstance = WithRococoBulletinMessagesInstance;

type MessageExportPrice = ();
type DestinationVersion =
XcmVersionOfDestAndRemoteBridge<PolkadotXcm, RococoBulletinGlobalConsensusNetworkLocation>;
type DestinationVersion = AlwaysV5;

type ForceOrigin = EnsureRoot<AccountId>;
// We don't want to allow creating bridges for this instance.
Expand Down Expand Up @@ -253,7 +252,7 @@ where
let universal_source =
[GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)), Parachain(sibling_para_id)].into();
let universal_destination =
[GlobalConsensus(RococoBulletinGlobalConsensusNetwork::get()), Parachain(2075)].into();
[GlobalConsensus(RococoBulletinGlobalConsensusNetwork::get())].into();
let bridge_id = BridgeId::new(&universal_source, &universal_destination);

// insert only bridge metadata, because the benchmarks create lanes
Expand All @@ -279,29 +278,3 @@ where

universal_source
}

/// Contains the migration for the PeopleRococo<>RococoBulletin bridge.
pub mod migration {
use super::*;
use frame_support::traits::ConstBool;

parameter_types! {
pub BulletinRococoLocation: InteriorLocation = [GlobalConsensus(RococoBulletinGlobalConsensusNetwork::get())].into();
pub RococoPeopleToRococoBulletinMessagesLane: HashedLaneId = pallet_xcm_bridge_hub::Pallet::< Runtime, XcmOverPolkadotBulletinInstance >::bridge_locations(
PeopleRococoLocation::get(),
BulletinRococoLocation::get()
)
.unwrap()
.calculate_lane_id(xcm::latest::VERSION).expect("Valid locations");
}

/// Ensure that the existing lanes for the People<>Bulletin bridge are correctly configured.
pub type StaticToDynamicLanes = pallet_xcm_bridge_hub::migration::OpenBridgeForLane<
Runtime,
XcmOverPolkadotBulletinInstance,
RococoPeopleToRococoBulletinMessagesLane,
ConstBool<true>,
PeopleRococoLocation,
BulletinRococoLocation,
>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,20 @@ fn bridge_hub_rococo_genesis(
.collect(),
},
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
bridge_polkadot_bulletin_grandpa: BridgePolkadotBulletinGrandpaConfig {
owner: bridges_pallet_owner.clone(),
},
bridge_westend_grandpa: BridgeWestendGrandpaConfig { owner: bridges_pallet_owner.clone() },
bridge_westend_messages: BridgeWestendMessagesConfig {
owner: bridges_pallet_owner.clone(),
},
xcm_over_polkadot_bulletin: XcmOverPolkadotBulletinConfig {
opened_bridges: vec![(
Location::new(1, [Parachain(1004)]),
Junctions::from([GlobalConsensus(NetworkId::PolkadotBulletin).into()]),
Some(bp_messages::LegacyLaneId([0, 0, 0, 0])),
)],
},
xcm_over_bridge_hub_westend: XcmOverBridgeHubWestendConfig { opened_bridges },
ethereum_system: EthereumSystemConfig { para_id: id, asset_hub_para_id },
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ pub type Migrations = (
bridge_to_westend_config::WithBridgeHubWestendMessagesInstance,
>,
bridge_to_westend_config::migration::StaticToDynamicLanes,
bridge_to_bulletin_config::migration::StaticToDynamicLanes,
frame_support::migrations::RemoveStorage<
BridgeWestendMessagesPalletName,
OutboundLanesCongestedSignalsKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,10 @@ mod bridge_hub_westend_tests {

mod bridge_hub_bulletin_tests {
use super::*;
use bp_messages::{HashedLaneId, LaneIdType};
use bp_messages::LegacyLaneId;
use bridge_common_config::BridgeGrandpaRococoBulletinInstance;
use bridge_hub_rococo_runtime::{
bridge_common_config::RelayersForPermissionlessLanesInstance,
bridge_common_config::RelayersForLegacyLaneIdsMessagesInstance,
xcm_config::LocationToAccountId,
};
use bridge_hub_test_utils::test_cases::from_grandpa_chain;
Expand All @@ -528,7 +528,7 @@ mod bridge_hub_bulletin_tests {
AllPalletsWithoutSystem,
BridgeGrandpaRococoBulletinInstance,
WithRococoBulletinMessagesInstance,
RelayersForPermissionlessLanesInstance,
RelayersForLegacyLaneIdsMessagesInstance,
>;

#[test]
Expand Down Expand Up @@ -599,7 +599,7 @@ mod bridge_hub_bulletin_tests {
bridge_hub_test_utils::open_bridge_with_storage::<
Runtime,
XcmOverPolkadotBulletinInstance
>(locations, HashedLaneId::try_new(1, 2).unwrap())
>(locations, LegacyLaneId([0, 0, 0, 0]))
}
).1
},
Expand Down Expand Up @@ -663,7 +663,7 @@ mod bridge_hub_bulletin_tests {
bridge_hub_test_utils::open_bridge_with_storage::<
Runtime,
XcmOverPolkadotBulletinInstance,
>(locations, HashedLaneId::try_new(1, 2).unwrap())
>(locations, LegacyLaneId([0, 0, 0, 0]))
},
)
.1
Expand Down Expand Up @@ -697,7 +697,7 @@ mod bridge_hub_bulletin_tests {
bridge_hub_test_utils::open_bridge_with_storage::<
Runtime,
XcmOverPolkadotBulletinInstance,
>(locations, HashedLaneId::try_new(1, 2).unwrap())
>(locations, LegacyLaneId([0, 0, 0, 0]))
},
)
.1
Expand Down
Loading