Repository navigation
fix(canton): require confirmed funds before settle success - #32
Closed
PhilBot402 wants to merge 1 commit into
Closed
PhilBot402 wants to merge 1 commit into
PhilBot402 wants to merge 1 commit into
Conversation
Success is returned only when the funds-moved read proves delivery. A timeout or unreadable confirmation returns settlement_pending so core can retry settle once; that retry re-reads the same submission and then succeeds or fails terminally. Co-authored-by: PhilBot <PhilBot402@users.noreply.github.com>
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.
Description
Canton
settlewas returningsuccess: truewhen/executehad committed but the funds-moved read was inconclusive. Success now requires a read that proves funds moved, the same bar as other networks.A timeout, transport error, 5xx, or unreadable confirmation returns non-terminal
settlement_pendingwith a non-emptytransaction(theupdateId, or the submission id when the update id is not known yet).@x402/coreretriessettleonce with the same payload. That retry re-reads the same submission and does not relay again. It returns success only if funds moved. A still-unreadable read is terminalunexpected_canton_ledger_error. A read that shows the transfer did not deliver isinvalid_exact_canton_execute_failed.There is no further retry and no replay cache. The in-memory entry exists only so that one retry can re-read; it is dropped on the retry, and a later settle relays again. The ledger still rejects a replay once the input holdings are spent.
Sits on upstream PR 3242 head
48f6414c(Denend:feat/mechanisms-canton).Tests
pnpm exec tsc --noEmitintypescript/packages/mechanisms/cantonpnpm exec vitest run(103 tests) andpnpm exec vitest run --config vitest.integration.config.ts(5 tests)test/unit/settle.test.ts: success only on a proven transfer; pending then one confirm; terminal failure if the re-read is still unreadable; a later settle relays again; unknown execute with a submission id is pending, without an id is terminalChecklist
AI disclosure: automated by @phdargen. Use your own judgement.