Repository navigation
id(currency_poc): break linked chains on Exists legs in InMemoryLedger (#6170) - #6175
Merged
Merged
Conversation
#6170) TigerBeetle breaks a linked chain on ANY non-Created status, so a mixed chain whose head leg is an idempotent Exists resubmission and whose later legs are new posts nothing on the live backend - while InMemoryLedger staged and committed the new legs and moved balances. Scenario tests green against the reference backend therefore certified behavior the live backend rejects. Option A (recorded on #6170): InMemoryLedger now matches TigerBeetle. A mixed chain posts nothing: the Exists leg reports Exists, every other leg LinkedEventFailed, no balances move. The whole-chain identical resubmission stays per-leg Exists and moves nothing - the surface the tb_ledger binding presents after verifying every stored leg (PR #5072 compensation contract). An earlier Exists leg also wins over a later hard failure, matching chain-order evaluation. The create_transfers trait doc now states the Exists-leg semantics explicitly. Pinning test linked_chain_with_exists_head_leg_posts_nothing_new covers the mixed chain (result vector, lookup_transfer for the new legs, balances) plus the whole-chain resubmit control; it failed before the change with [Exists, Ok, Ok] and passes after. cargo test -p id currency_poc: 48 passed. Full id lib suite: 2249 passed, 0 failed.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
4 tasks
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.
Summary
Fixes the linked-chain
Exists-leg parity gap betweenInMemoryLedgerand TigerBeetle — task 9958 / issue #6170.Decision (Option A, recorded on #6170):
InMemoryLedgermatches TigerBeetle. TigerBeetle is the live backend and breaks a linked chain on ANY non-Createdstatus; the reference backend must mirror the live one, not the reverse. The trait surface is the onetb_ledger.rsalready presents under its PR #5072 compensation contract.Change (
pkgs/id/src/currency_poc/ledger.rs)Existsleg together with new legs) now posts nothing: theExistsleg reportsErr(Exists), every other leg reportsErr(LinkedEventFailed), and no balances move. Previously the new legs staged, committed, and moved balances ([Exists, Ok, Ok]).Err(Exists)and moves nothing — the compensated surface both backends present.Existsleg precedes a hard validation failure in chain order, theExistsleg is the chain breaker (TigerBeetle's in-order evaluation); a hard failure before anyExistsleg behaves exactly as before.create_transferstrait doc now states theExists-leg semantics explicitly, so a future production binding implements the same rule.Tests
linked_chain_with_exists_head_leg_posts_nothing_newintests.rs: mixed chain result vector,lookup_transferfor the new legs (None), and unchanged balances, plus the whole-chain identical-resubmit control (all-Exists, nothing moves).tb_ledger.rs(PR feat(id/currency_poc): bind LedgerBackend to the official TigerBeetle Rust client (#2289) #5072) — the live backend's recorded behavior is the reference the in-memory backend is checked against.[Err(Exists), Ok(()), Ok(())]; after, it passes.cargo test -p id currency_poc(laptop): 48 passed, 0 failed (1 ignored live-TB test).cargo test -p id --lib(laptop): 2249 passed, 0 failed, 6 ignored.rustfmt --checkclean on both changed files.Closes #6170
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.