mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 16:51:02 +00:00
Remove deprecated code from bridge-runtime-common (#1983)
* removed FromBridgedChainMessageDispatch in favor of XcmBlobMessageDispatch * use HaulBlobExporter/HaulBlobExporterAdapter instead of XcmBridge/XcmBridgeAdapter * tests for sending/dispatching messages * use new schema in testnet bridges + some cleanup * clippy * spelling + added TODO * cleanup some checks * benchmarks compilation * all is XCM * updated README.md * ref issue from TODO
This commit is contained in:
committed by
Bastian Köcher
parent
2407228972
commit
a75c28d5b2
@@ -19,14 +19,18 @@
|
||||
// TODO: this is almost exact copy of `millau_messages.rs` from Rialto runtime.
|
||||
// Should be extracted to a separate crate and reused here.
|
||||
|
||||
use crate::{MillauGrandpaInstance, Runtime, RuntimeCall, RuntimeOrigin};
|
||||
use crate::{MillauGrandpaInstance, Runtime, RuntimeOrigin, WithMillauMessagesInstance};
|
||||
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{ChainId, MILLAU_CHAIN_ID, RIALTO_PARACHAIN_CHAIN_ID};
|
||||
use bridge_runtime_common::messages::{
|
||||
self, source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter, MessageBridge,
|
||||
use bp_messages::LaneId;
|
||||
use bridge_runtime_common::{
|
||||
messages::{
|
||||
self, source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter, MessageBridge,
|
||||
},
|
||||
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
|
||||
};
|
||||
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::HaulBlobExporter;
|
||||
|
||||
/// Default lane that is used to send messages to Millau.
|
||||
pub const XCM_LANE: LaneId = LaneId([0, 0, 0, 0]);
|
||||
@@ -51,15 +55,16 @@ pub type ToMillauMessageVerifier =
|
||||
messages::source::FromThisChainMessageVerifier<WithMillauMessageBridge>;
|
||||
|
||||
/// Message payload for Millau -> RialtoParachain messages.
|
||||
pub type FromMillauMessagePayload = messages::target::FromBridgedChainMessagePayload<RuntimeCall>;
|
||||
pub type FromMillauMessagePayload = messages::target::FromBridgedChainMessagePayload;
|
||||
|
||||
/// Call-dispatch based message dispatch for Millau -> RialtoParachain messages.
|
||||
pub type FromMillauMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
|
||||
WithMillauMessageBridge,
|
||||
xcm_executor::XcmExecutor<crate::XcmConfig>,
|
||||
crate::XcmWeigher,
|
||||
WeightCredit,
|
||||
>;
|
||||
pub type FromMillauMessageDispatch =
|
||||
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
|
||||
bp_rialto_parachain::RialtoParachain,
|
||||
bp_millau::Millau,
|
||||
crate::OnRialtoParachainBlobDispatcher,
|
||||
bridge_runtime_common::messages_xcm_extension::XcmRouterWeigher<()>,
|
||||
>;
|
||||
|
||||
/// Messages proof for Millau -> RialtoParachain messages.
|
||||
pub type FromMillauMessagesProof = messages::target::FromBridgedChainMessagesProof<bp_millau::Hash>;
|
||||
@@ -77,8 +82,6 @@ pub type ToMillauMaximalOutboundPayloadSize =
|
||||
pub struct WithMillauMessageBridge;
|
||||
|
||||
impl MessageBridge for WithMillauMessageBridge {
|
||||
const THIS_CHAIN_ID: ChainId = RIALTO_PARACHAIN_CHAIN_ID;
|
||||
const BRIDGED_CHAIN_ID: ChainId = MILLAU_CHAIN_ID;
|
||||
const BRIDGED_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_rialto_parachain::WITH_RIALTO_PARACHAIN_MESSAGES_PALLET_NAME;
|
||||
|
||||
@@ -97,16 +100,7 @@ impl messages::UnderlyingChainProvider for RialtoParachain {
|
||||
}
|
||||
|
||||
impl messages::ThisChainWithMessages for RialtoParachain {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, _lane: &LaneId) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
MessageNonce::MAX
|
||||
}
|
||||
}
|
||||
|
||||
/// Millau chain from message lane point of view.
|
||||
@@ -121,8 +115,24 @@ impl messages::UnderlyingChainProvider for Millau {
|
||||
type Chain = bp_millau::Millau;
|
||||
}
|
||||
|
||||
impl messages::BridgedChainWithMessages for Millau {
|
||||
fn verify_dispatch_weight(_message_payload: &[u8]) -> bool {
|
||||
true
|
||||
impl messages::BridgedChainWithMessages for Millau {}
|
||||
|
||||
/// Export XCM messages to be relayed to Millau.
|
||||
pub type ToMillauBlobExporter =
|
||||
HaulBlobExporter<XcmBlobHaulerAdapter<ToMillauXcmBlobHauler>, crate::MillauNetwork, ()>;
|
||||
|
||||
/// To-Millau XCM hauler.
|
||||
pub struct ToMillauXcmBlobHauler;
|
||||
|
||||
impl XcmBlobHauler for ToMillauXcmBlobHauler {
|
||||
type MessageSender = pallet_bridge_messages::Pallet<Runtime, WithMillauMessagesInstance>;
|
||||
type MessageSenderOrigin = RuntimeOrigin;
|
||||
|
||||
fn message_sender_origin() -> RuntimeOrigin {
|
||||
pallet_xcm::Origin::from(MultiLocation::new(1, crate::UniversalLocation::get())).into()
|
||||
}
|
||||
|
||||
fn xcm_lane() -> LaneId {
|
||||
XCM_LANE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user