Skip to content

refactor(rpc/get_account): batch storage map proofs - #2439

Open
kkovaacs wants to merge 2 commits into
nextfrom
krisztian/get-account-batched-storage-proofs
Open

refactor(rpc/get_account): batch storage map proofs#2439
kkovaacs wants to merge 2 commits into
nextfrom
krisztian/get-account-batched-storage-proofs

Conversation

@kkovaacs

@kkovaacs kkovaacs commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

GetAccount now returns a PartialSmt with all requested key-value pairs.

  • A request for explicit map keys always returns one partial SMT covering those keys.
  • Partial SMTs are scoped to one storage map at one block. Proofs from different maps or roots are never merged.
  • The response carries the original, unhashed StorageMapKeys. The SMT contains hashed keys, so the raw keys cannot be recovered from the tree.
  • Values are not duplicated outside the SMT. A client obtains a value by hashing the raw key and calling PartialSmt::get_value().
  • too_many_entries, all_entries, and partial_map become mutually exclusive results.
  • The removed entries_with_proofs field number and name are reserved. Even though compatibility is intentionally broken, reusing the field could make an old client try to decode the new length-delimited message as the old one.
  • The compact protobuf representation mirrors miden_crypto::merkle::smt::UniqueNodes. Do not encode PartialSmt as an opaque byte string.

Closes #617

Changelog

[[entry]]
scope       = "rpc"
impact      = "breaking"
description = "Storage map proofs for multiple keys in `AccountResponse` are now represented as a batched `PartialSmt`."

GetAccount now returns a PartialSmt with all requested key-value pairs.

- A request for explicit map keys always returns one partial SMT
  covering those keys.
- Partial SMTs are scoped to one storage map at one block. Proofs from
  different maps or roots are never merged.
- The response carries the original, unhashed `StorageMapKey`s. The SMT
  contains hashed keys, so the raw keys cannot be recovered from the tree.
- Values are not duplicated outside the SMT. A client obtains a value by
  hashing the raw key and calling `PartialSmt::get_value()`.
- `too_many_entries`, `all_entries`, and `partial_map` become mutually
  exclusive results.
- The removed `entries_with_proofs` field number and name are reserved.
  Even though compatibility is intentionally broken, reusing the field
  could make an old client try to decode the new length-delimited message
  as the old one.
- The compact protobuf representation mirrors
  `miden_crypto::merkle::smt::UniqueNodes`. Do not encode `PartialSmt`
  as an opaque byte string.
@kkovaacs
kkovaacs force-pushed the krisztian/get-account-batched-storage-proofs branch from 5ae4953 to 1a99dc6 Compare August 5, 2026 14:01
@kkovaacs

kkovaacs commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Looks like there is a bug in PartialSmt::from_unique_nodes() that might prevent us from taking full advantage of this optimization: 0xMiden/miden-vm#3470

@kkovaacs
kkovaacs marked this pull request as ready for review August 5, 2026 15:34
@bobbinth

bobbinth commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Looks like there is a bug in PartialSmt::from_unique_nodes() that might prevent us from taking full advantage of this optimization: 0xMiden/miden-vm#3470

Once 0xMiden/miden-vm#3471 is merged, we should be able to do a patch release and it'll flow through to here immediately.

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.

Return one batch proof per storage map on GetAccount

2 participants