Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e5fda21
feat: include total supply logic in faucet logic
PhilippGackstatter Jan 20, 2026
49ab08e
chore: replace get_fungible_asset_max_amount with constant
PhilippGackstatter Jan 21, 2026
31f0ef2
chore: Add `token_supply` to `BasicFungibleFaucet`
PhilippGackstatter Jan 21, 2026
53862fd
chore: remove total_issuance update from `faucet::burn`
PhilippGackstatter Jan 23, 2026
5895be9
feat: implement token_supply update in basic fungible faucet `burn`
PhilippGackstatter Jan 23, 2026
4b2f446
fix: faucet tests
PhilippGackstatter Jan 23, 2026
5e6b3b5
chore: remove total_issuance update from `faucet::mint_fungible_asset`
PhilippGackstatter Jan 23, 2026
fc0a218
chore: update network fungible faucet and deduplicate code
PhilippGackstatter Jan 23, 2026
9c8bba8
chore: remove issuance tracking logic for non-fungible assets
PhilippGackstatter Jan 23, 2026
cb7a417
chore: remove sysdata checks in prologue
PhilippGackstatter Jan 23, 2026
c56831a
chore: remove sysdata access procedures in miden::protocol
PhilippGackstatter Jan 23, 2026
72a9f62
chore: replace usages of `FungibleFaucetExt`
PhilippGackstatter Jan 23, 2026
1b6e5a3
chore: Remove `AccountStorage::faucet_sysdata_slot`
PhilippGackstatter Jan 23, 2026
9cad4f1
chore: remove invalid faucet sysdata slot tests
PhilippGackstatter Jan 23, 2026
46e6edd
chore: remove sysdata accessor procedure tests
PhilippGackstatter Jan 23, 2026
dec26de
fix: agglayer and faucet tests
PhilippGackstatter Jan 23, 2026
bf4f083
chore: assert origin in burn_non_fungible_asset
PhilippGackstatter Jan 23, 2026
84aa312
chore: remove initial_balance from mock_fungible_faucet
PhilippGackstatter Jan 23, 2026
ec7b5a6
fix: agglayer faucet metadata word layout
PhilippGackstatter Jan 23, 2026
53fb12d
chore: update `create_basic_fungible_faucet` docs
PhilippGackstatter Jan 23, 2026
ff98629
chore: remove reserved slot check from `account::set_item`
PhilippGackstatter Jan 23, 2026
9eae8dd
chore: remove `get_total_issuance` and `is_non_fungible_asset_issued`
PhilippGackstatter Jan 23, 2026
4aec417
chore: remove `FAUCET_SYSDATA_SLOT` from account.masm
PhilippGackstatter Jan 23, 2026
d62272a
chore: remove `AccountType` param from `AccountStorage::from_components`
PhilippGackstatter Jan 23, 2026
91ed808
chore: update mentiones of "reserved slot"
PhilippGackstatter Jan 23, 2026
195c2d8
chore: add test checking ERR_FAUCET_BURN_AMOUNT_EXCEEDS_TOKEN_SUPPLY
PhilippGackstatter Jan 23, 2026
2238513
chore: update faucets::distribute docs
PhilippGackstatter Jan 23, 2026
76952b5
fix: remove impossible error condition
PhilippGackstatter Jan 23, 2026
2236400
chore: update burn note root
PhilippGackstatter Jan 23, 2026
74d89e7
chore: add changelog
PhilippGackstatter Jan 23, 2026
671430e
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Jan 26, 2026
9515b25
fix: p2id script root
PhilippGackstatter Jan 26, 2026
0ee09f5
Apply suggestions from code review
PhilippGackstatter Jan 26, 2026
7848c44
chore: simplify faucets::burn
PhilippGackstatter Jan 26, 2026
a0c3689
chore: better describe assertions
PhilippGackstatter Jan 26, 2026
d3408e3
chore: improve max/token supply docs on fungible faucets
PhilippGackstatter Jan 26, 2026
21ff9c4
fix: update BURN_NOTE_ROOT
PhilippGackstatter Jan 26, 2026
8ac9fcb
Merge branch 'next' into pgackst-remove-sysdata-protocol-slot
bobbinth Jan 27, 2026
9907688
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Jan 27, 2026
683002e
Merge branch 'next' into pgackst-remove-sysdata-protocol-slot
bobbinth Jan 27, 2026
877f39c
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Jan 29, 2026
8db97a0
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Jan 30, 2026
44e5f19
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Jan 30, 2026
fc2a1a2
Update crates/miden-agglayer/src/lib.rs
PhilippGackstatter Jan 30, 2026
11cc2f0
Merge remote-tracking branch 'origin/next' into pgackst-remove-sysdat…
PhilippGackstatter Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
- [BREAKING] Refactored `TransactionAuthenticator::get_public_key()` method to return `Arc<PublicKey> `instead of `&PublicKey` ([#2304](https://github.com/0xMiden/miden-base/pull/2304)).
- [BREAKING] Renamed `NoteInputs` to `NoteStorage` to better reflect that values are stored data associated with a note rather than inputs ([#1662](https://github.com/0xMiden/miden-base/issues/1662), [#2316](https://github.com/0xMiden/miden-base/issues/2316)).
- Removed `NoteType::Encrypted` ([#2315](https://github.com/0xMiden/miden-base/pull/2315)).
- Remove protocol-reserved faucet sysdata storage slot ([#2335](https://github.com/0xMiden/miden-base/pull/2335)).
- Updated note tag length to support up to 32 bits ([#2329](https://github.com/0xMiden/miden-base/pull/2329)).
- [BREAKING] Changed note scripts to be compiled as libraries with `@note_script` annotation for marking the entrypoint procedure ([#2339](https://github.com/0xMiden/miden-base/issues/2339)).
- [BREAKING] Updated note tag length to support up to 32 bits ([#2329](https://github.com/0xMiden/miden-base/pull/2329)).
- [BREAKING] Moved standard note code into individual note modules ([#2363](https://github.com/0xMiden/miden-base/pull/2363)).
Expand Down
4 changes: 2 additions & 2 deletions crates/miden-agglayer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ pub fn create_agglayer_faucet_component(
max_supply: Felt,
bridge_account_id: AccountId,
) -> AccountComponent {
// Create network faucet metadata slot: [max_supply, decimals, token_symbol, 0]
// Create network faucet metadata slot: [0, max_supply, decimals, token_symbol]
let token_symbol = TokenSymbol::new(token_symbol).expect("Token symbol should be valid");
let metadata_word =
Word::new([max_supply, Felt::from(decimals), token_symbol.into(), FieldElement::ZERO]);
Word::new([FieldElement::ZERO, max_supply, Felt::from(decimals), token_symbol.into()]);
let metadata_slot =
StorageSlot::with_value(NetworkFungibleFaucet::metadata_slot().clone(), metadata_word);

Expand Down
76 changes: 0 additions & 76 deletions crates/miden-protocol/asm/kernels/transaction/api.masm
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ use $kernel::tx
# ERRORS
# =================================================================================================

const ERR_FAUCET_STORAGE_DATA_SLOT_IS_RESERVED="for faucets the FAUCET_STORAGE_DATA_SLOT storage slot is reserved and can not be used with set_account_item"

const ERR_FAUCET_TOTAL_ISSUANCE_PROC_CAN_ONLY_BE_CALLED_ON_FUNGIBLE_FAUCET="the faucet_get_total_fungible_asset_issuance procedure can only be called on a fungible faucet"

const ERR_FAUCET_IS_NF_ASSET_ISSUED_PROC_CAN_ONLY_BE_CALLED_ON_NON_FUNGIBLE_FAUCET="the faucet_is_non_fungible_asset_issued procedure can only be called on a non-fungible faucet"

const ERR_KERNEL_PROCEDURE_OFFSET_OUT_OF_BOUNDS="provided kernel procedure offset is out of bounds"

const ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_ASSETS_WHILE_NO_NOTE_BEING_PROCESSED="failed to access note assets of active note because no note is currently being processed"
Expand Down Expand Up @@ -366,25 +360,13 @@ end
#! Panics if:
#! - a slot with the provided slot ID does not exist in account storage.
#! - the invocation of this procedure does not originate from the native account.
#! - the native account is a faucet and the provided slot ID points to the reserved faucet storage slot.
#!
#! Invocation: dynexec
pub proc account_set_item
# check that this procedure was executed against the native account
exec.memory::assert_native_account
# => [slot_id_prefix, slot_id_suffix, VALUE, pad(10)]

# if the transaction is being executed against a faucet account then assert
# the slot that is being written to is not the reserved faucet slot.
dup.1 dup.1 exec.account::is_faucet_storage_data_slot
# => [is_faucet_storage_data_slot, slot_id_prefix, slot_id_suffix, VALUE, pad(10)]

exec.account::get_id swap drop exec.account_id::is_faucet
# => [is_faucet_account, is_faucet_storage_data_slot, slot_id_prefix, slot_id_suffix, VALUE, pad(10)]

and assertz.err=ERR_FAUCET_STORAGE_DATA_SLOT_IS_RESERVED
# => [slot_id_prefix, slot_id_suffix, VALUE, pad(10)]

# authenticate that the procedure invocation originates from the account context
exec.authenticate_account_origin
# => [slot_id_prefix, slot_id_suffix, VALUE, pad(10)]
Expand Down Expand Up @@ -831,64 +813,6 @@ pub proc faucet_burn_asset
# => [ASSET, pad(12)]
end

#! Returns the total issuance of the fungible faucet the transaction is being executed against.
#!
#! Inputs: [pad(16)]
#! Outputs: [total_issuance, pad(15)]
#!
#! Where:
#! - total_issuance is the total issuance of the fungible faucet the transaction is being executed
#! against.
#!
#! Panics if:
#! - the transaction is not being executed against a fungible faucet.
#!
#! Invocation: dynexec
pub proc faucet_get_total_fungible_asset_issuance
# assert that we are executing a transaction against a fungible faucet (access checks)
exec.account::get_id swap drop exec.account_id::is_fungible_faucet
assert.err=ERR_FAUCET_TOTAL_ISSUANCE_PROC_CAN_ONLY_BE_CALLED_ON_FUNGIBLE_FAUCET
# => [pad(16)]

# get the total issuance
exec.faucet::get_total_issuance
# => [total_issuance, pad(16)]

# truncate the stack
swap drop
# => [total_issuance, pad(15)]
end

#! Returns a boolean indicating whether the provided non-fungible asset has been already issued by
#! this faucet.
#!
#! Inputs: [ASSET, pad(12)]
#! Outputs: [is_issued, pad(15)]
#!
#! Where:
#! - ASSET is the non-fungible asset that is being checked.
#! - is_issued is a boolean indicating whether the non-fungible asset has been issued.
#!
#! Panics if:
#! - the ASSET is a fungible asset.
#! - the ASSET is not associated with the faucet the transaction is being executed against.
#!
#! Invocation: dynexec
pub proc faucet_is_non_fungible_asset_issued
# assert that we are executing a transaction against a non-fungible faucet (access checks)
exec.account::get_id swap drop exec.account_id::is_non_fungible_faucet
assert.err=ERR_FAUCET_IS_NF_ASSET_ISSUED_PROC_CAN_ONLY_BE_CALLED_ON_NON_FUNGIBLE_FAUCET
# => [ASSET, pad(12)]

# get the issuance flag
exec.faucet::is_non_fungible_asset_issued
# => [is_issued, pad(16)]

# truncate the stack
swap drop
# => [is_issued, pad(15)]
end

# INPUT NOTE
# -------------------------------------------------------------------------------------------------

Expand Down
44 changes: 0 additions & 44 deletions crates/miden-protocol/asm/kernels/transaction/lib/account.masm
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ const ERR_ACCOUNT_READING_MAP_VALUE_FROM_NON_MAP_SLOT="failed to read an account
# CONSTANTS
# =================================================================================================

# The name of the account storage slot at which faucet data is stored.
# Fungible faucet: The faucet data consists of [0, 0, 0, total_issuance]
# Non-fungible faucet: The faucet data consists of SMT root containing minted non-fungible assets.
const FAUCET_SYSDATA_SLOT=word("miden::protocol::faucet::sysdata")

# The maximum storage slot index
const MAX_STORAGE_SLOT_INDEX=254

Expand Down Expand Up @@ -182,20 +177,6 @@ const ACCOUNT_PUSH_PROCEDURE_INDEX_EVENT=event("miden::protocol::account::push_p
# CONSTANT ACCESSORS
# =================================================================================================

#! Returns the account storage slot at which faucet data is stored.
#! Fungible faucet: The faucet data consists of [0, 0, 0, total_issuance]
#! Non-fungible faucet: The faucet data consists of SMT root containing minted non-fungible assets.
#!
#! Inputs: []
#! Outputs: [faucet_slot_id_prefix, faucet_slot_id_suffix]
#!
#! Where:
#! - faucet_slot_id{prefix,suffix} are the prefix and suffix felts of the slot identifier, at which
#! faucet data is stored.
pub proc get_faucet_sysdata_slot_id
push.FAUCET_SYSDATA_SLOT[0..2]
end

#! Returns the maximum number of account storage slots.
#!
#! Inputs: []
Expand Down Expand Up @@ -1427,31 +1408,6 @@ end
# HELPER PROCEDURES
# =================================================================================================

#! Returns 1 if the provided slot ID is equal to the reserved faucet storage data slot, 0
#! otherwise.
#!
#! Inputs: [slot_id_prefix, slot_id_suffix]
#! Outputs: [is_faucet_storage_data_slot]
#!
#! Where:
#! - slot_id_{prefix, suffix} are the prefix and suffix felts of the slot identifier, which are
#! the first two felts of the hashed slot name.
#! - is_faucet_storage_data_slot is a boolean value indicating whether the provided slot is the
#! reserved faucet data slot.
pub proc is_faucet_storage_data_slot
exec.get_faucet_sysdata_slot_id
# => [faucet_slot_id_prefix, faucet_slot_id_suffix, slot_id_prefix, slot_id_suffix]

movup.2 eq
# => [prefix_eq, faucet_slot_id_suffix, slot_id_suffix]

movdn.2 eq
# => [prefix_eq, suffix_eq]

and
# => [is_faucet_storage_data_slot]
end

#! Gets the initial and current value of an item from the storage slot at the provided index for
#! the native account.
#!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use $kernel::asset_vault
use $kernel::constants::STORAGE_SLOT_TYPE_VALUE
use $kernel::link_map
use $kernel::memory
use $kernel::util::asset::FUNGIBLE_ASSET_MAX_AMOUNT
use miden::core::crypto::hashes::rpo256
use miden::core::word

Expand Down Expand Up @@ -784,9 +785,9 @@ end
#
# Don't we have to check for overflows? No, because we're building on top of the guarantees of the
# asset vault. It guarantees that the max value that can be added to the vault within a transaction
# is asset::get_fungible_asset_max_amount and that the max value that can be removed is also that.
# is asset::FUNGIBLE_ASSET_MAX_AMOUNT and that the max value that can be removed is also that.
# Since the delta amount range can represent positive and negative
# asset::get_fungible_asset_max_amount, this works out.
# asset::FUNGIBLE_ASSET_MAX_AMOUNT, this works out.
#
# With these ranges every positive value has a negative counterpart and vice versa. This is
# **unlike** two's complements because the goldilocks modulus is odd while the "modulus" in
Expand Down Expand Up @@ -835,6 +836,6 @@ end
#! - is_delta_amount_negative indicates whether the delta amount represents a negative value.
proc is_delta_amount_negative
# delta_amount represents a negative number if it is greater than the max amount
exec.asset::get_fungible_asset_max_amount gt
gt.FUNGIBLE_ASSET_MAX_AMOUNT
# => [is_delta_amount_negative]
end
11 changes: 2 additions & 9 deletions crates/miden-protocol/asm/kernels/transaction/lib/asset.masm
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ const ERR_NON_FUNGIBLE_ASSET_FAUCET_IS_NOT_ORIGIN="the origin of the non-fungibl
# CONSTANT ACCESSORS
# =================================================================================================

#! Returns the maximum amount of a fungible asset.
#!
#! Inputs: []
#! Outputs: [fungible_asset_max_amount]
#!
#! Where:
#! - fungible_asset_max_amount is the maximum amount of a fungible asset.
pub use ::$kernel::util::asset::get_fungible_asset_max_amount
pub use ::$kernel::util::asset::FUNGIBLE_ASSET_MAX_AMOUNT

# PROCEDURES
# =================================================================================================
Expand Down Expand Up @@ -57,7 +50,7 @@ pub proc validate_fungible_asset
# => [ASSET]

# assert that the max amount (ASSET[0]) of a fungible asset is not exceeded
dup.3 exec.::$kernel::util::asset::get_fungible_asset_max_amount lte
dup.3 lte.FUNGIBLE_ASSET_MAX_AMOUNT
assert.err=ERR_FUNGIBLE_ASSET_FORMAT_ELEMENT_ZERO_MUST_BE_WITHIN_LIMITS
# => [ASSET]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use miden::core::word
use $kernel::account_id
use $kernel::asset
use $kernel::memory
use $kernel::util::asset::FUNGIBLE_ASSET_MAX_AMOUNT

# ERRORS
# =================================================================================================
Expand Down Expand Up @@ -223,7 +224,7 @@ pub proc add_fungible_asset
# => [amount, amount, cur_amount, faucet_id_prefix, faucet_id_suffix, 0, VAULT_ROOT, CUR_VAULT_VALUE, vault_root_ptr]

# compute max_amount - cur_amount
exec.asset::get_fungible_asset_max_amount dup.3 sub
push.FUNGIBLE_ASSET_MAX_AMOUNT dup.3 sub
# => [(max_amount - cur_amount), amount, amount, cur_amount, faucet_id_prefix, faucet_id_suffix, 0, VAULT_ROOT,
# CUR_VAULT_VALUE, vault_root_ptr]

Expand Down
Loading