Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions services/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ func (api *RelayAPI) processPayloadAttributes(payloadAttributes beaconclient.Pay
defer api.payloadAttributesLock.Unlock()

// Step 1: clean up old ones
for parentBlockHash, attr := range api.payloadAttributes {
for key, attr := range api.payloadAttributes {
if attr.slot < apiHeadSlot {
delete(api.payloadAttributes, getPayloadAttributesKey(parentBlockHash, attr.slot))
delete(api.payloadAttributes, key)
}
Comment on lines 803 to 807
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

Consider adding a regression test that exercises the cleanup path in processPayloadAttributes (i.e., seed api.payloadAttributes with an entry whose slot is < headSlot and verify it is removed). This change fixes a key-construction bug that would be easy to reintroduce without a focused test.

Copilot uses AI. Check for mistakes.
}

Expand Down Expand Up @@ -2250,12 +2250,14 @@ func (api *RelayAPI) handleSubmitNewBlock(w http.ResponseWriter, req *http.Reque
pf.IsGzip = isGzip
log = log.WithField("reqIsGzip", isGzip)
if isGzip {
r, err = gzip.NewReader(req.Body)
gzipReader, err := gzip.NewReader(req.Body)
if err != nil {
log.WithError(err).Warn("could not create gzip reader")
api.RespondError(w, http.StatusBadRequest, err.Error())
return
}
defer gzipReader.Close() //nolint:errcheck
r = gzipReader
}

limitReader := io.LimitReader(r, int64(apiMaxPayloadBytes))
Expand Down