Reject delivery transactions with at least one obsolete message (#2021)

* reject delivery transactions with at least one obsolete message

* clippy

* allow empty delivery transactions with rewards confirmations BUT only when there's no room left in the unrewarded relayers vector

* clippy

* allow empty delivery transactions if no message slots in unrewarded relayers vector
This commit is contained in:
Svyatoslav Nikolsky
2023-04-10 12:49:15 +03:00
committed by Bastian Köcher
parent 3b968a2aba
commit ceea1a10f7
4 changed files with 351 additions and 34 deletions
+5 -3
View File
@@ -33,7 +33,7 @@ use crate::messages::{
};
use bp_header_chain::{ChainWithGrandpa, HeaderChain};
use bp_messages::{target_chain::ForbidInboundMessages, LaneId};
use bp_messages::{target_chain::ForbidInboundMessages, LaneId, MessageNonce};
use bp_parachains::SingleParaStoredHeaderDataBuilder;
use bp_runtime::{Chain, ChainId, Parachain, UnderlyingChainProvider};
use codec::{Decode, Encode};
@@ -126,6 +126,8 @@ parameter_types! {
pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(3, 100_000);
pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128);
pub MaximumMultiplier: Multiplier = sp_runtime::traits::Bounded::max_value();
pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = 16;
pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = 32;
}
impl frame_system::Config for TestRuntime {
@@ -216,8 +218,8 @@ impl pallet_bridge_messages::Config for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<TestRuntime>;
type ActiveOutboundLanes = ActiveOutboundLanes;
type MaxUnrewardedRelayerEntriesAtInboundLane = ConstU64<16>;
type MaxUnconfirmedMessagesAtInboundLane = ConstU64<16>;
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
type MaximalOutboundPayloadSize = FromThisChainMaximalOutboundPayloadSize<OnThisChainBridge>;
type OutboundPayload = FromThisChainMessagePayload;