sdk: typed local-store helpers over the apply seam#630
Merged
Conversation
Expose the atomic batch verb on the seam: LocalStoreHost gains WriteOp and apply, whose default is an explicit per-op set/delete fallback for arbitrary impls such as mocks, and the WitBindgenHost adapter overrides it with the host's apply verb so a flushed batch is all-or-nothing on the real host. Add nexum_sdk::store with the #609 Wave 2 helpers: a WriteBatch builder flushed in one apply call, clear_prefix, borsh-typed TypedCell and TypedMap, and a u64 Counter, so module code hand-rolls neither serialization nor batching.
mfw78
force-pushed
the
feat/609-sdk-store
branch
from
July 25, 2026 10:58
664bc08 to
bb547d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
LocalStoreHostgainsWriteOpandapply, with a documented per-opset/deletedefault for arbitrary impls such as mocks; theWitBindgenHostadapter overrides it with the atomicnexum:host/local-store.applyverb landed in #611. A newnexum_sdk::storemodule layers typed helpers over the seam: aWriteBatchbuilder flushed in oneapplycall (an unflushed drop discards),clear_prefix, borsh-typedTypedCellandTypedMap(insert/get/remove/keys plus an atomicclear), and au64Countersafe under single-actor dispatch.Why
Wave 2 of #609 (ADR-0014 SDK ergonomics): the sanctioned atomicity scope is the opt-in batch verb, but without an SDK surface every module hand-rolls serialization and batching against raw
get/setbytes. The keeper Journal is untouched; its single-key markers stay on plainsetbecause they span the submit await and must never ride anapplybatch.Testing
nix develop --command just cigreen (rustfmt, clippy-D warnings, rustdoc, all module wasm builds, full workspace test suite including 9 new integration tests over the mock local store and a default-apply order test), plusjust check-venue-agnosticandjust check-cow-orderbook-onlyall PASS.AI Assistance
Implemented and verified with AI assistance.
Part of #609.