Repository navigation
*: fix cache cpu load - #4295
Conversation
… proposer duties cache
There was a problem hiding this comment.
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.DisableDutiesCachebranching to optionally bypass duties cache and call upstream BN duties endpoints directly. - Refactor
eth2wrap.DutiesCacheinternal storage/locking and removeUpdateCacheIndicesplumbing. - 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 Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4295 +/- ##
==========================================
- Coverage 56.61% 56.52% -0.09%
==========================================
Files 237 237
Lines 31360 31471 +111
==========================================
+ Hits 17753 17789 +36
- Misses 11333 11397 +64
- Partials 2274 2285 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



We have experienced CPU spikes with the new cache logic, even when turning on the
disable_duties_cachefeature flag.The fix was to include the metadata of the BN request to the response to the VC. However, I've used the occasion to rework and improve other parts of the cache (and not only):
category: bug
ticket: #4009