CAS-append with early chain checks: head match, then ph and sq
must chain onto the current state — a cheap fail-closed defense
before the caller's verify (F-rc3-2 keeps the tail hash O(1)).
The JournalHead the caller observed.
The event to append.
PactError FORK_DETECTED @ store when the head has
moved since observation or the event does not chain onto it.
All events in order.
A snapshot array — mutating it does not affect the store.
JournalHead — evHash of the last event, ZERO32 when empty.
The current head hash.
In-memory JournalStore: CAS-append with early chain checks (ph/sq must chain onto the current head — cheap fail-closed defense before the caller's verify), snapshot reads. The tail evHash is maintained incrementally (F-rc3-2) — O(1) per append instead of re-deriving it from the last event on every call.
Example