You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: Use copy-on-write in driver.set to avoid ghost updates
Summary
driver.set stores mutable values by reference in pending_writes/transaction_writes, so later in-place mutations by callers change the write intent and can leak stale/mutated data.
Problem
95:100:xian-contracting/src/contracting/storage/driver.py
if type(value) in [decimal.Decimal, float]:
value = ContractingDecimal(str(value))
self.pending_writes[key] = value
if is_txn_write:
self.transaction_writes[key] = value
No defensive copy for dict/list.
Proposed Fix
Deepcopy mutable inputs (dict/list) in driver.set before storing.
Optionally store an immutable snapshot for transaction_writes used in API outputs.
Acceptance Criteria
Mutating the original dict after set() does not affect what is committed or reported as writes.
Unit tests demonstrate isolation of write intent from later mutations.
Title: Use copy-on-write in driver.set to avoid ghost updates
Summary
Problem
Proposed Fix
Acceptance Criteria