Skip to content

fix: faucets::distribute not adding original amount to note#2522

Merged
bobbinth merged 2 commits intonextfrom
pgackst-fix-faucets-distribute
Feb 27, 2026
Merged

fix: faucets::distribute not adding original amount to note#2522
bobbinth merged 2 commits intonextfrom
pgackst-fix-faucets-distribute

Conversation

@PhilippGackstatter
Copy link
Contributor

Fixes faucets::distribute not 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::mint will 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

@PhilippGackstatter PhilippGackstatter added no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Feb 27, 2026
Copy link
Collaborator

@juan518munoz juan518munoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@bobbinth bobbinth merged commit 3154a37 into next Feb 27, 2026
19 checks passed
@bobbinth bobbinth deleted the pgackst-fix-faucets-distribute branch February 27, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: faucet::mint procedure returning incorrect output for multiple note minting

3 participants