Skip to content

fix: honor configured transaction history capacity - #441

Open
snuff12 wants to merge 1 commit into
LiteSVM:masterfrom
snuff12:fix/history-capacity-retention
Open

snuff12 wants to merge 1 commit into
LiteSVM:masterfrom
snuff12:fix/history-capacity-retention

Conversation

@snuff12

@snuff12 snuff12 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

with_transaction_history(N) currently uses IndexMap's backing allocation as its retention limit. Allocation growth and resizing can retain more or fewer transactions than requested, including after a snapshot round-trip.

Store the configured capacity separately and use it for enablement, eviction, and snapshot serialization. Preserve the existing truncation order when reducing the limit and keep the snapshot schema unchanged.

Add six public-API regressions for exact limits (1, 2, 4, 32, 33), partial-history resizing, disable/re-enable, failed transactions, duplicate rejection, and empty/populated snapshot restoration. All six fail on the base and pass with this fix.

Fixes #439.

Validation on local macOS:

  • cargo test --workspace --exclude litesvm-node --features precompiles --locked: 154 passed.
  • cargo check -p litesvm-node --locked: passed.
  • cargo clippy -p litesvm -p litesvm-persistence --all-targets --features precompiles --locked -- -D warnings: passed.
  • cargo +nightly fmt --all -- --check: passed.
  • git diff --check: passed.

JavaScript runtime tests were not run. The workspace test run reused existing SBF test fixtures compiled from unchanged test-program sources.

@snuff12
snuff12 force-pushed the fix/history-capacity-retention branch from 645ba3d to a8d8805 Compare October 22, 2026 17:12

This branch has not been deployed

No deployments
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.

Configured transaction history capacity is not enforced independently of IndexMap allocation

1 participant