Skip to content

fix(anvil): guard zero prune history limit#13884

Open
mk0walsk wants to merge 1 commit intofoundry-rs:masterfrom
mk0walsk:fix-anvil-zero-prune-history
Open

fix(anvil): guard zero prune history limit#13884
mk0walsk wants to merge 1 commit intofoundry-rs:masterfrom
mk0walsk:fix-anvil-zero-prune-history

Conversation

@mk0walsk
Copy link
Copy Markdown

Motivation

Passing --prune-history 0 can propagate a zero max_memory_history into InMemoryBlockStates, where enforce_limits loops on while self.present.len() >= self.in_memory_limit. With a zero limit, that condition never becomes false, which can leave Anvil stuck while pruning state history.

Solution

Treat 0 as an unsupported prune-history value at the config layer, and clamp in-memory cache limits to at least 1 in storage as a defensive fallback. This prevents the infinite eviction loop and adds regression tests for zero-value config parsing and cache initialization.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant