Skip to content

feat(web-client): expose storage-map deltas and slot names on AccountStorageDelta - #298

Open
WiktorStarczewski wants to merge 2 commits into
mainfrom
feat/storage-delta-maps
Open

feat(web-client): expose storage-map deltas and slot names on AccountStorageDelta#298
WiktorStarczewski wants to merge 2 commits into
mainfrom
feat/storage-delta-maps

Conversation

@WiktorStarczewski

Copy link
Copy Markdown
Collaborator

What

Adds two accessors to AccountStorageDelta so a JS consumer can read storage-map deltas and the slot names of value-slot changes from a TransactionSummary:

  • valueDeltas(): StorageValueDelta[] — each { slotName, value } (the existing values(): Word[] is unchanged).
  • maps(): StorageMapSlotDelta[] — each { slotName, entries() }, where an entry is StorageMapDeltaEntry { key, value } (both Word).

Why

AccountStorageDelta.values() returned a bare Word[] with the slot name dropped, and storage-map deltas weren't exposed at all. A consumer that needs to verify what a transaction changed — e.g. the OpenZeppelin guardian multisig client checking that a proposal's metadata matches the signed TransactionSummary in a block-independent way — must read map-slot changes (signer sets, per-procedure thresholds) and know which value slot changed. Those live in storage maps / named value slots that the JS binding was discarding.

How

Pure JS-binding addition, mirroring the existing FungibleAssetDeltaItem pattern in vault.rs. The native miden-protocol AccountStorageDelta already exposes values() (with slot name) and maps(); this surfaces them. Slot names come through as plain strings (StorageSlotName::as_str()), so consumers match by name directly. No upstream miden-protocol / miden-client change — the data was already present, just dropped at the boundary. values() is left intact (additive, non-breaking).

Tests

Extended the transactions.preview returns a TransactionSummary mock test to exercise storage().valueDeltas() / maps() on a real faucet-mint summary (accessors present, arrays returned, valueDeltas() aligned with values(), value-slot shape checked).

Notes

  • Bumps @miden-sdk/miden-sdk to 0.15.10; CHANGELOG entry under ## 0.15.10 (TBD).
  • StorageMapEntry already existed (full-storage {root,key,value} strings), so the delta entry type is named StorageMapDeltaEntry.

…StorageDelta

Add AccountStorageDelta.valueDeltas() (each { slotName, value }) and
maps() (each { slotName, entries() } of { key, value } Words), so a
consumer can read storage-map changes (e.g. multisig signer sets,
per-procedure thresholds) and label value-slot changes from a
TransactionSummary.accountDelta().storage(). The existing values()
(bare Word[]) is unchanged. Purely a JS-binding addition; the native
miden-protocol data was already present.

Bumps @miden-sdk/miden-sdk to 0.15.10.
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.

1 participant