Skip to content

Remove redundant enclosing lock from SyncCommitteeHeadStateCache - #19

Open
syjn99 wants to merge 1 commit into
developfrom
fix/remove-lru-lock-sync-committee-head-state
Open

Remove redundant enclosing lock from SyncCommitteeHeadStateCache#19
syjn99 wants to merge 1 commit into
developfrom
fix/remove-lru-lock-sync-committee-head-state

Conversation

@syjn99

@syjn99 syjn99 commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove redundant sync.RWMutex from SyncCommitteeHeadStateCache struct in beacon-chain/cache/sync_committee_head_state.go
  • The underlying lru.Cache (hashicorp/golang-lru) already provides internal thread-safe locking, making the external lock unnecessary overhead
  • Removed lock field, all Lock()/Unlock()/RLock()/RUnlock() calls from Put() and Get(), and unused sync import

Fixes OffchainLabs#13723

Test plan

  • gofmt and goimports pass
  • Gazelle BUILD sync — no changes needed
  • bazel build //beacon-chain/cache/... passes
  • bazel test //beacon-chain/cache/... — 2/2 tests pass, no new failures vs baseline

🤖 Generated with Claude Code

The SyncCommitteeHeadStateCache wraps lru.Cache which already has
internal locking. The external sync.RWMutex is redundant and adds
unnecessary overhead. Remove the lock field and all Lock/Unlock/
RLock/RUnlock calls from Put() and Get().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Remove enclosing locks from lru caches

1 participant