Add another condition to the reject-obsolete-parachain-heads extension (#1505)

* add another condition to the reject-obsolete-parachain-heads extension

* add tracing to obsolete-tx-extensions

* fix tests

* extension_rejects_header_from_new_relay_block_with_same_hash

* fmt

* fix benchmarks
This commit is contained in:
Svyatoslav Nikolsky
2022-07-14 15:18:15 +03:00
committed by Bastian Köcher
parent e9d7adf8fd
commit ea1f46ff45
13 changed files with 225 additions and 92 deletions
@@ -70,6 +70,14 @@ macro_rules! declare_bridge_reject_obsolete_messages {
let inbound_lane_data = pallet_bridge_messages::InboundLanes::<$runtime, $instance>::get(&proof.lane);
if proof.nonces_end <= inbound_lane_data.last_delivered_nonce() {
log::trace!(
target: pallet_bridge_messages::LOG_TARGET,
"Rejecting obsolete messages delivery transaction: lane {:?}, bundled {:?}, best {:?}",
proof.lane,
proof.nonces_end,
inbound_lane_data.last_delivered_nonce(),
);
return sp_runtime::transaction_validity::InvalidTransaction::Stale.into();
}
@@ -84,6 +92,14 @@ macro_rules! declare_bridge_reject_obsolete_messages {
let outbound_lane_data = pallet_bridge_messages::OutboundLanes::<$runtime, $instance>::get(&proof.lane);
if latest_delivered_nonce <= outbound_lane_data.latest_received_nonce {
log::trace!(
target: pallet_bridge_messages::LOG_TARGET,
"Rejecting obsolete messages confirmation transaction: lane {:?}, bundled {:?}, best {:?}",
proof.lane,
latest_delivered_nonce,
outbound_lane_data.latest_received_nonce,
);
return sp_runtime::transaction_validity::InvalidTransaction::Stale.into();
}