Skip to content

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Jan 16, 2026

Explanation

  • What is the current state of things and why does it need to change?

    The TransactionController currently uses:

    • A static SUBMIT_HISTORY_LIMIT constant (100) to manage the maximum number of entries in the submit history
    • A transactionHistoryLimit constructor option (default: 40) to manage the maximum number of transactions stored in state

    These limits need to be configurable via remote feature flags to allow for dynamic adjustments without code changes.

  • What is the solution your changes offer and how does it work?

    This PR introduces two feature flags under FeatureFlag.Transactions:

    1. submitHistoryLimit - Configures the maximum number of entries in the submit history

      • Default: 100 (maintains backward compatibility)
      • Used in #updateSubmitHistory method
    2. transactionHistoryLimit - Configures the maximum number of transactions stored in state

      • Default: 40 (maintains backward compatibility)
      • Used in #trimTransactionsForState method

    New utility functions getSubmitHistoryLimit and getTransactionHistoryLimit retrieve these values from the RemoteFeatureFlagController.

  • Are there any changes whose purpose might not obvious to those unfamiliar with the domain?

    • The comparison in #updateSubmitHistory was changed from === to >=. This ensures that if the submitHistoryLimit is dynamically reduced, the history will still be trimmed correctly, rather than only when it exactly matches the limit.

    • The transactionHistoryLimit constructor option has been marked as deprecated. Consumers should migrate to using the feature flag via RemoteFeatureFlagController instead.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Introduces remote-configurable history limits and wires them into TransactionController.

  • Add getSubmitHistoryLimit (default 100) and getTransactionHistoryLimit (default 40) in utils/feature-flags, exposed under FeatureFlag.Transactions
  • Use these flags in TransactionController to: trim state in #trimTransactionsForState and cap submit history in #updateSubmitHistory (comparison changed to >=); remove SUBMIT_HISTORY_LIMIT
  • Deprecate TransactionControllerOptions.transactionHistoryLimit in favor of the feature flag
  • Update tests in TransactionController.test.ts and add feature-flags.test.ts; update CHANGELOG.md

Written by Cursor Bugbot for commit 896fe82. This will update automatically on new commits. Configure here.

cursoragent and others added 2 commits January 16, 2026 11:39
…action history limit

Add a new historyLimit property to FeatureFlag.Transactions that allows configuring the maximum number of entries in the submit history via remote feature flags. The default value remains 100 if not provided.

- Add historyLimit to TransactionControllerFeatureFlags type
- Create getHistoryLimit function to retrieve the feature flag value
- Update TransactionController to use getHistoryLimit instead of static constant
- Add unit tests for getHistoryLimit function

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
…tionController tests

Update TransactionController.test.ts to properly mock the getHistoryLimit
function from the feature-flags module. This is necessary because the
feature-flags module is fully mocked in the test file, so the new
getHistoryLimit function needs to be imported and configured to return
the default value of 100.

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
@cursor
Copy link

cursor bot commented Jan 16, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 4 commits January 16, 2026 11:51
…ature flag

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
…nd transaction history limits

- Rename historyLimit to submitHistoryLimit for the submit history (default: 100)
- Add transactionHistoryLimit feature flag for transaction state limit (default: 40)
- Update TransactionController to use feature flags with fallback to constructor options
- Update tests to mock both feature flag functions

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
…onstructor option

- Mark transactionHistoryLimit constructor option as deprecated with JSDoc
- Remove internal usage of the constructor option
- Feature flag is now the sole source of truth for transaction history limit
- Update changelog to document the deprecation

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
- Move feature-flags import to correct alphabetical position
- Fix formatting of getTransactionHistoryLimitMock declaration

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
@matthewwalsh0 matthewwalsh0 changed the title History limit feature flag feat(transaction-controller): Add feature flags for history limits Jan 16, 2026
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review January 16, 2026 12:20
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners January 16, 2026 12:20
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@matthewwalsh0 matthewwalsh0 changed the title feat(transaction-controller): Add feature flags for history limits feat(transaction-controller): feature flags for history limits Jan 16, 2026
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit 9dbe5d1 Jan 16, 2026
296 checks passed
@matthewwalsh0 matthewwalsh0 deleted the cursor/history-limit-feature-flag-315b branch January 16, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants