Stealth entry handling can race with direct deposits or withdrawals, allowing balance mismatches or stealth entries to persist after a withdrawal due to inconsistent storage ordering.
Affected areas: app/contract/contracts/Folder/src/stealth.rs, app/contract/contracts/Folder/src/storage.rs, app/contract/contracts/Folder/src/lib.rs, app/contract/contracts/Folder/src/test.rs.
Implementation scope:
- Add stronger ordering and locking invariants around stealth deposit and withdrawal flows.
- Validate stealth entry balances before and after every state transition.
- Add explicit cleanup for empty stealth entries and orphaned balances.
- Add regression tests for concurrent stealth deposit/withdrawal and direct deposit collisions.
Acceptance criteria:
- Stealth withdrawal can never leave a stale stealth entry with non-zero balance.
- Concurrent operations preserve the invariant that total deposited value equals escrow plus stealth state.
- Tests cover identical and overlapping stealth operations.
Stealth entry handling can race with direct deposits or withdrawals, allowing balance mismatches or stealth entries to persist after a withdrawal due to inconsistent storage ordering.
Affected areas:
app/contract/contracts/Folder/src/stealth.rs,app/contract/contracts/Folder/src/storage.rs,app/contract/contracts/Folder/src/lib.rs,app/contract/contracts/Folder/src/test.rs.Implementation scope:
Acceptance criteria: