Skip to content

Commit

Permalink
Fix multiplication overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rakanalh committed Dec 18, 2023
1 parent 89c23a4 commit 82fbf34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion runtime/cere-dev/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod multiplier_tests {
fn multiplier_can_grow_from_zero() {
// if the min is too small, then this will not change, and we are doomed forever.
// the weight is 1/100th bigger than target.
run_with_system_weight(target() * 101 / 100, || {
run_with_system_weight(target().saturating_mul(101) / 100, || {
let next = runtime_multiplier_update(min_multiplier());
assert!(next > min_multiplier(), "{:?} !>= {:?}", next, min_multiplier());
})
Expand Down
2 changes: 1 addition & 1 deletion runtime/cere/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod multiplier_tests {
fn multiplier_can_grow_from_zero() {
// if the min is too small, then this will not change, and we are doomed forever.
// the weight is 1/100th bigger than target.
run_with_system_weight(target() * 101 / 100, || {
run_with_system_weight(target().saturating_mul(101) / 100, || {
let next = runtime_multiplier_update(min_multiplier());
assert!(next > min_multiplier(), "{:?} !>= {:?}", next, min_multiplier());
})
Expand Down

0 comments on commit 82fbf34

Please sign in to comment.