upsert_account_storage uses two separate Dexie transactions partial write hazard
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 21
- Avg merge
- 12h 14m
- Merged PRs (30d)
- 41
Description
## Bug
`upsert_account_storage` in `crates/idxdb-store/src/account/utils.rs` calls `idxdb_upsert_account_storage` and `idxdb_upsert_storage_map_entries` as two separate Dexie transactions. If the second call fails after the first succeeds, storage slot headers are persisted without their corresponding map entries, leaving the account in an inconsistent state.
## Impact
- Storage slot headers reference map roots that have no entries in the database
- Storage reconstruction fails validation
- Inconsistency persists until full re-sync
## Root cause
Each helper creates its own Dexie transaction. No outer transaction wraps them.
Same class as #190 but a different code path.
Contributor guide
Research direction
The bug is in `crates/idxdb-store/src/account/utils.rs` in the `upsert_account_storage` function. Examine the two separate calls to `idxdb_upsert_account_storage` and `idxdb_upsert_storage_map_entries`. Understand how Dexie transactions work in this codebase. The fix likely involves wrapping both operations in a single transaction. Check for existing patterns or tests related to transaction handling, and run any tests for storage consistency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100