Repository navigation
Rehearse chain settlement end to end on the scripted chain - #384
Merged
Merged
Conversation
Add a rehearsal of the composed chain settlement path on real SQLite through the real payment handler and the scripted chain: a paid run credited and paid out exactly once with duplicate and mismatching receipts recorded; a lost response resolved by a verified lookup without a second broadcast; the dispatcher stopped after reserving a transfer and before submitting it, resubmitting the stored bytes once with the same digest; stopped after submitting and before recording, resolved after restart with one transfer in total; a failed refund never sent again while an owed one is sent once from its reserved row; the settlement pass delivering a credit once after the inline attempt failed, with duplicate terminal reports ignored; every drill repeated with the database closed and reopened after each step; and disabled mode refusing every chain action, including for leftover chain orders, while TEST flows are unchanged. Each drill asserts the exact rows of the payment tables and the backend call counts. No wallet, network or chain endpoint is involved. GitHub issue #87.
ctfbruce
marked this pull request as ready for review
October 5, 2026 10:21
Bring the payout and refund branch at its corrected head under the rehearsal drills, so that they run against the lifecycle as it will merge: the refund outcome returned to callers, bounded reconciliation lookups and the adapter's id validation. GitHub issue #87.
ctfbruce
marked this pull request as draft
October 5, 2026 12:10
The refund of an unadmitted intent now reports what became of the money besides its error, so the drills read that outcome: nothing transferred when chain payments are disabled, failed after a refund that was not broadcast, and sent once the next refund is confirmed. GitHub issue #87.
ctfbruce
marked this pull request as ready for review
October 5, 2026 13:30
Exercise settlement rehearsals alongside the current payment lifecycle, quote pricing, allowances and operator documentation. GitHub issue #87.
ctfbruce
marked this pull request as draft
October 5, 2026 14:03
ctfbruce
marked this pull request as ready for review
October 5, 2026 14:19
ctfbruce
marked this pull request as draft
October 5, 2026 14:57
ctfbruce
marked this pull request as ready for review
October 5, 2026 15:32
This was referenced Oct 5, 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.
Behaviour
Tests only:
internal/dispatcher/payments/rehearsal_test.gorehearses the composed chain settlement path (settlement ledger, receipts, transfers, adapter, payout and refund lifecycle) on real SQLite through the realPaymentHandlerin enabled mode, with the scripted chain the transfer tests already use. No production code changes; no wallet, network, chain endpoint or enablement.Proof
Eight drills, each asserting the final rows of
transactions,debuglet_order,order_settlements,earnings,chain_transfersandpayment_receiptsand the backend call counts:duplicate, a differing onemismatch; earnings arriving during the payout survive.unknown; a verified lookup confirms it without a second broadcast; an unverified success staysunknown.not broadcast) keeps the orderRefundedand the settlement row and is never sent again; a refund owed but never attempted is sent exactly once by the settlement pass, from its reserved row.payments_disabled, no receipt or transfer row is written, leftover chain orders stay as they are, TEST flows are unchanged.Deliberate faults in a throwaway copy (an unverified lookup recorded
confirmed; a lost response recordedfailed; resubmission only fromsent) each fail the drills that guard them. The payments, Sui, HTTP API and dispatcher packages pass under-racewith the drills.Upgrade
None. Stacked on #381, whose commits show in the diff against
mainuntil it merges.Limits
The drills run against the scripted chain and local fixtures only; no live-network test has been run, and enabling chain payments remains the operator's explicit step described in
docs/operations/payments.md. The drills established three product limits, recorded on #381: a transfer whose stored bytes the chain no longer knows is resubmitted on every reconciliation pass without a bound; an invalid refund address is detected at the refund, not at intent creation; a failed refund has no re-attempt path.GitHub issue #87.
Candidate CI
The branch then took the corrected payout branch by merge (ed84410) and asserts the refund outcome it now reports (f558a5a); Run 37310404192 on f558a5a: 16 of 16 lanes and
requiredsucceeded. Run 37294915212 on c649c42: 16 of 16 lanes andrequiredsucceeded.