Skip to content

fix(store): invalidate storage map values on slot recreation - #2504

Open
wodesiku wants to merge 1 commit into
0xMiden:nextfrom
wodesiku:fix/handle-storage-map-removals
Open

fix(store): invalidate storage map values on slot recreation#2504
wodesiku wants to merge 1 commit into
0xMiden:nextfrom
wodesiku:fix/handle-storage-map-removals

Conversation

@wodesiku

Copy link
Copy Markdown
Contributor

What does this PR do?

Invalidates stale SQLite storage-map value rows when a storage-map slot is removed or recreated.

Related Issue

Follow-up to #2328 and the previously closed #2378; the current protocol patch API now exposes the required Create/Remove operations.

Root Cause

The account upsert path updated account and storage-header rows, but prepare_partial_account_update did not close existing account_storage_map_values rows for StorageMapPatch::Remove or Create. Those rows retained valid_until = VALID_FOREVER, so removed values could be returned as current data and recreated slots could inherit stale keys.

Changes Made

  • Collect storage-map slots affected by Create and Remove operations.
  • Close all currently valid rows for each affected slot before inserting new entries.
  • Add a regression test covering the full old-map -> Remove -> Create flow.

How to Test

  • cargo test --locked -p miden-node-store optimized_delta_removes_storage_map_values --lib
  • cargo test --locked -p miden-node-store storage_map_remove_resets_forest_lineage_for_later_create --lib

Both commands were attempted on native Windows. Local execution is blocked before tests by existing environment/toolchain issues: miden-core-lib cannot resolve mod.masm, librocksdb-sys cannot find libclang.dll, and the proto build script reports a duplicated Windows include path for remote_prover.proto. No test assertion failure was observed.

Scope

  • No new dependencies.
  • Cargo.lock unchanged.
  • Focused to the account store write path and its regression test.

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