Repository navigation
Description
Summary
The two LedgerBackend implementations disagree on a linked chain whose first leg is an idempotent resubmission (Exists) and whose later legs are new:
InMemoryLedger(pkgs/id/src/currency_poc/ledger.rs,validate_and_stage+create_transfers): anExistsleg is treated as non-failing — "An idempotentExistsleg does not fail the chain" — so the remaining new legs stage, commit, and move balances, reportedOk(()).- Real TigerBeetle breaks a linked chain on any non-
Createdstatus. That is the repo's own documented semantics inpkgs/id/src/currency_poc/tb_ledger.rs(create_transfers, the PR feat(id/currency_poc): bind LedgerBackend to the official TigerBeetle Rust client (#2289) #5072 linked-chain-retry comment): a resubmitted chain reportsExistsfor its first leg andLinkedEventFailedfor every later leg. The binding compensates only for the whole-chain-already-posted pattern (it verifies every stored leg is identical before rewriting the later legs toExists). A mixed chain — first legExists, later legs genuinely new — is not compensated: on the live backend those new legs reportLinkedEventFailedand nothing new posts.
So the same create_transfers call posts money on the in-memory reference backend and posts nothing on TigerBeetle. The executor layer cannot paper over this: executor::submit and the recovery scanner both accept per-leg Err(Exists) as success, so code tested green against InMemoryLedger for a mixed-chain resubmission silently behaves differently against the live cluster.
Evidence (verified this run, laptop probe @ 231eb9c)
Probe: ~/git/fleet/probe-linked-exists on the laptop — a crate against the real id crate (pkgs/id), InMemoryLedger, all accounts on ledger 100, issuer-funded:
chain1 [601,602](601: user→LP 100,linked=true; 602: LP→dest 100):[Ok(()), Ok(())]— balances user{debits 100, credits 1000}, LP{100, 100}, dest{0, 100}.- Mixed chain
[601 identical, 603, 604](603: LP→user 50,linked=true; 604: user→dest 50):[Err(Exists), Ok(()), Ok(())]—lookup_transfer(603) = Some((603, 50)),lookup_transfer(604) = Some((604, 50)), balances move to user{150, 1050}, LP{150, 100}, dest{0, 150}. The new legs posted behind anExistshead leg. - Control — whole-chain identical resubmit of chain1:
[Err(Exists), Err(Exists)], balances unchanged. The divergence is specifically the mixed shape, not idempotent resubmission in general.
TigerBeetle-side evidence is in-repo and already pinned by live tests: tb_ledger.rs documents the chain-break on any non-Created status, and tests.rs (live_same_request_twice_posts_once, ~line 1653) records that TigerBeetle reports Exists + LinkedEventFailed for a resubmitted chain — the pattern the binding must translate. No equivalent translation exists for InMemoryLedger, because it never produces it.
Why it matters
InMemoryLedger is the reference oracle every currency_poc scenario test runs against in CI (the live-TB tests are #[ignore]d). A parity gap here means the test suite can certify executor/recovery behavior — e.g. a resubmission path that reuses an already-posted leg ID alongside new legs — that the real backend rejects atomically. That is exactly the class of divergence #6150 (failed-ID memory) and #6135 (ID validity) already filed for this backend; this is the linked-chain member of the same family, and it is not covered by either (nor by #4669's short-result-vector issue or #6108's tb_ledger status-mapper panics).
Acceptance criteria
- The two backends agree on the mixed chain
[Exists leg, new leg, ...]: eitherInMemoryLedgerfails the new legs withLinkedEventFailedand posts nothing (matching TigerBeetle + the tb_ledger compensation contract), or the trait contract inledger.rsis amended to state theExists-leg semantics explicitly and the tb_ledger binding is extended to implement them — with the decision recorded on this issue - A pinning test in
pkgs/id/src/currency_poc/tests.rscovers the mixed chain onInMemoryLedger(first leg byte-identical to a posted transfer, later legs new): result vector,lookup_transferfor the new legs, and balances all match the chosen semantics - The whole-chain identical-resubmit control stays all-
Existsand moves nothing on both backends -
cargo test -p id currency_pocpasses
Related
- id(currency_poc): InMemoryLedger forgets failed transfer IDs — a failed transfer resubmits and posts after funding, real TigerBeetle refuses it forever (IdAlreadyFailed) #6150 — InMemoryLedger forgets failed transfer IDs (sibling parity gap)
- id(currency_poc): InMemoryLedger accepts and posts zero / int-max account and transfer IDs real TigerBeetle refuses — the reference backend is a broken oracle for ID validity #6135 — InMemoryLedger accepts zero/int-max IDs TigerBeetle refuses (sibling parity gap)
- id(currency_poc/tb_ledger): status mappers panic on unmodelled-but-ordinary TigerBeetle statuses (zero/int-max IDs, closed accounts) the in-memory backend accepts #6108 — tb_ledger status mappers panic on unmodelled statuses
- id(currency_poc): executor submit() and recovery resubmission treat a short create_transfers result vector as success — a backend returning no results marks the conversion Posted with nothing in the ledger #4669 — submit()/recovery treat a short result vector as success
Activity
developing-today commentedon Nov 5, 2026
CODE-1789
dezren39 commentedon Nov 5, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 5, 2026
🤖 Agent note · picked up
InMemoryLedgermatches TigerBeetle. TigerBeetle is the live backend and its chain-break semantics are fixed by the real system: a linked chain breaks on ANY non-Createdleg, so a mixed chain[Exists leg, new leg, ...]posts nothing and its new legs reportLinkedEventFailed. The reference backend must mirror the live one, not the reverse. The trait-surface contract is the onetb_ledger.rsalready implements (PR feat(id/currency_poc): bind LedgerBackend to the official TigerBeetle Rust client (#2289) #5072): raw TigerBeetle reports[Exists, LinkedEventFailed, ...]for a resubmitted chain, and the binding compensates ONLY the whole-chain-identical-resubmit pattern back to per-legExistsafter verifying every stored leg. SoInMemoryLedgerwill: (1) fail a mixed chain atomically — the Exists leg reportsExists, every other legLinkedEventFailed, nothing posts, no balances move; (2) keep the whole-chain identical resubmit at per-legExistswith nothing moving (the compensated surface both backends present). Thecreate_transferstrait doc inledger.rswill state these Exists-leg semantics explicitly.ledger.rschange and a pinning test intests.rscovering the mixed chain (result vector,lookup_transferfor the new legs, balances) plus the whole-chain resubmit control;cargo test -p id currency_pocgreen.3 remaining items
Merge pull request #6175 from developing-today/queue/9958-6170-linked…
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done