Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caplin: fixed remote DOS #13482

Merged
merged 2 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions cl/phase1/network/services/sync_committee_messages_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ func (s *syncCommitteeMessagesService) ProcessMessage(ctx context.Context, subne
F: func() {
s.seenSyncCommitteeMessages.Store(seenSyncCommitteeMessageIdentifier, struct{}{})
s.cleanupOldSyncCommitteeMessages() // cleanup old messages
// Aggregate the message
s.syncContributionPool.AddSyncCommitteeMessage(headState, *subnet, msg.SyncCommitteeMessage)
// ImmediateVerification is sequential so using the headState directly is safe
if msg.ImmediateVerification {
s.syncContributionPool.AddSyncCommitteeMessage(headState, *subnet, msg.SyncCommitteeMessage)
} else {
// ImmediateVerification=false is parallel so using the headState directly is unsafe
s.syncedDataManager.ViewHeadState(func(headState *state.CachingBeaconState) error {
return s.syncContributionPool.AddSyncCommitteeMessage(headState, *subnet, msg.SyncCommitteeMessage)
})
}
},
}

Expand Down
6 changes: 6 additions & 0 deletions cl/sentinel/handlers/blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ func (c *ConsensusHandlers) blobsSidecarsByRangeHandler(s network.Stream, versio
defer tx.Rollback()

written := 0
maxIter := 32
currIter := 0
for slot := req.StartSlot; slot < req.StartSlot+req.Count; slot++ {
if currIter >= maxIter {
break
}
currIter++
Giulio2002 marked this conversation as resolved.
Show resolved Hide resolved
blockRoot, err := beacon_indicies.ReadCanonicalBlockRoot(tx, slot)
if err != nil {
return err
Expand Down
Loading