fix(payments): Guard reserve headroom#561
Conversation
|
Reviewed as a coding agent. I think there’s a correctness blocker in the new The seller can now emit That creates a deadlock for large early requests:
This is different from the existing I’d suggest one of these fixes before merge:
Also worth adding a buyer+seller integration test for the low-spend large-request case ( I tried to run the targeted node tests, but this checkout is missing |
a124031 to
c9920c4
Compare
|
Addressed the low-spend large-request retry-loop blocker. The seller now only emits recoverable Added coverage for the low-spend/max-token case and re-ran:
|
Review verdictAPPROVE_WITH_NITS. Headroom math is correct, the deadlock blocker @kc-zero-lab flagged is properly resolved (seller now returns FindingsP2 — Worth addressing
P3 — Minor
Notes
Review assisted by Claude Code agent (@Augustas11). |
c9920c4 to
c12c0e7
Compare
c12c0e7 to
810edeb
Compare
|
Edit — redacting this: I got the version wrong. We weren't on 0.2.87 |
|
thanks, please share the full log. can find me on tg
…On Thu, 21 May 2026 at 22:50 Gekko.eth ***@***.***> wrote:
*Gekko-dot-ETH* left a comment (AntSeed/antseed#561)
<#561 (comment)>
We run a seller, hit this on mainnet with 0.2.87. Concrete case in case
it's
useful.
Channel 0xa97ce07e2d9de5c246a3dac4a73bada6e841759c7d0cb7ba345e8f09e794d114
:
on-chain deposit 1.000000 USDC, but the seller served 7.268571 cumulative
before the channel went idle. ~6.27 of compute the escrow can't cover on
close.
Seller log over ~3h:
- 7x Top-up verified, each ceiling 1000000 → N000000 (N=2..8).
Confirmed
reserve never left 1000000.
- ~740x Retrying deferred topUp. topUp() never confirmed once, every
attempt hit the 85% TopUpThresholdNotMet gate.
- 832x Budget updated, SpendingAuths accepted, cumulative climbing
0 → 7268571.
So not a single request slipping past the ceiling, but sustained serving
~7x
above confirmed reserve for hours while a topUp stayed permanently
deferred.
The #251 <#251> acceptance check
catches a direct over-deposit SpendingAuth, but with
a pendingTopUp that never clears the threshold gate, per-auth acceptance
keeps returning accepted while confirmed headroom is 0.
The 85%→65% gate change helps but doesn't fully close it: a buyer that
never
lets the gate clear still rides the deferred path. Might be worth checking
the
headroom guard here covers that case.
Can share full logs if useful.
—
Reply to this email directly, view it on GitHub
<#561 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNDKPRYQKD7QMJNHFEL273435TY7AVCNFSM6AAAAACZB35TNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKMJSGY2TOMRYGQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Description
Adds a seller-side preflight reserve headroom guard before provider routing so requests are not served when their minimum/estimated max cost cannot fit inside the confirmed on-chain reserve. Also adds a recoverable
reserve_headroom_requiredpayment code so buyers top up the existing channel and retry, and lowers the channel top-up settled threshold from 85% to 65%.This addresses the observed Diem case where the seller had 684445/1000000 settled/confirmed spend, a top-up failed at the previous 85% threshold, and the next request pushed cumulative spend beyond the confirmed reserve.
Release Notes
Types of Changes
Checklist