fix: faucets::distribute not adding original amount to note#2522
Merged
fix: faucets::distribute not adding original amount to note#2522
faucets::distribute not adding original amount to note#2522Conversation
juan518munoz
approved these changes
Feb 27, 2026
Collaborator
juan518munoz
left a comment
There was a problem hiding this comment.
LGTM, Thanks!
Haven't looked at #2437, but if it too touches this part of the codebase, be sure to backport it. Nonetheless if the error remains it will be triggered by the added test.
Comment on lines
+128
to
139
| exec.faucet::create_fungible_asset dupw | ||
| # => [ASSET, ASSET, tag, note_type, RECIPIENT] | ||
|
|
||
| # mint the asset; this is needed to satisfy asset preservation logic. | ||
| # this ensures that the asset's faucet ID matches the native account's ID. | ||
| # this is ensured because create_fungible_asset creates the asset with the native account's ID | ||
| exec.faucet::mint | ||
| # => [ASSET', ASSET, tag, note_type, RECIPIENT] | ||
|
|
||
| # drop the asset that represents the total amount in the vault after minting | ||
| dropw | ||
| # => [ASSET, tag, note_type, RECIPIENT] |
Collaborator
There was a problem hiding this comment.
Excelent! My initial idea was to use memory (loc_store_be) instead of the stack thinking that pushing the ASSET there would leave it full for the faucet::mint, but if i'm not mistaken this is only an issue when the procedure is done through call (due to 16 elements restraint), but we are using exec here.
(this is a doubt rather than a suggestion)
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.
Fixes
faucets::distributenot adding the original amount passed to it to the note but rather the total amount of the asset in the vault, resulting in an asset preservation violation.See #2519 for a more detailed description.
As mentioned there, the docs of
faucet::mintwill be updated in a separate PR to avoid merge conflicts.Not adding a changelog since the bug was introduced in #2335 which is not part of a released version.
closes #2519