mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Prune messages from on-idle callback (#1650)
* prune messages from on-idle callback * no more secondary lanes at deployments * clippy * Update modules/messages/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * sub -> add * more tests + check that message is sent using one of ActiveOutboundLanes * ensure spent_weight is correct Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
8e660dd74e
commit
eabfea6229
@@ -469,6 +469,8 @@ parameter_types! {
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
pub const RialtoChainId: bp_runtime::ChainId = bp_runtime::RIALTO_CHAIN_ID;
|
||||
pub const RialtoParachainChainId: bp_runtime::ChainId = bp_runtime::RIALTO_PARACHAIN_CHAIN_ID;
|
||||
pub RialtoActiveOutboundLanes: &'static [bp_messages::LaneId] = &[rialto_messages::XCM_LANE];
|
||||
pub RialtoParachainActiveOutboundLanes: &'static [bp_messages::LaneId] = &[rialto_parachain_messages::XCM_LANE];
|
||||
}
|
||||
|
||||
/// Instance of the messages pallet used to relay messages to/from Rialto chain.
|
||||
@@ -477,7 +479,7 @@ pub type WithRialtoMessagesInstance = ();
|
||||
impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type ActiveOutboundLanes = RialtoActiveOutboundLanes;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
|
||||
@@ -506,7 +508,7 @@ pub type WithRialtoParachainMessagesInstance = pallet_bridge_messages::Instance1
|
||||
impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type ActiveOutboundLanes = RialtoParachainActiveOutboundLanes;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Everything required to serve Millau <-> Rialto messages.
|
||||
|
||||
use crate::{OriginCaller, RialtoGrandpaInstance, Runtime, RuntimeCall, RuntimeOrigin};
|
||||
use crate::{RialtoGrandpaInstance, Runtime, RuntimeCall, RuntimeOrigin};
|
||||
|
||||
use bp_messages::{
|
||||
source_chain::TargetHeaderChain,
|
||||
@@ -28,7 +28,7 @@ use bridge_runtime_common::messages::{self, MessageBridge};
|
||||
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
|
||||
|
||||
/// Default lane that is used to send messages to Rialto.
|
||||
pub const DEFAULT_XCM_LANE_TO_RIALTO: LaneId = [0, 0, 0, 0];
|
||||
pub const XCM_LANE: LaneId = [0, 0, 0, 0];
|
||||
/// Weight of 2 XCM instructions is for simple `Trap(42)` program, coming through bridge
|
||||
/// (it is prepended with `UniversalOrigin` instruction). It is used just for simplest manual
|
||||
/// tests, confirming that we don't break encoding somewhere between.
|
||||
@@ -98,24 +98,8 @@ impl messages::ThisChainWithMessages for Millau {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
fn is_message_accepted(send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool {
|
||||
let here_location =
|
||||
xcm::v3::MultiLocation::from(crate::xcm_config::UniversalLocation::get());
|
||||
match send_origin.caller {
|
||||
OriginCaller::XcmPallet(pallet_xcm::Origin::Xcm(ref location))
|
||||
if *location == here_location =>
|
||||
{
|
||||
log::trace!(target: "runtime::bridge", "Verifying message sent using XCM pallet to Rialto");
|
||||
},
|
||||
_ => {
|
||||
// keep in mind that in this case all messages are free (in term of fees)
|
||||
// => it's just to keep testing bridge on our test deployments until we'll have a
|
||||
// better option
|
||||
log::trace!(target: "runtime::bridge", "Verifying message sent using messages pallet to Rialto");
|
||||
},
|
||||
}
|
||||
|
||||
*lane == DEFAULT_XCM_LANE_TO_RIALTO || *lane == [0, 0, 0, 1]
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, _lane: &LaneId) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
|
||||
@@ -28,7 +28,7 @@ use bridge_runtime_common::messages::{self, MessageBridge};
|
||||
use frame_support::{parameter_types, weights::Weight, RuntimeDebug};
|
||||
|
||||
/// Default lane that is used to send messages to Rialto parachain.
|
||||
pub const DEFAULT_XCM_LANE_TO_RIALTO_PARACHAIN: LaneId = [0, 0, 0, 0];
|
||||
pub const XCM_LANE: LaneId = [0, 0, 0, 0];
|
||||
/// Weight of 2 XCM instructions is for simple `Trap(42)` program, coming through bridge
|
||||
/// (it is prepended with `UniversalOrigin` instruction). It is used just for simplest manual
|
||||
/// tests, confirming that we don't break encoding somewhere between.
|
||||
@@ -103,8 +103,8 @@ impl messages::ThisChainWithMessages for Millau {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool {
|
||||
*lane == DEFAULT_XCM_LANE_TO_RIALTO_PARACHAIN || *lane == [0, 0, 0, 1]
|
||||
fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, _lane: &LaneId) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
//! XCM configurations for the Millau runtime.
|
||||
|
||||
use super::{
|
||||
rialto_messages::{WithRialtoMessageBridge, DEFAULT_XCM_LANE_TO_RIALTO},
|
||||
rialto_parachain_messages::{
|
||||
WithRialtoParachainMessageBridge, DEFAULT_XCM_LANE_TO_RIALTO_PARACHAIN,
|
||||
},
|
||||
rialto_messages::{WithRialtoMessageBridge, XCM_LANE},
|
||||
rialto_parachain_messages::{WithRialtoParachainMessageBridge, XCM_LANE as XCM_LANE_PARACHAIN},
|
||||
AccountId, AllPalletsWithSystem, Balances, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
|
||||
WithRialtoMessagesInstance, WithRialtoParachainMessagesInstance, XcmPallet,
|
||||
};
|
||||
@@ -218,7 +216,7 @@ impl XcmBridge for ToRialtoBridge {
|
||||
}
|
||||
|
||||
fn xcm_lane() -> LaneId {
|
||||
DEFAULT_XCM_LANE_TO_RIALTO
|
||||
XCM_LANE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ impl XcmBridge for ToRialtoParachainBridge {
|
||||
}
|
||||
|
||||
fn xcm_lane() -> LaneId {
|
||||
DEFAULT_XCM_LANE_TO_RIALTO_PARACHAIN
|
||||
XCM_LANE_PARACHAIN
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user