Skip to content

#743 InMemorySigningHistoryStore has no size limit — grows unbounded with wallet activity - #825

Merged
k-deejah merged 1 commit into
Sorokit:mainfrom
jotel-dev:fix/743-signingHistory-size-limit
Oct 18, 2026
Merged

k-deejah merged 1 commit into
Sorokit:mainfrom
jotel-dev:fix/743-signingHistory-size-limit

Conversation

@jotel-dev

Copy link
Copy Markdown
Contributor

Summary

Fixes #743

Caps InMemorySigningHistoryStore to a configurable maximum size so that long-running browser sessions and service signing loops do not grow unbounded in memory.

Default Cap and Tunability

  • Default Cap: 1000 entries (defined by constant DEFAULT_SIGNING_HISTORY_MAX_ENTRIES = 1000).
  • Tunable: Yes, it is fully tunable. Callers can specify a custom cap via constructor argument either as a numeric value or an options object:
    • new InMemorySigningHistoryStore(500)
    • new InMemorySigningHistoryStore({ maxEntries: 500 })
    • new InMemorySigningHistoryStore() (defaults to 1000)

Key Changes

  • In src/wallet/signingHistory.ts, added capacity capping to InMemorySigningHistoryStore. When recording new signing records exceeds capacity, the oldest records are dropped in FIFO order via splice.
  • query() naturally returns at most the capped count of records.
  • Added getMaxEntries() and size getter to inspect store capacity and count.
  • Exported DEFAULT_SIGNING_HISTORY_MAX_ENTRIES and InMemorySigningHistoryStoreOptions in src/wallet/signingHistory.ts, src/wallet/index.ts, and src/index.ts.
  • Zero breaking changes to SigningRecord, SigningHistoryFilter, or SigningHistoryStore.
  • Added comprehensive unit tests in src/tests/wallet.test.ts verifying capacity enforcement, FIFO eviction on overflow, and query limits.

Acceptance Criteria Covered

  • entries size is capped; overflow drops oldest records.
  • query() returns at most the capped count of records.
  • Tests verify overflow behaviour.
  • No breaking change to SigningRecord, SigningHistoryFilter, or SigningHistoryStore.

…nded growth (Sorokit#743)

Add configurable capacity limit to InMemorySigningHistoryStore with a default of 1000 entries. Oldest records are dropped on overflow (FIFO order), ensuring query() returns at most the capped count. The cap is tunable via constructor options without breaking existing interfaces.
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@jotel-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@k-deejah
k-deejah merged commit 0dea363 into Sorokit:main Oct 18, 2026
4 of 5 checks passed
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.

InMemorySigningHistoryStore has no size limit — grows unbounded with wallet activity

2 participants