Skip to content

feat: Replace get_balance and has_non_fungible_asset with get_asset#2369

Merged
PhilippGackstatter merged 63 commits intonextfrom
pgackst-asset-kernel-procedures
Feb 3, 2026
Merged

feat: Replace get_balance and has_non_fungible_asset with get_asset#2369
PhilippGackstatter merged 63 commits intonextfrom
pgackst-asset-kernel-procedures

Conversation

@PhilippGackstatter
Copy link
Copy Markdown
Contributor

@PhilippGackstatter PhilippGackstatter commented Jan 29, 2026

In preparation for expanding assets from one to two words, this PR:

  • Removes get_balance, get_initial_balance and has_non_fungible_asset kernel procedures.
  • Adds get_asset and get_initial_asset kernel procedures.
  • Generalizes asset_vault::peek_balance into asset_vault::peek_asset.

Note that the corresponding procedures in miden::protocol::active_account are retained until it becomes clear how built in fungible assetes should be handled. So, the user-facing behavior is preserved. These now build on top of the more general get_(initial_)asset procedures.

This PR simplifies the kernel-internal restructuring of assets from one to two words, and since we'll need a general get_asset anyway, this makes sense to do first.

part of #2328

Copy link
Copy Markdown
Collaborator

@mmagician mmagician 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!

Base automatically changed from pgackst-remove-sysdata-protocol-slot to next February 2, 2026 08:36
Copy link
Copy Markdown
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!

@PhilippGackstatter PhilippGackstatter merged commit b4ff18e into next Feb 3, 2026
17 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-asset-kernel-procedures branch February 3, 2026 08:01
Farukest added a commit to Farukest/miden-base that referenced this pull request Feb 4, 2026
Resolve merge conflicts with recent changes:
- 0xMiden#2369: Updated offset numbers for new get_asset API
- 0xMiden#2377: Keep pub const prefix for all offset constants
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Mar 9, 2026
…set` (0xMiden#2369)

* feat: include total supply logic in faucet logic

* chore: replace get_fungible_asset_max_amount with constant

* chore: Add `token_supply` to `BasicFungibleFaucet`

* chore: remove total_issuance update from `faucet::burn`

* feat: implement token_supply update in basic fungible faucet `burn`

* fix: faucet tests

* chore: remove total_issuance update from `faucet::mint_fungible_asset`

* chore: update network fungible faucet and deduplicate code

* chore: remove issuance tracking logic for non-fungible assets

* chore: remove sysdata checks in prologue

* chore: remove sysdata access procedures in miden::protocol

* chore: replace usages of `FungibleFaucetExt`

* chore: Remove `AccountStorage::faucet_sysdata_slot`

* chore: remove invalid faucet sysdata slot tests

* chore: remove sysdata accessor procedure tests

* fix: agglayer and faucet tests

* chore: assert origin in burn_non_fungible_asset

* chore: remove initial_balance from mock_fungible_faucet

* fix: agglayer faucet metadata word layout

* chore: update `create_basic_fungible_faucet` docs

* chore: remove reserved slot check from `account::set_item`

* chore: remove `get_total_issuance` and `is_non_fungible_asset_issued`

* chore: remove `FAUCET_SYSDATA_SLOT` from account.masm

* chore: remove `AccountType` param from `AccountStorage::from_components`

* chore: update mentiones of "reserved slot"

* chore: add test checking ERR_FAUCET_BURN_AMOUNT_EXCEEDS_TOKEN_SUPPLY

* chore: update faucets::distribute docs

* fix: remove impossible error condition

* chore: update burn note root

* chore: add changelog

* fix: p2id script root

* Apply suggestions from code review

Co-authored-by: Marti <marti@miden.team>

* chore: simplify faucets::burn

* chore: better describe assertions

* chore: improve max/token supply docs on fungible faucets

* fix: update BURN_NOTE_ROOT

* chore: allow public constants in kernel proc offsets

* feat: Replace get_balance kernel proc with get_asset

* chore: rename event before_get_balance to before_get_asset

* feat: refactor get_asset to take an ASSET_KEY

* feat: remove account::has_non_fungible_asset

* chore: update P2ID and BURN note roots

* chore: test get_asset and get_initial_asset

* chore: add changelog

* feat: refactor `peek_balance` into `peek_asset`

* chore: make docs consistent

* Update crates/miden-agglayer/src/lib.rs

Co-authored-by: Marti <marti@miden.team>

* chore: add docs for when peeking is useful

* Apply suggestions from code review

Co-authored-by: Marti <marti@miden.team>

---------

Co-authored-by: Marti <marti@miden.team>
Co-authored-by: Bobbin Threadbare <43513081+bobbinth@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants