P0-S2b: Merkle adapter + transaction overlay and commit
Background
We need persistence to a Merkle-backed KV so contract writes survive across executions and produce deterministic state roots.
Goal
Implement a minimal backend adapter and per-execution overlay with deterministic batch commit.
Design
- Backend adapter:
get/put/del/commit(batch)->root with path-to-key mapping (e.g., home:contract:data.txt).
- Overlay: execution-scoped map for writes/deletes/renames; reads check overlay first.
- Commit: on success, commit sorted batch (lexicographic by key) and expose pre/post roots; on failure, discard overlay.
Constraints
- Deterministic ordering and results across nodes; no clocks/randomness.
- Directory listing must not depend on KV range scans in P0; rely on logical directory markers.
Acceptance Criteria
- Writes are visible to subsequent executions; state root changed deterministically.
- Unit tests cover commit ordering and rollback on failure.
References
P0-S2b: Merkle adapter + transaction overlay and commit
Background
We need persistence to a Merkle-backed KV so contract writes survive across executions and produce deterministic state roots.
Goal
Implement a minimal backend adapter and per-execution overlay with deterministic batch commit.
Design
get/put/del/commit(batch)->rootwith path-to-key mapping (e.g.,home:contract:data.txt).Constraints
Acceptance Criteria
References