feat: change native_account::remove_asset to return the remaining asset#2626
Open
PhilippGackstatter wants to merge 6 commits intonextfrom
Open
feat: change native_account::remove_asset to return the remaining asset#2626PhilippGackstatter wants to merge 6 commits intonextfrom
native_account::remove_asset to return the remaining asset#2626PhilippGackstatter wants to merge 6 commits intonextfrom
Conversation
002ee72 to
589b1aa
Compare
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.
Changes
Refactors
native_account::remove_assetto return the asset value remaining in the vault after the operation in order to make the return value more useful.asset_vault::remove_assetAPI was changed to return the remaining value.faucet::burnalso made use of that API, it had to be updated as well. The strategy there is to remove the return value since it is not meaningful (described in Avoid returning outputs identical to inputs in kernel procedures #2523).AssetVault::remove_assetwas changed to return not the removed asset but the remaining asset, represented asOption<Asset>, where:Noneis returned for non-fungible assets since nothing remains in the vaultFungibleAssetat this point in time, but this will likely becomeAssetin the future anyway.[amount = 0, 0, faucet_id_suffix, faucet_id_prefix]and if so, insert an empty word to avoid storing zero amounts to keep the merkle tree sparse. Since the asset refactor, this is no longer necessary and so this optimization was removed.Migration
miden::protocol::native_account::remove_assetreturns the asset value remaining in the vault instead of the removed valueAssetVault::remove_assetreturns the asset value remaining in the vaultOption<Asset>rather than the removed valueAsset.miden::protocol::faucet::burnno longer returns the burnt asset value.closes #2524