diff --git a/bridges/bin/runtime-common/src/messages.rs b/bridges/bin/runtime-common/src/messages.rs index 97a460716c904a86ea8be31d26192f1a2a1e71d4..e6c7deb98a2cafecf36dc73531dc11380d21c8f4 100644 --- a/bridges/bin/runtime-common/src/messages.rs +++ b/bridges/bin/runtime-common/src/messages.rs @@ -216,7 +216,7 @@ pub mod source { // the message itself. The proof is always larger than the message. But unless chain state // is enormously large, it should be several dozens/hundreds of bytes. The delivery // transaction also contains signatures and signed extensions. Because of this, we reserve - // 1/3 of the the maximal extrinsic weight for this data. + // 1/3 of the the maximal extrinsic size for this data. if payload.len() > maximal_message_size::<B>() as usize { return Err(VerificationError::MessageTooLarge) } diff --git a/bridges/bin/runtime-common/src/messages_call_ext.rs b/bridges/bin/runtime-common/src/messages_call_ext.rs index 3f48ce583f9ced185ea5c2420d05ea124bfb5c43..8b4a50a0f30f44e9e73af76a3bf2596de7f171b3 100644 --- a/bridges/bin/runtime-common/src/messages_call_ext.rs +++ b/bridges/bin/runtime-common/src/messages_call_ext.rs @@ -47,7 +47,7 @@ pub struct BaseMessagesProofInfo { impl BaseMessagesProofInfo { /// Returns true if `bundled_range` continues the `0..=best_stored_nonce` range. fn appends_to_stored_nonce(&self) -> bool { - *self.bundled_range.start() == self.best_stored_nonce + 1 + Some(*self.bundled_range.start()) == self.best_stored_nonce.checked_add(1) } } diff --git a/bridges/modules/messages/src/inbound_lane.rs b/bridges/modules/messages/src/inbound_lane.rs index 2912c89cd1bee4fb485ab2027966ff51f664e6c5..b665b5516fc4d74fbd7f3e5a651f487be3c61e9b 100644 --- a/bridges/modules/messages/src/inbound_lane.rs +++ b/bridges/modules/messages/src/inbound_lane.rs @@ -171,8 +171,7 @@ impl<S: InboundLaneStorage> InboundLane<S> { message_data: DispatchMessageData<Dispatch::DispatchPayload>, ) -> ReceivalResult<Dispatch::DispatchLevelResult> { let mut data = self.storage.get_or_init_data(); - let is_correct_message = nonce == data.last_delivered_nonce() + 1; - if !is_correct_message { + if Some(nonce) != data.last_delivered_nonce().checked_add(1) { return ReceivalResult::InvalidNonce }