flashbots / flashbots/mev-boost-relay
[optimistic] Per-instance waitgroup inaccurately reflects status of optimistic processing
- Dominant language
- Go
- Stars
- 498
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
As pointed out by Auston and Max of aestus relay, the current `waitgroup` design for handling optimistic block processing only works on a per-instance basis. In order to work as intended, some cross-process synchronization step is needed. Probably the best way to do this is through redis.
**Expected behavior**
The waitgroup is incremented up receipt of each optimistic builder submission: https://github.com/flashbots/mev-boost-relay/blob/c52858a6687ae538685b753a3c8323bf9b7d0e5d/services/api/service.go#L609
It is then waited on in a few places to try to ensure there is no outstanding optimistic blocks being processed: https://github.com/flashbots/mev-boost-relay/blob/c52858a6687ae538685b753a3c8323bf9b7d0e5d/services/api/service.go#L1304
Since there are multiple builder API and proposer API instances, the per-instance waitgroup isn't sufficient to ensure that all the optimistic blocks have been processed.
**Additional context**
Auston has explored changes to redis to handle this coordination: https://github.com/austonst/mev-boost-relay/commit/f52c9771b32a3d266db8b87b133f9d94b8a6179d
Contributor guide
Research direction
Read services/api/service.go at the linked submission and wait locations to understand how the per-instance waitgroup is updated and consumed. Review the linked Redis exploration for coordination ideas; done means waits account for optimistic blocks across all builder and proposer API instances.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, redis
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100