Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
3660c4d
feat: Implement `NamedStorageSlot`
PhilippGackstatter Oct 6, 2025
368a3b6
feat: Use `find_half_key_value`
PhilippGackstatter Oct 8, 2025
93aeb3b
feat: Implement `AccountStorage::get`
PhilippGackstatter Oct 9, 2025
dd30279
feat: Reimplement account storage APIs
PhilippGackstatter Oct 9, 2025
a8845e9
chore: Add compat APIs
PhilippGackstatter Oct 9, 2025
326df51
feat: Reinstantiate apply_delta and reimpl set_item_raw
PhilippGackstatter Oct 9, 2025
ffdaa41
fix: get_storage_slot_type
PhilippGackstatter Oct 9, 2025
8b29817
fix: name layout in memory
PhilippGackstatter Oct 9, 2025
dcdf55b
feat: Implement get_size_hint for named slot and slot name
PhilippGackstatter Oct 9, 2025
9d49150
chore: Reinstantiate commented tests
PhilippGackstatter Oct 9, 2025
3629f05
feat: Implement `SequentialCommit` and make `StorageSlotHeader` private
PhilippGackstatter Oct 9, 2025
5243e39
chore: Various cleanup
PhilippGackstatter Oct 9, 2025
b26bd46
fix: toml fmt and `typ` "typo"
PhilippGackstatter Oct 9, 2025
f6e0add
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Oct 9, 2025
9ada60c
chore: Add changelog entry
PhilippGackstatter Oct 9, 2025
d8acfcf
feat: Enforce max length on `SlotName`
PhilippGackstatter Oct 10, 2025
d8e643e
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Oct 10, 2025
4822684
chore: Emit event earlier in `get_map_item_raw`
PhilippGackstatter Oct 10, 2025
09ffc89
feat: Update docs of storage slot header and account storage header
PhilippGackstatter Oct 10, 2025
e854f2c
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Oct 15, 2025
f0fc368
chore: Document `NamedStorageSlot` fields
PhilippGackstatter Oct 15, 2025
ffc25de
chore: Rename `get_storage_slot_ptr` -> `find_storage_slot`
PhilippGackstatter Oct 15, 2025
2ca79f9
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Oct 24, 2025
95afca4
chore: use branch from VM PR
PhilippGackstatter Oct 24, 2025
b537a92
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Oct 28, 2025
21b63a6
chore: Bump miden-vm to 0.18.3
PhilippGackstatter Oct 28, 2025
15a3a60
feat: Convert `account::get_item` to use names
PhilippGackstatter Oct 15, 2025
751bee6
feat: Convert `account::get_initial_item` to use names
PhilippGackstatter Oct 15, 2025
740b050
feat: Convert `account::set_map_item` to use names
PhilippGackstatter Oct 16, 2025
80a9fcb
feat: Impl `Display` for `SlotNameId`
PhilippGackstatter Oct 18, 2025
a9b95ba
feat: Convert on_account_storage_before_set_map_item to use names
PhilippGackstatter Oct 18, 2025
493ae34
feat: Convert `account::get_(initial_)map_item` to use names
PhilippGackstatter Oct 18, 2025
4f4757e
feat: Convert `account::set_item` to use names
PhilippGackstatter Oct 18, 2025
5d1aad3
feat: Update `set_(map_)item` event handlers
PhilippGackstatter Oct 18, 2025
6bad1d6
feat: Convert miden-{objects, lib, tx} to use names
PhilippGackstatter Oct 23, 2025
918b896
feat: Update storage and storage delta to use names
PhilippGackstatter Oct 24, 2025
ea4c2b8
feat: Update miden-objects tests to use names
PhilippGackstatter Oct 24, 2025
9d1bf44
fix: miden-air import in miden-objects
PhilippGackstatter Oct 25, 2025
434b8de
chore: Deactivate `AccountComponentTemplate` code
PhilippGackstatter Oct 25, 2025
765197f
feat: Convert `miden-lib` to use names
PhilippGackstatter Oct 25, 2025
eb9625c
feat: Convert `miden-tx` to use names
PhilippGackstatter Oct 25, 2025
ceb94dc
fixup! feat: Convert `miden-lib` to use names
PhilippGackstatter Oct 25, 2025
f6674a7
feat: Update account delta commit. computation and set_map_item
PhilippGackstatter Oct 27, 2025
267c5da
feat: Convert MockAccountCode to use names
PhilippGackstatter Oct 27, 2025
c475f8a
chore: Update faucet data storage slot in masm
PhilippGackstatter Oct 27, 2025
97587fe
fixup! feat: Convert `account::get_(initial_)map_item` to use names
PhilippGackstatter Oct 27, 2025
cca8873
chore: Add todo for protocol library docs
PhilippGackstatter Oct 27, 2025
984843a
fix: set_map_item and get_item
PhilippGackstatter Oct 27, 2025
3dd0c1f
feat: Update prologue new faucet validation
PhilippGackstatter Oct 27, 2025
9a36413
chore: Add `NamedStorageSlot::slot_type`
PhilippGackstatter Oct 27, 2025
b714383
chore: Update storage API tests
PhilippGackstatter Oct 27, 2025
415957a
chore: Remove storage offset related tests
PhilippGackstatter Oct 27, 2025
f6f8736
fix: reinsert missing `and`
PhilippGackstatter Oct 27, 2025
2f237b1
fix: add storage commitment dirty flag
PhilippGackstatter Oct 27, 2025
75d4a62
fix: get_item_delta impl
PhilippGackstatter Oct 27, 2025
b225168
chore: Update storage commitment and proven TX test
PhilippGackstatter Oct 27, 2025
caf71e1
chore: Use miden-air from crates.io
PhilippGackstatter Oct 28, 2025
0d47d86
chore: Update MASM auth components to use names
PhilippGackstatter Oct 28, 2025
a45432d
feat: Convert `test_account` to use names
PhilippGackstatter Oct 28, 2025
dfd5b4a
chore: Compile mock account code in debug mode if enabled
PhilippGackstatter Oct 28, 2025
eeb84aa
fixup! feat: Convert `test_account` to use names
PhilippGackstatter Oct 28, 2025
9720868
feat: Convert `test_account_delta` to use names
PhilippGackstatter Oct 28, 2025
57cb691
feat: Convert `test_{lazy_loading, tx, prologue}` to use names
PhilippGackstatter Oct 28, 2025
b043b6b
chore: Convert chain builder to use names
PhilippGackstatter Oct 28, 2025
7091727
chore: Convert proven block error test to use names
PhilippGackstatter Oct 28, 2025
f046eda
fix: Move dropw from account::set_map_item to api.masm
PhilippGackstatter Oct 28, 2025
f826fc5
feat: Update `test_fee` to use names
PhilippGackstatter Oct 28, 2025
083b3f7
feat: Convert `test_faucet` to use names
PhilippGackstatter Oct 28, 2025
8a8862a
feat: Convert `test_epilogue` to use names
PhilippGackstatter Oct 28, 2025
f0ad0fc
feat: Convert `test_fpi` to use names
PhilippGackstatter Oct 28, 2025
928cc9a
feat: Convert wallet and auth tests to use names
PhilippGackstatter Oct 28, 2025
15e00c2
feat: Update basic fungible faucet MASM to use named slot
PhilippGackstatter Oct 28, 2025
16b9b0e
chore: Remove unused function; move stack truncation to caller
PhilippGackstatter Oct 28, 2025
eaf5076
feat: Refactor set_map_item to not store name ID
PhilippGackstatter Oct 28, 2025
4454a79
chore: Remove unused `$kernel::account` procedures
PhilippGackstatter Oct 28, 2025
7345c4d
feat: Document slot name getters
PhilippGackstatter Oct 28, 2025
ca3a9d8
chore: Update account delta ambiguity examples
PhilippGackstatter Oct 28, 2025
f168150
feat: Make `AccountStorageHeader::new` fallible
PhilippGackstatter Oct 28, 2025
b59bbf1
feat: Return error on duplicate storage slot names
PhilippGackstatter Oct 28, 2025
86e0d48
feat: Document [`NamedStorageSlot`]
PhilippGackstatter Oct 28, 2025
5a2e394
feat: Document `SlotNameId`
PhilippGackstatter Oct 28, 2025
f7ff2ae
chore: Document `SlotName::compute_id`
PhilippGackstatter Oct 28, 2025
354aa0a
fix: ERR_ACCOUNT_UNKNOWN_STORAGE_SLOT_NAME naming
PhilippGackstatter Oct 28, 2025
5a47937
chore: Remove `SlotName::random` due to no-std incompatibility
PhilippGackstatter Oct 28, 2025
113b25d
chore: Remove outdated TODO(kernel_stack_underflow)
PhilippGackstatter Oct 28, 2025
3f66be0
chore: add changelog
PhilippGackstatter Oct 28, 2025
f34d6fc
chore: Deactivate templates differently to reduce diff
PhilippGackstatter Oct 28, 2025
c11c924
fix: storage map delta test, typos, rustfmt
PhilippGackstatter Oct 28, 2025
94c483d
fix: doc build and slot name import
PhilippGackstatter Oct 29, 2025
3566253
chore: Use ACCOUNT_STORAGE_SLOT_DATA_LENGTH instead of magic constant
PhilippGackstatter Oct 29, 2025
611a1a5
chore: add TODO for faucet data slot rename
PhilippGackstatter Oct 29, 2025
a2d5777
fix: incorrect error in get_map_item and u32 validity
PhilippGackstatter Oct 29, 2025
b6d1b69
feat: Update storage layout docs of std components
PhilippGackstatter Oct 29, 2025
2e3c6a3
chore: Replace `NamedStorageSlot::new` with better constructors
PhilippGackstatter Oct 30, 2025
9725652
chore: remove outdated slot layout
PhilippGackstatter Oct 30, 2025
d476cb1
chore: Add docs for memory constants
PhilippGackstatter Oct 30, 2025
5674023
chore: Reorder slot name ID for consistency
PhilippGackstatter Oct 30, 2025
914e3fd
chore: Expand slot name ID docs
PhilippGackstatter Oct 30, 2025
b3d0801
chore: use more interesting test case
PhilippGackstatter Oct 30, 2025
6c2af04
chore: Avoid reimplementing find logic in storage header
PhilippGackstatter Oct 30, 2025
c827b3f
chore: Update `AccountStorage` docs
PhilippGackstatter Oct 30, 2025
4ed6b06
chore: Avoid using `SlotName::from_static_str`
PhilippGackstatter Oct 30, 2025
8bc08b7
chore: Unify named storage slot constructor names
PhilippGackstatter Oct 30, 2025
596f476
chore: Comment out `AccountComponentTemplateError`
PhilippGackstatter Oct 30, 2025
3de4ba5
chore: Improve error names and messages
PhilippGackstatter Oct 30, 2025
0613d45
chore: Rename testing slot name constants
PhilippGackstatter Oct 30, 2025
0e05126
chore: Improve `AccountStorage::mock_*_slot` names
PhilippGackstatter Oct 30, 2025
f0b2e99
chore: Use mock slot names consistently
PhilippGackstatter Oct 30, 2025
7a7a9d2
chore: Remove unnecessary named storage slot test helpers
PhilippGackstatter Oct 30, 2025
0a08e94
chore: Use constant for slot value offset instead of magic num
PhilippGackstatter Oct 30, 2025
3bd82b9
chore: Remove development lints
PhilippGackstatter Oct 30, 2025
ca61fd7
chore: Remove proto library todo
PhilippGackstatter Oct 30, 2025
70d9f9c
chore: Use `get_item_raw` instead of `mem_loadw`
PhilippGackstatter Oct 30, 2025
3a1f884
feat: Abstract over setting the slot item via `set_item_raw`
PhilippGackstatter Oct 30, 2025
5bc8c52
chore: Rename `SlotName::new_test` to `mock`
PhilippGackstatter Oct 31, 2025
3888f16
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Nov 3, 2025
0a3447a
chore: Address post-merge changes
PhilippGackstatter Nov 3, 2025
02c2aa3
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Nov 6, 2025
426d6a2
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Nov 7, 2025
383c5fd
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Nov 10, 2025
8dda2fc
chore: move changelog entry to 0.13 and remove duplicate entries
PhilippGackstatter Nov 10, 2025
945d8bc
fix: make format
PhilippGackstatter Nov 10, 2025
ddf0450
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Nov 11, 2025
7e29d4c
fix: make toml
PhilippGackstatter Nov 11, 2025
f442c3a
chore: remove leftover println
PhilippGackstatter Nov 11, 2025
ca5ae76
chore: Document `set_map_item_raw`
PhilippGackstatter Nov 11, 2025
aee125a
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Nov 23, 2025
4dbb71b
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Nov 24, 2025
c4725b0
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Dec 1, 2025
ed6decd
chore: Use `get_storage_slot_type` instead
PhilippGackstatter Dec 1, 2025
f73ce80
chore: Use BTreeSet to check for name uniqueness
PhilippGackstatter Dec 1, 2025
365d062
chore: Rename `name_id` to `id`
PhilippGackstatter Dec 1, 2025
8e3618b
chore: Use `project_name` in slot name example
PhilippGackstatter Dec 1, 2025
b72626a
chore: Remove `SlotName::is_empty`
PhilippGackstatter Dec 1, 2025
27fa924
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Dec 1, 2025
69ca866
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Dec 3, 2025
5c65f9d
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Dec 3, 2025
6f98492
fix: remove dup changelog entries
PhilippGackstatter Dec 5, 2025
6ec7858
chore: Revive `AccountStorageHeader::is_map_slot`
PhilippGackstatter Dec 5, 2025
e081dce
chore: Use slot content and just slot ID without name
PhilippGackstatter Dec 5, 2025
8e80819
chore: Describe storage slot layout in memory.rs
PhilippGackstatter Dec 5, 2025
ef84a43
chore: update comments in account comp interface
PhilippGackstatter Dec 5, 2025
6bde672
chore: Encapsulate storage slot lookup into base host method
PhilippGackstatter Dec 5, 2025
dd9cb43
chore: Use `miden::standards::auth` prefix for auth comp slot names
PhilippGackstatter Dec 5, 2025
dd85a8c
Merge remote-tracking branch 'origin/next' into pgackst-named-storage…
PhilippGackstatter Dec 5, 2025
2b97e34
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Dec 5, 2025
bcbeeca
chore: Add missing docs for `is_faucet_storage_data_slot`
PhilippGackstatter Dec 5, 2025
f67d24f
chore: Update `AccountStorage` docs
PhilippGackstatter Dec 5, 2025
5661d74
Merge branch 'next' into pgackst-named-storage-slots
bobbinth Dec 6, 2025
fe294ff
fix: read owner from owner instead of metadata slot
PhilippGackstatter Dec 8, 2025
1588fba
Merge remote-tracking branch 'origin/pgackst-named-storage-slots' int…
PhilippGackstatter Dec 8, 2025
ec2443e
chore: regengerate kernel procedure files
PhilippGackstatter Dec 8, 2025
4437026
Merge branch 'pgackst-named-storage-slots' into pgackst-named-storage…
PhilippGackstatter Dec 8, 2025
a3f247f
chore: Correct `find_storage_slot` docs
PhilippGackstatter Dec 8, 2025
9d13331
chore: Drop `.` from `proc.get_item_raw`
PhilippGackstatter Dec 8, 2025
5c89e45
chore: Drop unnecessary `ProcessState` param from `get_storage_slot`
PhilippGackstatter Dec 8, 2025
4109cff
chore: Drop `.` from `proc.slot_ptr_to_index`
PhilippGackstatter Dec 8, 2025
ce78327
chore: Move local docs to proc signature
PhilippGackstatter Dec 8, 2025
b6d4399
fix: correct stack comment `slot_ptr` -> `slot_type`
PhilippGackstatter Dec 8, 2025
6e2f63c
chore: Remove `active_account::{set_item,set_map_item}`
PhilippGackstatter Dec 8, 2025
a7bafea
chore: Combine stack truncation into single line
PhilippGackstatter Dec 8, 2025
2313630
chore: Rename to `get_faucet_storage_slot_id`
PhilippGackstatter Dec 8, 2025
f595bb3
chore: Make `set_map_item_raw` private
PhilippGackstatter Dec 8, 2025
81cc1e0
chore: Relax requirements for `slot_ptr_to_index`
PhilippGackstatter Dec 8, 2025
63d2c95
chore: improve `set_` procedure doc comments
PhilippGackstatter Dec 8, 2025
b88427c
fix: slot_ptr description
PhilippGackstatter Dec 8, 2025
b664821
chore: Rename `get_slot_id` and warn on natve account usage
PhilippGackstatter Dec 8, 2025
a7aaa99
chore: Add note for storage delta setters
PhilippGackstatter Dec 8, 2025
c79a928
chore: improve named storage slot docs
PhilippGackstatter Dec 9, 2025
7ec39aa
chore: remove outdated comments
PhilippGackstatter Dec 9, 2025
d610940
Merge branch 'next' into pgackst-named-storage-slots-frontend
PhilippGackstatter Dec 9, 2025
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- [BREAKING] Refactor storage slots to be accessed by names instead of indices ([#1987](https://github.com/0xMiden/miden-base/pull/1987)).
- [BREAKING] Refactor storage slots to be accessed by names instead of indices ([#1987](https://github.com/0xMiden/miden-base/pull/1987), [#2025](https://github.com/0xMiden/miden-base/pull/2025)).

## 0.12.2 (unreleased)
- Add proc-macro `WordWrapper` to ease implementation of `Word`-wrapping types ([#2071](https://github.com/0xMiden/miden-base/pull/2108)).
Expand Down Expand Up @@ -76,9 +77,9 @@
- Added `account::get_initial_balance` procedure to `miden` lib ([#1959](https://github.com/0xMiden/miden-base/pull/1959)).
- [BREAKING] Changed `Account` to `PartialAccount` conversion to generally track only minimal data ([#1963](https://github.com/0xMiden/miden-base/pull/1963)).
- Added `MastArtifact`, `PackageExport`, `PackageManifest`, `AttributeSet`, `QualifiedProcedureName`, `Section` and `SectionId` to re-export section ([#1984](https://github.com/0xMiden/miden-base/pull/1984) and [#2015](https://github.com/0xMiden/miden-base/pull/2015)).
- [BREAKING] Enable computing the transaction ID from the data in a `TransactionHeader` ([#1973](https://github.com/0xMiden/miden-base/pull/1973)).
- [BREAKING] Enable computing the transaction ID from the data in a `TransactionHeader` ([#1973]https://github.com/0xMiden/miden-base/pull/1973).
- [BREAKING] Introduce `VaultKey` newtype wrapper for asset vault keys ([#1978]https://github.com/0xMiden/miden-base/pull/1978).
- [BREAKING] Introduce `AssetVaultKey` newtype wrapper for asset vault keys ([#1978](https://github.com/0xMiden/miden-base/pull/1978), [#2024](https://github.com/0xMiden/miden-base/pull/2024)).
- [BREAKING] Change `Account` to `PartialAccount` conversion to generally track only minimal data ([#1963](https://github.com/0xMiden/miden-base/pull/1963)).
- Added `network_fungible_faucet` and `MINT` & `BURN` notes ([#1925](https://github.com/0xMiden/miden-base/pull/1925))
- Removed `create_p2id_note` and `create_p2any_note` methods from `MockChainBuilder`, users should use `add_p2id_note` and `add_p2any_note` instead ([#1990](https://github.com/0xMiden/miden-base/issues/1990)).
- [BREAKING] Introduced `AuthScheme` and `PublicKey` enums in `miden-objects::account::auth` module ([#1994](https://github.com/0xMiden/miden-base/pull/1994)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type BeWord = struct @bigendian { a: felt, b: felt, c: felt, d: felt }
# =================================================================================================

# The slot in this component's storage layout where the public key is stored.
const PUBLIC_KEY_SLOT = 0
const PUBLIC_KEY_SLOT = word("miden::standards::auth::ecdsa_k256_keccak::public_key")

#! Authenticate a transaction using the ECDSA signature scheme.
#!
Expand All @@ -34,7 +34,8 @@ pub proc auth_tx_ecdsa_k256_keccak(auth_args: BeWord)

# Fetch public key from storage.
# ---------------------------------------------------------------------------------------------
push.PUBLIC_KEY_SLOT exec.active_account::get_item

push.PUBLIC_KEY_SLOT[0..2] exec.active_account::get_item
# => [PUB_KEY, pad(16)]

exec.ecdsa_k256_keccak::authenticate_transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ type BeWord = struct @bigendian { a: felt, b: felt, c: felt, d: felt }
# ================================================================================================

# The slot in this component's storage layout where the public key is stored.
const PUBLIC_KEY_SLOT = 0
const PUBLIC_KEY_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_acl::public_key")

# The slot where the authentication configuration is stored.
const AUTH_CONFIG_SLOT = 1
const AUTH_CONFIG_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_acl::config")

# The slot where the map of auth trigger procedure roots is stored.
const AUTH_TRIGGER_PROCS_MAP_SLOT = 2
const AUTH_TRIGGER_PROCS_MAP_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_acl::tracked_procedure_roots")

#! Authenticate a transaction using the ECDSA signature scheme based on procedure calls and note usage.
#!
Expand All @@ -40,7 +40,7 @@ pub proc auth_tx_ecdsa_k256_keccak_acl.2(auth_args: BeWord)
# => [pad(16)]

# Get the authentication configuration
push.AUTH_CONFIG_SLOT exec.active_account::get_item
push.AUTH_CONFIG_SLOT[0..2] exec.active_account::get_item
# => [0, allow_unauthorized_input_notes, allow_unauthorized_output_notes, num_auth_trigger_procs, pad(16)]

drop
Expand All @@ -62,8 +62,8 @@ pub proc auth_tx_ecdsa_k256_keccak_acl.2(auth_args: BeWord)
# => [require_acl_auth, i, pad(16)]

# Get the procedure root from storage
dup.1 sub.1 push.0.0.0 push.AUTH_TRIGGER_PROCS_MAP_SLOT
# => [AUTH_TRIGGER_PROCS_MAP_SLOT, [0, 0, 0, i-1], require_acl_auth, i, pad(16)]
dup.1 sub.1 push.0.0.0 push.AUTH_TRIGGER_PROCS_MAP_SLOT[0..2]
# => [trigger_proc_slot_prefix, trigger_proc_slot_suffix, [0, 0, 0, i-1], require_acl_auth, i, pad(16)]

exec.active_account::get_map_item
# => [AUTH_TRIGGER_PROC_ROOT, require_acl_auth, i, pad(16)]
Expand Down Expand Up @@ -124,7 +124,7 @@ pub proc auth_tx_ecdsa_k256_keccak_acl.2(auth_args: BeWord)
# If authentication is required, perform signature verification
if.true
# Fetch public key from storage.
push.PUBLIC_KEY_SLOT exec.active_account::get_item
push.PUBLIC_KEY_SLOT[0..2] exec.active_account::get_item
# => [PUB_KEY, pad(16)]

exec.::miden::auth::ecdsa_k256_keccak::authenticate_transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ const AUTH_UNAUTHORIZED_EVENT = event("miden::auth::unauthorized")
# number of approvers are stored as:
# [default_threshold, num_approvers, 0, 0].
# The threshold is guaranteed to be less than or equal to num_approvers.
const THRESHOLD_CONFIG_SLOT = 0
const THRESHOLD_CONFIG_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::threshold_config")

# The slot in this component's storage layout where the public keys map is stored.
# Map entries: [key_index, 0, 0, 0] => APPROVER_PUBLIC_KEY
const PUBLIC_KEYS_MAP_SLOT = 1
const APPROVER_PUBLIC_KEYS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::approver_public_keys")

# The slot in this component's storage layout where executed transactions are stored.
# Map entries: transaction_message => [is_executed, 0, 0, 0]
const EXECUTED_TXS_SLOT = 2
const EXECUTED_TXS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::executed_transactions")

# The slot in this component's storage layout where procedure thresholds are stored.
# Map entries: PROC_ROOT => [proc_threshold, 0, 0, 0]
const.PROC_THRESHOLD_ROOTS_SLOT=3
const PROC_THRESHOLD_ROOTS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::procedure_thresholds")

# Executed Transaction Flag Constant
const IS_EXECUTED_FLAG = [1, 0, 0, 0]
Expand Down Expand Up @@ -69,8 +69,8 @@ proc assert_new_tx(msg: BeWord)
swapw
# => [MSG, IS_EXECUTED_FLAG]

push.EXECUTED_TXS_SLOT
# => [index, MSG, IS_EXECUTED_FLAG]
push.EXECUTED_TXS_SLOT[0..2]
# => [txs_slot_prefix, txs_slot_suffix, MSG, IS_EXECUTED_FLAG]

# Set the key value pair in the map to mark transaction as executed
exec.native_account::set_map_item
Expand Down Expand Up @@ -115,8 +115,8 @@ proc cleanup_pubkey_mapping(init_num_of_approvers: u32, new_num_of_approvers: u3
padw swapw
# => [[0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
# => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]

exec.native_account::set_map_item
# => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, new_num_of_approvers]
Expand Down Expand Up @@ -178,8 +178,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord)
eq.0 assertz.err=ERR_ZERO_IN_MULTISIG_CONFIG
# => [MULTISIG_CONFIG, pad(12)]

push.THRESHOLD_CONFIG_SLOT
# => [slot, MULTISIG_CONFIG, pad(12)]
push.THRESHOLD_CONFIG_SLOT[0..2]
# => [config_slot_prefix, config_slot_suffix, MULTISIG_CONFIG, pad(12)]

exec.native_account::set_item
# => [OLD_THRESHOLD_CONFIG, pad(12)]
Expand All @@ -205,8 +205,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord)
swapw
# => [[0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
# => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]

exec.native_account::set_map_item
# => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, pad(12)]
Expand Down Expand Up @@ -277,8 +277,8 @@ proc compute_transaction_threshold.1(default_threshold: u32) -> u32
if.true
# => [PROC_ROOT, num_procedures-1, transaction_threshold]

push.PROC_THRESHOLD_ROOTS_SLOT
# => [PROC_THRESHOLD_ROOTS_SLOT, PROC_ROOT, num_procedures-1, transaction_threshold]
push.PROC_THRESHOLD_ROOTS_SLOT[0..2]
# => [proc_roots_slot_prefix, proc_roots_slot_suffix, PROC_ROOT, num_procedures-1, transaction_threshold]

# 2b. get the override proc_threshold of that procedure
# if the procedure has no override threshold, the returned map item will be [0, 0, 0, 0]
Expand Down Expand Up @@ -372,8 +372,8 @@ pub proc auth_tx_ecdsa_k256_keccak_multisig.1(salt: BeWord)

# ------ Verifying approver signatures ------

push.THRESHOLD_CONFIG_SLOT
# => [index, TX_SUMMARY_COMMITMENT]
push.THRESHOLD_CONFIG_SLOT[0..2]
# => [config_slot_prefix, config_slot_suffix, TX_SUMMARY_COMMITMENT]

exec.active_account::get_initial_item
# => [0, 0, num_of_approvers, default_threshold, TX_SUMMARY_COMMITMENT]
Expand All @@ -384,8 +384,8 @@ pub proc auth_tx_ecdsa_k256_keccak_multisig.1(salt: BeWord)
swap movdn.5
# => [num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
Copy link
Contributor

Choose a reason for hiding this comment

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

We are using push.SLOT_NAME[0..2] quite often, so I'm wondering should we create a new syntax for the slot names, which will work similar to the word(...) or event(...), but will hold just two first elements of the resulting hash. That way it will be more clear what in fact this constant is holding.

Probably it's an overkill, this feature will require some changes in the VM, but could be nice to have something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kind of agree, yes. I think it would already be sufficient to be able to define a sliced constant:

const APPROVER_PUBLIC_KEYS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::approver_public_keys")[0..2]

And then you could simply do:

push.APPROVER_PUBLIC_KEYS_SLOT

But not sure it's worth adding.

# => [pub_key_slot_prefix, pub_key_slot_suffix, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]

exec.::miden::auth::ecdsa_k256_keccak::verify_signatures
# => [num_verified_signatures, TX_SUMMARY_COMMITMENT, default_threshold]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ const AUTH_UNAUTHORIZED_EVENT = event("miden::auth::unauthorized")
# number of approvers are stored as:
# [default_threshold, num_approvers, 0, 0].
# The threshold is guaranteed to be less than or equal to num_approvers.
const THRESHOLD_CONFIG_SLOT = 0
const THRESHOLD_CONFIG_SLOT = word("miden::standards::auth::rpo_falcon512_multisig::threshold_config")

# The slot in this component's storage layout where the public keys map is stored.
# Map entries: [key_index, 0, 0, 0] => APPROVER_PUBLIC_KEY
const PUBLIC_KEYS_MAP_SLOT = 1
const APPROVER_PUBLIC_KEYS_SLOT = word("miden::standards::auth::rpo_falcon512_multisig::approver_public_keys")

# The slot in this component's storage layout where executed transactions are stored.
# Map entries: transaction_message => [is_executed, 0, 0, 0]
const EXECUTED_TXS_SLOT = 2
const EXECUTED_TXS_SLOT = word("miden::standards::auth::rpo_falcon512_multisig::executed_transactions")

# The slot in this component's storage layout where procedure thresholds are stored.
# Map entries: PROC_ROOT => [proc_threshold, 0, 0, 0]
const.PROC_THRESHOLD_ROOTS_SLOT=3
const PROC_THRESHOLD_ROOTS_SLOT = word("miden::standards::auth::rpo_falcon512_multisig::procedure_thresholds")

# Executed Transaction Flag Constant
const IS_EXECUTED_FLAG = [1, 0, 0, 0]
Expand Down Expand Up @@ -69,8 +69,8 @@ proc assert_new_tx(msg: BeWord)
swapw
# => [MSG, IS_EXECUTED_FLAG]

push.EXECUTED_TXS_SLOT
# => [index, MSG, IS_EXECUTED_FLAG]
push.EXECUTED_TXS_SLOT[0..2]
# => [txs_slot_prefix, txs_slot_suffix, MSG, IS_EXECUTED_FLAG]

# Set the key value pair in the map to mark transaction as executed
exec.native_account::set_map_item
Expand Down Expand Up @@ -115,8 +115,8 @@ proc cleanup_pubkey_mapping(init_num_of_approvers: u32, new_num_of_approvers: u3
padw swapw
# => [[0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
# => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers]

exec.native_account::set_map_item
# => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, new_num_of_approvers]
Expand Down Expand Up @@ -178,8 +178,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord)
eq.0 assertz.err=ERR_ZERO_IN_MULTISIG_CONFIG
# => [MULTISIG_CONFIG, pad(12)]

push.THRESHOLD_CONFIG_SLOT
# => [slot, MULTISIG_CONFIG, pad(12)]
push.THRESHOLD_CONFIG_SLOT[0..2]
# => [config_slot_prefix, config_slot_suffix, MULTISIG_CONFIG, pad(12)]

exec.native_account::set_item
# => [OLD_THRESHOLD_CONFIG, pad(12)]
Expand All @@ -205,8 +205,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord)
swapw
# => [[0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
# => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)]

exec.native_account::set_map_item
# => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, pad(12)]
Expand Down Expand Up @@ -277,8 +277,8 @@ proc compute_transaction_threshold.1(default_threshold: u32) -> u32
if.true
# => [PROC_ROOT, num_procedures-1, transaction_threshold]

push.PROC_THRESHOLD_ROOTS_SLOT
# => [PROC_THRESHOLD_ROOTS_SLOT, PROC_ROOT, num_procedures-1, transaction_threshold]
push.PROC_THRESHOLD_ROOTS_SLOT[0..2]
# => [proc_roots_slot_prefix, proc_roots_slot_suffix, PROC_ROOT, num_procedures-1, transaction_threshold]

# 2b. get the override proc_threshold of that procedure
# if the procedure has no override threshold, the returned map item will be [0, 0, 0, 0]
Expand Down Expand Up @@ -372,8 +372,8 @@ pub proc auth_tx_rpo_falcon512_multisig.1(salt: BeWord)

# ------ Verifying approver signatures ------

push.THRESHOLD_CONFIG_SLOT
# => [index, TX_SUMMARY_COMMITMENT]
push.THRESHOLD_CONFIG_SLOT[0..2]
# => [config_slot_prefix, config_slot_suffix, TX_SUMMARY_COMMITMENT]

exec.active_account::get_initial_item
# => [0, 0, num_of_approvers, default_threshold, TX_SUMMARY_COMMITMENT]
Expand All @@ -384,8 +384,8 @@ pub proc auth_tx_rpo_falcon512_multisig.1(salt: BeWord)
swap movdn.5
# => [num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]

push.PUBLIC_KEYS_MAP_SLOT
# => [pub_key_slot_idx, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]
push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
# => [pub_key_slot_prefix, pub_key_slot_suffix, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold]

exec.::miden::auth::rpo_falcon512::verify_signatures
# => [num_verified_signatures, TX_SUMMARY_COMMITMENT, default_threshold]
Expand Down
5 changes: 3 additions & 2 deletions crates/miden-lib/asm/account_components/rpo_falcon_512.masm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type BeWord = struct @bigendian { a: felt, b: felt, c: felt, d: felt }
# =================================================================================================

# The slot in this component's storage layout where the public key is stored.
const PUBLIC_KEY_SLOT = 0
const PUBLIC_KEY_SLOT = word("miden::standards::auth::rpo_falcon512::public_key")

#! Authenticate a transaction using the Falcon signature scheme.
#!
Expand All @@ -34,7 +34,8 @@ pub proc auth_tx_rpo_falcon512(auth_args: BeWord)

# Fetch public key from storage.
# ---------------------------------------------------------------------------------------------
push.PUBLIC_KEY_SLOT exec.active_account::get_item

push.PUBLIC_KEY_SLOT[0..2] exec.active_account::get_item
# => [PUB_KEY, pad(16)]

exec.rpo_falcon512::authenticate_transaction
Expand Down
14 changes: 7 additions & 7 deletions crates/miden-lib/asm/account_components/rpo_falcon_512_acl.masm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ type BeWord = struct @bigendian { a: felt, b: felt, c: felt, d: felt }
# ================================================================================================

# The slot in this component's storage layout where the public key is stored.
const PUBLIC_KEY_SLOT = 0
const PUBLIC_KEY_SLOT = word("miden::standards::auth::rpo_falcon512_acl::public_key")

# The slot where the authentication configuration is stored.
const AUTH_CONFIG_SLOT = 1
const AUTH_CONFIG_SLOT = word("miden::standards::auth::rpo_falcon512_acl::config")

# The slot where the map of auth trigger procedure roots is stored.
const AUTH_TRIGGER_PROCS_MAP_SLOT = 2
const AUTH_TRIGGER_PROCS_MAP_SLOT = word("miden::standards::auth::rpo_falcon512_acl::tracked_procedure_roots")

#! Authenticate a transaction using the Falcon signature scheme based on procedure calls and note usage.
#!
Expand All @@ -40,7 +40,7 @@ pub proc auth_tx_rpo_falcon512_acl.2(auth_args: BeWord)
# => [pad(16)]

# Get the authentication configuration
push.AUTH_CONFIG_SLOT exec.active_account::get_item
push.AUTH_CONFIG_SLOT[0..2] exec.active_account::get_item
# => [0, allow_unauthorized_input_notes, allow_unauthorized_output_notes, num_auth_trigger_procs, pad(16)]

drop
Expand All @@ -62,8 +62,8 @@ pub proc auth_tx_rpo_falcon512_acl.2(auth_args: BeWord)
# => [require_acl_auth, i, pad(16)]

# Get the procedure root from storage
dup.1 sub.1 push.0.0.0 push.AUTH_TRIGGER_PROCS_MAP_SLOT
# => [AUTH_TRIGGER_PROCS_MAP_SLOT, [0, 0, 0, i-1], require_acl_auth, i, pad(16)]
dup.1 sub.1 push.0.0.0 push.AUTH_TRIGGER_PROCS_MAP_SLOT[0..2]
# => [trigger_proc_slot_prefix, trigger_proc_slot_suffix, [0, 0, 0, i-1], require_acl_auth, i, pad(16)]

exec.active_account::get_map_item
# => [AUTH_TRIGGER_PROC_ROOT, require_acl_auth, i, pad(16)]
Expand Down Expand Up @@ -124,7 +124,7 @@ pub proc auth_tx_rpo_falcon512_acl.2(auth_args: BeWord)
# If authentication is required, perform signature verification
if.true
# Fetch public key from storage.
push.PUBLIC_KEY_SLOT exec.active_account::get_item
push.PUBLIC_KEY_SLOT[0..2] exec.active_account::get_item
# => [PUB_KEY, pad(16)]

exec.::miden::auth::rpo_falcon512::authenticate_transaction
Expand Down
Loading