Fixes dust balance handling for pallet revive#9357
Merged
athei merged 2 commits intoparitytech:masterfrom Aug 4, 2025
Merged
Conversation
Corrects the condition for minting a new currency unit when transferring dust. The condition was incorrectly checking `to_info.dust.saturating_add(dust) >= plank` which could lead to unexpected minting behavior. It now correctly checks if `to_info.dust >= plank` before minting. Adds a test case to ensure the correct behavior when the receiver's dust balance is less than one plank.
athei
reviewed
Jul 31, 2025
Comment on lines
1451
to
+1453
| transfer_dust::<T>(&mut from_info, &mut to_info, dust)?; | ||
|
|
||
| if to_info.dust.saturating_add(dust) >= plank { | ||
| if to_info.dust >= plank { |
Member
There was a problem hiding this comment.
So the bug here is that we are adding it twice as it was already added in transfer_dust?
pgherveou
approved these changes
Jul 31, 2025
Member
|
/cmd fmt |
Contributor
|
Command "fmt" has failed ❌! See logs here |
Member
|
You don't allow changes by maintainers. Please run |
- add prdoc - run `cargo +nightly fmt`
Contributor
|
Review required! Latest push from author must always be reviewed |
Contributor
Author
@athei updated. |
athei
approved these changes
Aug 3, 2025
Member
athei
left a comment
There was a problem hiding this comment.
Thanks. Unfortunately, we need to approve after every change for external contributors. cc @pgherveou
smiasojed
approved these changes
Aug 4, 2025
Merged
via the queue into
paritytech:master
with commit Aug 4, 2025
59fb2e7
240 of 245 checks passed
athei
pushed a commit
that referenced
this pull request
Aug 14, 2025
fix issue: paritytech/contract-issues#141 Corrects the condition for minting a new currency unit when transferring dust. The condition was incorrectly checking `to_info.dust.saturating_add(dust) >= plank` which could lead to unexpected minting behavior. It now correctly checks if `to_info.dust >= plank` before minting.
Merged
athei
added a commit
that referenced
this pull request
Aug 15, 2025
- #9112 - #9101 - #9416 - #9357 - #9441 - #9267 Those are all the changes we want to get onto the next Kusama release. The new gas mapping and EVM backend will not make it. --------- Co-authored-by: PG Herveou <pgherveou@gmail.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: sekiseki <22696121+sekisamu@users.noreply.github.com> Co-authored-by: Michael Müller <mich@elmueller.net>
alvicsam
pushed a commit
that referenced
this pull request
Oct 17, 2025
fix issue: paritytech/contract-issues#141 Corrects the condition for minting a new currency unit when transferring dust. The condition was incorrectly checking `to_info.dust.saturating_add(dust) >= plank` which could lead to unexpected minting behavior. It now correctly checks if `to_info.dust >= plank` before minting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix issue: paritytech/contract-issues#141
Corrects the condition for minting a new currency unit when transferring dust. The condition was incorrectly checking
to_info.dust.saturating_add(dust) >= plankwhich could lead to unexpected minting behavior. It now correctly checks ifto_info.dust >= plankbefore minting.