Skip to content

fix(engine-bridge): bound ChainStateCache growth with LRU eviction - #171

Merged
N-thnI merged 1 commit into
Vero-protocol:mainfrom
michaelvic123:fix/chain-state-cache-max-entries-lru
Jul 29, 2026
Merged

fix(engine-bridge): bound ChainStateCache growth with LRU eviction#171
N-thnI merged 1 commit into
Vero-protocol:mainfrom
michaelvic123:fix/chain-state-cache-max-entries-lru

Conversation

@michaelvic123

Copy link
Copy Markdown
Contributor

Summary

  • Added maxEntries constructor parameter to ChainStateCache (default Infinity for backward compatibility)
  • Implemented LRU eviction: touch() marks keys as recently used on access; evictIfNeeded() drops oldest entries when size exceeds the bound
  • Added clear() method
  • 7 new tests covering capped size, LRU order, no-op under limit, SWR behavior, stale revalidation, invalidate, and clear

Testing

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.

[BUG] ChainStateCache grows unbounded — no max size or TTL eviction sweep

2 participants