keeper: add reserve/commit/mark journal primitives - #583
Merged
Conversation
mfw78
force-pushed
the
sdk/538-journal-reserve-api
branch
from
July 24, 2026 09:33
c9f4a69 to
a401cfa
Compare
This was referenced Jul 24, 2026
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
Add the durable journal primitives to
nexum-sdk'sJournal:reserve,park,commit,release,mark,reserved, plus theMarkandReservationtypes. Marker values are tag-first so a reservation and a commit can never collide by presence:RESERVED = [0x01] ++ be64(next_eligible_epoch_s) ++ body,COMMITTED = [0x02], and a legacy empty marker reads as committed for back-compat.markclassifies by value: absent isNone, empty or a leading0x02isCommitted, and any other first byte (including a corrupt tag) isReserved, so an unreadable marker forces a later reconcile rather than a skip.reservedenumerates exactly that Reserved set with each body and backoff.This PR is dormant: it adds the primitives and retains
record/containsfor the observe path, and changes no sweep. The sweeps adopt these in the follow-up that also adds the reconcile pass, so a reserve write is never shipped without the scan that resolves it.Why
The submit-dedup journal needs to distinguish an in-flight reservation from a settled receipt to close the post-submit-fault duplicate window without introducing a silent drop.
containscannot, since presence alone conflates the two.markreads the value; its rustdoc now warns thatcontainsmust not guard a reserve/commit journal.Testing
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features --locked -D warnings, all 17 guest wasms,cargo nextest run --workspace --all-features --locked(the new L1 unit tests:markdistinguishes reserved/committed/absent/legacy-empty/corrupt-tag; themark/reservedagreement invariant; reserve/commit/release/park round-trips),cargo test --doc,RUSTDOCFLAGS=-D warnings cargo doc --workspace --no-deps --locked,scripts/check-venue-agnostic.sh,scripts/check-cow-orderbook-only.sh.AI Assistance
Implemented with Claude Code.
Closes #538