Skip to content

chore: refactor miden::protocol from ASSET to ASSET_KEY and ASSET_VALUE#2410

Open
PhilippGackstatter wants to merge 30 commits intopgackst-kernel-asset-key-valuefrom
pgackst-user-asset-key-value
Open

chore: refactor miden::protocol from ASSET to ASSET_KEY and ASSET_VALUE#2410
PhilippGackstatter wants to merge 30 commits intopgackst-kernel-asset-key-valuefrom
pgackst-user-asset-key-value

Conversation

@PhilippGackstatter
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter commented Feb 6, 2026

Changes miden::protocol asset APIs to take ASSET_KEY and ASSET_VALUE instead of just ASSET to adapt to the kernel changes from #2396.

This PR, like #2396, also keeps the key and value layout of assets unchanged and only deals with expanding assets from one to two words for simplicity.

Migration

  • SWAP note storage previously stored just REQUESTED_ASSET. Now it stores REQUESTED_ASSET_KEY and REQUESTED_ASSET_VALUE.
  • miden::standards::wallets::basic::move_asset_to_note no longer returns parameters (motivated by add_asset_to_note procedure results overhead when calling from Rust #1717).
  • Rename miden::protocol::asset::build_(non_)fungible_asset -> miden::protocol::asset::create_(non_)fungible_asset, for consistency with the miden::protocol::faucet procedures of the same name.
    • We generally use create_ and build_ interchangeably in APIs and it would be nice to be more consistent there.
  • The following procedures now take or return an asset vault key in addition to the asset value:
    • miden::protocol::faucet::create_fungible_asset
    • miden::protocol::faucet::create_non_fungible_asset
    • miden::protocol::faucet::mint
    • miden::protocol::faucet::burn
    • miden::protocol::asset::create_fungible_asset
    • miden::protocol::asset::create_non_fungible_asset
    • miden::protocol::native_account::add_asset
    • miden::protocol::native_account::remove_asset
    • miden::protocol::output_note::add_asset
    • miden::standards::wallets::basic::move_asset_to_note

Notable Changes

  • bridge_out.masm needed a bigger update:
    • keccak hashing includes asset key and value
    • burn note serial derivation takes asset key for now - maybe it should take the whole asset? But, this could also be changed separately.
  • Moves the asset vault key build procedures to shared utils for access in both miden::protocol. This logic will change when the layout changes, but some procedure to create a vault key will probably remain at least until generalized assets and maybe beyond.
  • Moves mock::util library to miden-standards to be able to provide exec-wrappers for basic::wallet::move_asset_to_note.
  • Unifies the asset preservation test in test_epilogue since one of the tests was testing the wrong condition and needed fixing anyway.

part of #2328

@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-user-asset-key-value branch from 599ba84 to 4143ebe Compare February 6, 2026 13:35
@PhilippGackstatter PhilippGackstatter marked this pull request as ready for review February 6, 2026 13:42
@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-user-asset-key-value branch from 4143ebe to d94dc4e Compare February 6, 2026 15:30
@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-user-asset-key-value branch from d94dc4e to b1af2ca Compare February 6, 2026 15:36
@mmagician mmagician added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Feb 9, 2026
@PhilippGackstatter PhilippGackstatter requested review from Fumuran and igamigo and removed request for bobbinth February 9, 2026 18:27
Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

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

Not a full review yet but leaving some comments, overall looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants