Skip to content

*: fix cache cpu load#4295

Draft
KaloyanTanev wants to merge 51 commits intomainfrom
kalo/fix-cache-cpu-load
Draft

*: fix cache cpu load#4295
KaloyanTanev wants to merge 51 commits intomainfrom
kalo/fix-cache-cpu-load

Conversation

@KaloyanTanev
Copy link
Collaborator

WIP

category: bug
ticket: #4009

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a duties caching refactor intended to reduce duplicate BN duties requests (issue #4009) and CPU/load by consolidating duties caching behavior behind eth2wrap.DutiesCache, with a safety feature flag to disable caching.

Changes:

  • Add featureset.DisableDutiesCache branching to optionally bypass duties cache and call upstream BN duties endpoints directly.
  • Refactor eth2wrap.DutiesCache internal storage/locking and remove UpdateCacheIndices plumbing.
  • Update scheduler/tracker/validatorapi call sites and wiring to match the new cache behavior and feature-flag gating.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
core/validatorapi/validatorapi.go Adds feature-flag branch for duties cache usage and adjusts duty pubkey substitution.
core/tracker/inclusion.go Skips inclusion checks when feature is disabled; adds feature-flag branch for attester duties cache usage.
core/scheduler/scheduler.go Adds feature-flag branch to use cached vs upstream duties calls for attester/proposer/sync duties.
app/vmock.go Updates duties cache constructor usage to new signature.
app/featureset/featureset.go Switches feature state guard to RWMutex and uses read locks for readers.
app/eth2wrap/multi_test.go Removes tests for UpdateCacheIndices forwarding.
app/eth2wrap/multi.go Removes UpdateCacheIndices forwarding implementation.
app/eth2wrap/lazy_test.go Removes tests for UpdateCacheIndices forwarding.
app/eth2wrap/lazy.go Removes UpdateCacheIndices forwarding implementation.
app/eth2wrap/httpwrap.go Splits cache locking into separate mutexes for validator and duties caches; removes no-op UpdateCacheIndices.
app/eth2wrap/cache_test.go Updates duties cache constructor usage to new signature.
app/eth2wrap/cache.go Major refactor of duties cache storage/locking and cache trim/invalidation behavior.
app/app.go Wires duties cache only when enabled; removes UpdateCacheIndices update path; trims duties cache on epoch boundary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 33.78378% with 196 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.60%. Comparing base (bfc2739) to head (51b9c3f).

Files with missing lines Patch % Lines
app/eth2wrap/cache.go 33.33% 104 Missing and 4 partials ⚠️
core/validatorapi/validatorapi.go 55.55% 18 Missing and 6 partials ⚠️
core/scheduler/scheduler.go 42.42% 14 Missing and 5 partials ⚠️
app/eth2wrap/httpwrap.go 0.00% 18 Missing ⚠️
core/tracker/inclusion.go 0.00% 14 Missing ⚠️
app/app.go 0.00% 10 Missing ⚠️
app/featureset/featureset.go 50.00% 2 Missing ⚠️
app/vmock.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4295      +/-   ##
==========================================
- Coverage   56.61%   56.60%   -0.01%     
==========================================
  Files         237      237              
  Lines       31360    31446      +86     
==========================================
+ Hits        17753    17799      +46     
- Misses      11333    11370      +37     
- Partials     2274     2277       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

KaloyanTanev and others added 3 commits February 6, 2026 19:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: kalo <24719519+KaloyanTanev@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: kalo <24719519+KaloyanTanev@users.noreply.github.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

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.

1 participant