Skip to content

Commit 3f5edc5

Browse files
Use safe math when pruning statuses (#1835)
Co-authored-by: Francisco Aguirre <[email protected]>
1 parent 55f3544 commit 3f5edc5

File tree

1 file changed

+1
-1
lines changed
  • cumulus/pallets/xcmp-queue/src

1 file changed

+1
-1
lines changed

cumulus/pallets/xcmp-queue/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
11291129
let pruned = old_statuses_len - statuses.len();
11301130
// removing an item from status implies a message being sent, so the result messages must
11311131
// be no less than the pruned channels.
1132-
statuses.rotate_left(result.len() - pruned);
1132+
statuses.rotate_left(result.len().saturating_sub(pruned));
11331133

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

0 commit comments

Comments
 (0)