Skip to content

Commit 19d6273

Browse files
paritytech-release-backport-bot[bot]Ank4nbkchr
authored
[unstable2507] Backport #9186 (#9299)
Backport #9186 into `unstable2507` from Ank4n. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Ankan <[email protected]> Co-authored-by: Bastian Köcher <[email protected]>
1 parent cbfcf24 commit 19d6273

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

prdoc/pr_9186.prdoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
title: 'pallet-staking-async: Use saturating addition for era reward points'
2+
doc:
3+
- audience: Runtime Dev
4+
description: |-
5+
This PR replaces regular addition with saturating addition when accumulating era reward points in
6+
pallet-staking-async to prevent potential overflow.
7+
crates:
8+
- name: pallet-staking-async
9+
bump: patch

substrate/frame/staking-async/src/session_rotation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl<T: Config> Eras<T> {
364364
era_rewards.individual.try_insert(validator, points).defensive();
365365
},
366366
}
367-
era_rewards.total += points;
367+
era_rewards.total.saturating_accrue(points);
368368
}
369369
});
370370
}

0 commit comments

Comments
 (0)