Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
- Added `StorageSchema::commitment()` ([#2244](https://github.com/0xMiden/miden-base/pull/2244)).
- [BREAKING] `RpoFalcon512` was renamed to `Falcon512Rpo` everywhere, including procedure and file names ([#2264](https://github.com/0xMiden/miden-base/pull/2264)).
- [BREAKING] Removed top-level error exports from `miden-protocol` crate (the are still accessible under `miden_protocol::errors`).
- Documented native account requirement for `get_storage_slot_type` and `set_item` procedures ([#XXXX](https://github.com/0xMiden/miden-base/pull/XXXX)).

## 0.12.4 (2025-11-26)

Expand Down
16 changes: 11 additions & 5 deletions crates/miden-protocol/asm/kernels/transaction/lib/account.masm
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ end

#! Sets an item in the account storage.
#!
#! WARNING: This procedure works only for native accounts.
#!
#! Inputs: [slot_id_prefix, slot_id_suffix, VALUE]
#! Outputs: [OLD_VALUE]
#!
Expand All @@ -504,7 +506,7 @@ pub proc set_item
emit.ACCOUNT_STORAGE_BEFORE_SET_ITEM_EVENT
# => [slot_id_prefix, slot_id_suffix, VALUE]

exec.memory::get_account_active_storage_slots_section_ptr
exec.memory::get_native_account_active_storage_slots_ptr
# => [storage_slots_ptr, slot_id_prefix, slot_id_suffix, VALUE]

exec.find_storage_slot
Expand Down Expand Up @@ -581,6 +583,9 @@ end

#! Stores NEW_VALUE under the specified KEY within the map contained in the given account storage slot.
#!
#! This procedure uses `get_native_account_active_storage_slots_ptr` to get the pointer to the native
#! account's storage slots section.
#!
#! Inputs: [slot_id_prefix, slot_id_suffix, KEY, NEW_VALUE]
#! Outputs: [OLD_VALUE]
#!
Expand All @@ -597,7 +602,7 @@ end
#! - the storage slot type is not map.
#! - no map with the root of the slot is found.
pub proc set_map_item
exec.memory::get_account_active_storage_slots_section_ptr
exec.memory::get_native_account_active_storage_slots_ptr
# => [storage_slots_ptr, slot_id_prefix, slot_id_suffix, KEY, NEW_VALUE]

# resolve the slot name to its pointer
Expand All @@ -617,17 +622,18 @@ pub proc set_map_item
# => [OLD_VALUE]
end

#! Returns the type of the storage slot at the provided index.
#! Returns the type of the storage slot at the provided index for the native account.
#!
#! WARNING: The index must be in bounds.
#! WARNING: This procedure works only for native accounts.
#!
#! Inputs: [index]
#! Outputs: [slot_type]
#!
#! Where:
#! - index is the location in memory of the storage slot.
#! - slot_type is the type of the storage slot.
pub proc get_storage_slot_type
pub proc get_native_storage_slot_type
# convert the index into a memory offset
mul.ACCOUNT_STORAGE_SLOT_DATA_LENGTH
# => [offset]
Expand Down Expand Up @@ -1256,7 +1262,7 @@ pub proc insert_new_storage
sub.1
# => [slot_idx]

dup exec.get_storage_slot_type
dup exec.get_native_storage_slot_type
# => [slot_type, slot_idx]

push.STORAGE_SLOT_TYPE_MAP eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ end
#! Inputs: [slot_idx, RATE, RATE, PERM]
#! Outputs: [RATE, RATE, PERM]
proc update_slot_delta
dup exec.account::get_storage_slot_type
dup exec.account::get_native_storage_slot_type
# => [storage_slot_type, slot_idx, RATE, RATE, PERM]

# check if slot is of type value
Expand Down
4 changes: 2 additions & 2 deletions crates/miden-testing/src/kernel_tests/tx/test_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ async fn test_get_map_item() -> anyhow::Result<()> {
}

#[tokio::test]
async fn test_get_storage_slot_type() -> anyhow::Result<()> {
async fn test_get_native_storage_slot_type() -> anyhow::Result<()> {
for slot_name in [
AccountStorage::mock_value_slot0().name(),
AccountStorage::mock_value_slot1().name(),
Expand Down Expand Up @@ -482,7 +482,7 @@ async fn test_get_storage_slot_type() -> anyhow::Result<()> {
push.{slot_idx}

# get the type of the respective storage slot
exec.account::get_storage_slot_type
exec.account::get_native_storage_slot_type

# truncate the stack
swap drop
Expand Down
Loading