mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11: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
@@ -33,7 +33,7 @@ use crate::messages::{
|
||||
};
|
||||
|
||||
use bp_header_chain::{ChainWithGrandpa, HeaderChain};
|
||||
use bp_messages::{target_chain::ForbidInboundMessages, LaneId, MessageNonce};
|
||||
use bp_messages::{target_chain::ForbidInboundMessages, LaneId};
|
||||
use bp_parachains::SingleParaStoredHeaderDataBuilder;
|
||||
use bp_runtime::{Chain, ChainId, Parachain, UnderlyingChainProvider};
|
||||
use codec::{Decode, Encode};
|
||||
@@ -87,10 +87,6 @@ pub type BridgedChainHeader =
|
||||
pub const TEST_LANE_ID: LaneId = LaneId([0, 0, 0, 0]);
|
||||
/// Bridged chain id used in tests.
|
||||
pub const TEST_BRIDGED_CHAIN_ID: ChainId = *b"brdg";
|
||||
/// Maximal number of queued messages at the test lane.
|
||||
pub const MAXIMAL_PENDING_MESSAGES_AT_TEST_LANE: MessageNonce = 32;
|
||||
/// Minimal extrinsic weight at the `BridgedChain`.
|
||||
pub const BRIDGED_CHAIN_MIN_EXTRINSIC_WEIGHT: usize = 5;
|
||||
/// Maximal extrinsic weight at the `BridgedChain`.
|
||||
pub const BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT: usize = 2048;
|
||||
/// Maximal extrinsic size at the `BridgedChain`.
|
||||
@@ -222,7 +218,7 @@ impl pallet_bridge_messages::Config for TestRuntime {
|
||||
type MaximalOutboundPayloadSize = FromThisChainMaximalOutboundPayloadSize<OnThisChainBridge>;
|
||||
type OutboundPayload = FromThisChainMessagePayload;
|
||||
|
||||
type InboundPayload = FromBridgedChainMessagePayload<ThisChainRuntimeCall>;
|
||||
type InboundPayload = FromBridgedChainMessagePayload;
|
||||
type InboundRelayer = BridgedChainAccountId;
|
||||
type DeliveryPayments = ();
|
||||
|
||||
@@ -235,8 +231,7 @@ impl pallet_bridge_messages::Config for TestRuntime {
|
||||
>;
|
||||
|
||||
type SourceHeaderChain = SourceHeaderChainAdapter<OnThisChainBridge>;
|
||||
type MessageDispatch =
|
||||
ForbidInboundMessages<(), FromBridgedChainMessagePayload<ThisChainRuntimeCall>>;
|
||||
type MessageDispatch = ForbidInboundMessages<(), FromBridgedChainMessagePayload>;
|
||||
type BridgedChainId = BridgedChainId;
|
||||
}
|
||||
|
||||
@@ -253,8 +248,6 @@ impl pallet_bridge_relayers::Config for TestRuntime {
|
||||
pub struct OnThisChainBridge;
|
||||
|
||||
impl MessageBridge for OnThisChainBridge {
|
||||
const THIS_CHAIN_ID: ChainId = *b"this";
|
||||
const BRIDGED_CHAIN_ID: ChainId = TEST_BRIDGED_CHAIN_ID;
|
||||
const BRIDGED_MESSAGES_PALLET_NAME: &'static str = "";
|
||||
|
||||
type ThisChain = ThisChain;
|
||||
@@ -268,8 +261,6 @@ impl MessageBridge for OnThisChainBridge {
|
||||
pub struct OnBridgedChainBridge;
|
||||
|
||||
impl MessageBridge for OnBridgedChainBridge {
|
||||
const THIS_CHAIN_ID: ChainId = TEST_BRIDGED_CHAIN_ID;
|
||||
const BRIDGED_CHAIN_ID: ChainId = *b"this";
|
||||
const BRIDGED_MESSAGES_PALLET_NAME: &'static str = "";
|
||||
|
||||
type ThisChain = BridgedChain;
|
||||
@@ -331,22 +322,9 @@ impl UnderlyingChainProvider for ThisChain {
|
||||
|
||||
impl ThisChainWithMessages for ThisChain {
|
||||
type RuntimeOrigin = ThisChainCallOrigin;
|
||||
type RuntimeCall = ThisChainRuntimeCall;
|
||||
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool {
|
||||
*lane == TEST_LANE_ID
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
MAXIMAL_PENDING_MESSAGES_AT_TEST_LANE
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgedChainWithMessages for ThisChain {
|
||||
fn verify_dispatch_weight(_message_payload: &[u8]) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
impl BridgedChainWithMessages for ThisChain {}
|
||||
|
||||
/// Underlying chain of `BridgedChain`.
|
||||
pub struct BridgedUnderlyingChain;
|
||||
@@ -413,20 +391,6 @@ impl UnderlyingChainProvider for BridgedChain {
|
||||
|
||||
impl ThisChainWithMessages for BridgedChain {
|
||||
type RuntimeOrigin = BridgedChainOrigin;
|
||||
type RuntimeCall = BridgedChainCall;
|
||||
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, _lane: &LaneId) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgedChainWithMessages for BridgedChain {
|
||||
fn verify_dispatch_weight(message_payload: &[u8]) -> bool {
|
||||
message_payload.len() >= BRIDGED_CHAIN_MIN_EXTRINSIC_WEIGHT &&
|
||||
message_payload.len() <= BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT
|
||||
}
|
||||
}
|
||||
impl BridgedChainWithMessages for BridgedChain {}
|
||||
|
||||
Reference in New Issue
Block a user