Skip to content

fix(shrex/peers): bound blacklisted hashes with an LRU cache#5058

Open
neyy91 wants to merge 1 commit into
celestiaorg:mainfrom
neyy91:fix/peer-manager-blacklist-lru
Open

fix(shrex/peers): bound blacklisted hashes with an LRU cache#5058
neyy91 wants to merge 1 commit into
celestiaorg:mainfrom
neyy91:fix/peer-manager-blacklist-lru

Conversation

@neyy91

@neyy91 neyy91 commented Jun 13, 2026

Copy link
Copy Markdown

Overview

The peer manager stored blacklisted datahashes in a plain map[string]bool that was never pruned, so it grew for the entire lifetime of a node. A peer broadcasting shrexsub notifications with arbitrary invalid datahashes (the only gates in Validate are the blacklist checks and a height floor — neither stops new unique hashes) could drive unbounded memory growth.

Replace the map with a fixed-size LRU cache (hashicorp/golang-lru/v2, already a dependency). The blacklist is a best-effort spam filter, so evicting the least-recently-used entries is acceptable.

Adds a regression test asserting the cache stays bounded after inserting far more than its capacity.

Closes #1926

The peer manager stored blacklisted datahashes in a plain map that was never
pruned, so it grew for the entire lifetime of a node. A peer broadcasting
shrexsub notifications with arbitrary invalid datahashes could drive unbounded
memory growth.

Replace the map with a fixed-size LRU cache. The blacklist is a best-effort
spam filter, so evicting the least-recently-used entries is acceptable.

Closes celestiaorg#1926
@neyy91 neyy91 requested a review from a team as a code owner June 13, 2026 11:38
@neyy91 neyy91 requested a review from vgonkivs June 13, 2026 11:38
@github-actions github-actions Bot added the external Issues created by non node team members label Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Issues created by non node team members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(share/p2p/peer-manager): use LRU cache for peer-manager blacklisted hashes

1 participant