erigontech / erigontech/erigon
cl/epbs: support concurrent same-slot self-build envelopes
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 455
Description
## Problem
`ApiHandler.selfBuildEnvelopes` is keyed only by slot. Multiple block-production requests for the same slot can produce different beacon blocks, for example from DVT participants, retries with different inputs, or concurrent validator-client requests.
Each result may overwrite or remove the envelope cached by another same-slot request. A validator client can then receive an envelope for the wrong beacon block or get a 404 for a block whose envelope was produced successfully. PR #23583 prevents a stale self-build envelope from being served after an external bid wins, but a slot-only cache cannot make that update safe across concurrent proposals.
The existing validator endpoints also look up envelopes by `{slot}` or `{slot}/{builder_index}`, so changing only the internal key does not define which envelope should be returned when several block roots exist for the same slot.
## Desired behavior
Associate every cached self-build envelope with the proposal identity it belongs to and define deterministic lookup behavior for same-slot alternatives.
The design should:
- prevent one production request from overwriting or removing another request's envelope;
- bind a returned envelope to the correct beacon block root and execution payload;
- define how the slot-based validator endpoints behave when several proposal roots exist;
- support concurrent and DVT block-production requests;
- keep cache lifetime and memory use bounded;
- cover concurrent insertion, conditional removal, same-slot replacement, and lookup with regression tests.
Contributor guide
Assessment
This issue has not been assessed yet.