Skip to content

Commit

Permalink
Use safe math when pruning statuses (#1835)
Browse files Browse the repository at this point in the history
Co-authored-by: Francisco Aguirre <[email protected]>
  • Loading branch information
KiChjang and franciscoaguirre committed Oct 10, 2023
1 parent 55f3544 commit 3f5edc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cumulus/pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
let pruned = old_statuses_len - statuses.len();
// removing an item from status implies a message being sent, so the result messages must
// be no less than the pruned channels.
statuses.rotate_left(result.len() - pruned);
statuses.rotate_left(result.len().saturating_sub(pruned));

<OutboundXcmpStatus<T>>::put(statuses);

Expand Down

0 comments on commit 3f5edc5

Please sign in to comment.