Skip to content

feat(bidding): add pending-bid ledger - #239

Merged
Farhad-Shabani merged 1 commit into
mainfrom
farhad/bidding-pending-ledger
Jul 23, 2026
Merged

feat(bidding): add pending-bid ledger#239
Farhad-Shabani merged 1 commit into
mainfrom
farhad/bidding-pending-ledger

Conversation

@Farhad-Shabani

@Farhad-Shabani Farhad-Shabani commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Why

There's a blind spot between "we bid" and "we won": the auction takes ~15s to settle, but the bidder rebuilds its committed load every 3s from assigned requests only. So for a few passes it completely forgets what it just promised and happily bids again. We hit this for real on sepolia — threw 8 requests at it, and the tail ones got admitted way past capacity and blew their deadlines.

How

The bidder now keeps a little ledger of its outstanding promises (PendingBids in spn-bidding, right next to EstimateCache which works the same way):

  • When admission says yes, the request goes into the ledger with its expected gas, right before the bid goes out.
  • At the start of every pass, the ledger gets reconciled with reality: if the request shows up as assigned, we won and it's counted normally, so the entry drops. If it's biddable again, our bid never stuck — drop it and re-decide. If it expired, we lost the auction. Whatever's left still counts as committed load.
  • Expiry is per entry: min_auction_period plus 15s of slack for the auctioneer tick and our next poll, capped at 60s. The slack errs on the late side on purpose — expiring early would double-promise an auction we actually won, which is the exact bug we're fixing. Worst case, a lost auction holds some headroom for one auction cycle.

@Farhad-Shabani
Farhad-Shabani merged commit 96be7d2 into main Jul 23, 2026
6 checks passed
@Farhad-Shabani
Farhad-Shabani deleted the farhad/bidding-pending-ledger branch July 23, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants