Skip to content

fix: add default case to handleHaves select to prevent reactor halt (backport #2813)#2941

Merged
ninabarbakadze merged 2 commits intov0.39.x-celestiafrom
mergify/bp/v0.39.x-celestia/pr-2813
Apr 17, 2026
Merged

fix: add default case to handleHaves select to prevent reactor halt (backport #2813)#2941
ninabarbakadze merged 2 commits intov0.39.x-celestiafrom
mergify/bp/v0.39.x-celestia/pr-2813

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Apr 16, 2026

Summary

  • Add a default case to the select statement in handleHaves (consensus/propagation/have_wants.go) so that when the per-peer receivedHaves channel is full, the message is dropped instead of blocking the propagation reactor's single message-processing goroutine.
  • This matches the existing non-blocking pattern already used in handleRecoveryPart in the same file.
  • Add a regression test TestHandleHavesDoesNotBlock that fills the channel to capacity and asserts handleHaves returns promptly.

Test plan

  • go test -v -run TestHandleHavesDoesNotBlock -count=1 ./consensus/propagation/ passes
  • Full go test ./consensus/propagation/... passes

Closes CELESTIA-185

🤖 Generated with Claude Code


This is an automatic backport of pull request #2813 done by Mergify.


Open with Devin

…2813)

## Summary
- Add a `default` case to the `select` statement in `handleHaves`
(`consensus/propagation/have_wants.go`) so that when the per-peer
`receivedHaves` channel is full, the message is dropped instead of
blocking the propagation reactor's single message-processing goroutine.
- This matches the existing non-blocking pattern already used in
`handleRecoveryPart` in the same file.
- Add a regression test `TestHandleHavesDoesNotBlock` that fills the
channel to capacity and asserts `handleHaves` returns promptly.

## Test plan
- [x] `go test -v -run TestHandleHavesDoesNotBlock -count=1
./consensus/propagation/` passes
- [x] Full `go test ./consensus/propagation/...` passes

Closes CELESTIA-185

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit bd5fa67)
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

index: uint32(index),
}:
p.RequestsReady()
default:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Missing required changelog entry for this bug fix PR

Both CLAUDE.md and CONTRIBUTING.md require every PR to include a changelog entry at .changelog/unreleased/{category}/{issue-or-pr-number}-{description}.md. This PR (a bug fix adding a default case to prevent reactor blocking) does not include a changelog entry under .changelog/unreleased/bug-fixes/. The commit message references PR #2813, so a file like .changelog/unreleased/bug-fixes/2813-prevent-handlehaves-reactor-halt.md is expected.

Prompt for agents
The repository rules in CLAUDE.md and CONTRIBUTING.md both require a changelog entry for every PR. This is a bug fix, so a file should be created at .changelog/unreleased/bug-fixes/2813-prevent-handlehaves-reactor-halt.md (or using the PR number 2941). The file should contain a description like:

- [consensus/propagation] \#2813 Add default case to handleHaves select to prevent a malicious peer from blocking the propagation reactor's message-processing goroutine (@contributor)

See existing examples in .changelog/unreleased/ for formatting guidance.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@ninabarbakadze ninabarbakadze merged commit 1226865 into v0.39.x-celestia Apr 17, 2026
22 checks passed
@ninabarbakadze ninabarbakadze deleted the mergify/bp/v0.39.x-celestia/pr-2813 branch April 17, 2026 10:36
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