Skip to content

[stable2409] Backport #7365#7381

Merged
EgorPopelyaev merged 1 commit intostable2409from
backport-7365-to-stable2409
Feb 5, 2025
Merged

[stable2409] Backport #7365#7381
EgorPopelyaev merged 1 commit intostable2409from
backport-7365-to-stable2409

Conversation

@paritytech-cmd-bot-polkadot-sdk
Copy link
Copy Markdown
Contributor

Backport #7365 into stable2409 from vgantchev.

See the documentation on how to use this bot.

This PR modifies `named_reserve()` in frame-balances to use checked math
instead of defensive saturating math.

The use of saturating math relies on the assumption that the sum of the
values will always fit in `u128::MAX`. However, there is nothing
preventing the implementing pallet from passing a larger value which
overflows. This can happen if the implementing pallet does not validate
user input and instead relies on `named_reserve()` to return an error
(this saves an additional read)

This is not a security concern, as the method will subsequently return
an error thanks to `<Self as ReservableCurrency<_>>::reserve(who,
value)?;`. However, the `defensive_saturating_add` will panic in
`--all-features`, creating false positive crashes in fuzzing operations.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit f373af0)
@paritytech-cmd-bot-polkadot-sdk paritytech-cmd-bot-polkadot-sdk bot requested a review from a team as a code owner January 29, 2025 09:45
@github-actions github-actions bot added the A3-backport Pull request is already reviewed well in another branch. label Jan 29, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:

  • Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
  • Should be a legit fix for some bug, not adding tons of new features.
  • Must either be already audited or not need an audit.
Emergency Bypass

If you really need to bypass this check: add validate: false to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.

@EgorPopelyaev EgorPopelyaev merged commit 200d0bd into stable2409 Feb 5, 2025
50 of 69 checks passed
@EgorPopelyaev EgorPopelyaev deleted the backport-7365-to-stable2409 branch February 5, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A3-backport Pull request is already reviewed well in another branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants