Skip to content

Select highest-value bid in timing games, not most recent#904

Open
Danieldd28 wants to merge 1 commit into
flashbots:developfrom
Danieldd28:fix/timing-games-select-highest-bid
Open

Select highest-value bid in timing games, not most recent#904
Danieldd28 wants to merge 1 commit into
flashbots:developfrom
Danieldd28:fix/timing-games-select-highest-bid

Conversation

@Danieldd28

Copy link
Copy Markdown

Summary

When timing games are enabled for a relay, handleTimingGamesGetHeader sends multiple getHeader requests over the course of the slot and picks the bid to use. Currently it picks the most recently received bid from that relay. This PR changes it to pick the highest-value bid received from that relay, with recency only used as a tiebreaker for equal values.

Motivation and Context

The relay's current best bid is not guaranteed to be monotonically increasing across polls within the same slot. A builder can cancel a previously leading bid, or a different builder can briefly be in the lead between polls. If the last poll happens to return a lower value than an earlier one, mev-boost currently discards the higher bid it already received and signed for, even though nothing requires that.

This gets more costly as bidding margins compress, see https://collective.flashbots.net/t/4734: median winning bid duration at Ultrasound dropped from over 80ms to 20ms, and the median competitive bid increment dropped from 0.47% to 0.09%. With margins and time windows that thin, discarding an already received higher bid for a lower one is a direct, avoidable loss to the proposer.

Before / after

Example: a relay's bid value across 3 timing games polls is 0.5 ETH, then 1.5 ETH, then 0.5 ETH (last poll regresses, e.g. due to a cancellation).

Before: returns 0.5 ETH, the bid from the last poll by timestamp.
After: returns 1.5 ETH, the highest value seen across all polls.

Also updated docs/timing-games.md to describe the new selection criteria.

References

https://collective.flashbots.net/t/4734 (margin compression context)
https://collective.flashbots.net/t/491 (unrealized value in mev-boost)


I have run these commands

  • make lint
  • make test-race
  • go mod tidy

handleTimingGamesGetHeader picked the most recently received bid from
a relay's multiple polls. A relay's best bid is not guaranteed to be
monotonically increasing within a slot (e.g. bid cancellation, a
different builder briefly leading), so a later lower-value poll could
displace an earlier higher one. Pick by value instead, with recency
only as a tiebreaker.
Copilot AI review requested due to automatic review settings June 21, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates mev-boost’s timing-games relay polling logic so that, within a single relay, the selected getHeader result is the highest-value bid observed across all polls (with recency used only as a tie-breaker), rather than always selecting the most recently received bid. This aligns timing-games behavior with the proposer’s objective (maximize bid value) even when relay responses are non-monotonic within a slot.

Changes:

  • Change timing-games per-relay selection from “latest received” to “highest value” (ties broken by timestamp).
  • Add a regression test ensuring an earlier higher bid is not displaced by a later lower bid.
  • Update timing-games documentation to reflect the new selection criteria.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
server/get_header.go Stores bid value per poll and selects the highest-value bid (recency tiebreak) instead of the latest bid.
server/service_test.go Adds test coverage for non-monotonic bid sequences across timing-games polls.
docs/timing-games.md Updates diagram/text to describe highest-value (recency tiebreak) selection within a relay.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/get_header.go
Comment on lines +294 to +295
if bestBid == nil || br.value.Cmp(bestValue) > 0 ||
(br.value.Cmp(bestValue) == 0 && br.timestamp.After(bestTime)) {
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