Skip to content

Commit

Permalink
fix: 🩹 Use checked_add instead of saturating_add
Browse files Browse the repository at this point in the history
  • Loading branch information
ffarall committed Dec 26, 2024
1 parent aa89328 commit 7364a27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pallets/file-system/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,10 +1274,11 @@ where
match <T::PaymentStreams as PaymentStreamsInterface>::get_dynamic_rate_payment_stream_amount_provided(&bsp_id, &storage_request_metadata.owner) {
Some(previous_amount_provided) => {
// Update the payment stream.
let new_amount_provided = &previous_amount_provided.checked_add(storage_request_metadata.size).ok_or(ArithmeticError::Overflow)?;

Check failure on line 1277 in pallets/file-system/src/utils.rs

View workflow job for this annotation

GitHub Actions / Check lint with clippy

mismatched types

Check failure on line 1277 in pallets/file-system/src/utils.rs

View workflow job for this annotation

GitHub Actions / Build node image

mismatched types

Check failure on line 1277 in pallets/file-system/src/utils.rs

View workflow job for this annotation

GitHub Actions / Prepare artifacts

mismatched types
<T::PaymentStreams as PaymentStreamsInterface>::update_dynamic_rate_payment_stream(
&bsp_id,
&storage_request_metadata.owner,
&(previous_amount_provided.saturating_add(storage_request_metadata.size)),
new_amount_provided,
)?;
},
None => {
Expand Down

0 comments on commit 7364a27

Please sign in to comment.