Skip to content

Commit

Permalink
Small fixes (paritytech#2126)
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 authored May 10, 2023
1 parent d17acab commit b1c1c9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/runtime-common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
3 changes: 1 addition & 2 deletions modules/messages/src/inbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b1c1c9b

Please sign in to comment.