Skip to content

Refactor pending transaction tracker#1896

Merged
matthewwalsh0 merged 7 commits intomainfrom
refactor/pending-transaction-resubmit
Nov 1, 2023
Merged

Refactor pending transaction tracker#1896
matthewwalsh0 merged 7 commits intomainfrom
refactor/pending-transaction-resubmit

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Oct 24, 2023

Explanation

Refactor the PendingTransactionTracker to align with the extension.

This includes:

  • Optional automatic resubmit of pending transactions.
  • Additional nonce validations.
  • Populating warning data in transaction metadata.

Changelog

@metamask/transaction-controller

  • BREAKING: Pending transactions are now automatically resubmitted.
    • This can be disabled by setting the new pendingTransactions.isResubmitEnabled constructor option to false.
  • ADDED: Populate the firstRetryBlockNumber, retryCount, and warning properties in the transaction metadata.

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 highlighted breaking changes using the "BREAKING" category above as appropriate

Remove unnecessary type casting.
Update coverage targets.
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review October 25, 2023 12:24
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner October 25, 2023 12:24
MajorLift
MajorLift previously approved these changes Oct 25, 2023
Copy link
Contributor

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

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

LGTM!

@legobeat
Copy link
Contributor

Changelog feedback:

Disable using the new pendingTransactions.isResubmitEnabled constructor option.

I read this to mean kind of the opposite of what it does ("Use of the new pendingTransactions.isResubmitEnabled constructor option is now disabled" vs "This new behavior can be disabled using the new pendingTransactions.isResubmitEnabled constructor option"

Somewhat related, what do you think about inverting the semantics of the new option (keep default behavior; make automatic resubmit opt-in)? I'd consider this a breaking change - users may rely on being notified of any error and handling them explicitly.

@matthewwalsh0
Copy link
Member Author

Changelog feedback:

Disable using the new pendingTransactions.isResubmitEnabled constructor option.

I read this to mean kind of the opposite of what it does ("Use of the new pendingTransactions.isResubmitEnabled constructor option is now disabled" vs "This new behavior can be disabled using the new pendingTransactions.isResubmitEnabled constructor option"

Somewhat related, what do you think about inverting the semantics of the new option (keep default behavior; make automatic resubmit opt-in)? I'd consider this a breaking change - users may rely on being notified of any error and handling them explicitly.

We're trying to avoid hiding large parts of the controller functionality behind feature flags that have to be explicitly enabled, so by default a client gets all the features with minimal configuration, but they can override and disable parts they don't want as the exception.

The extension is the larger client and uses this feature for example, but the mobile will be the exception in not using it. You are right though that we should mark this as a breaking change to ensure mobile disables this when adopting to ensure their usage remains the same.

OGPoyraz
OGPoyraz previously approved these changes Nov 1, 2023
vinistevam
vinistevam previously approved these changes Nov 1, 2023
@matthewwalsh0 matthewwalsh0 dismissed stale reviews from vinistevam, OGPoyraz, and MajorLift via 6744ce2 November 1, 2023 13:01
@matthewwalsh0 matthewwalsh0 merged commit c6f5424 into main Nov 1, 2023
@matthewwalsh0 matthewwalsh0 deleted the refactor/pending-transaction-resubmit branch November 1, 2023 13:40
mcmire pushed a commit that referenced this pull request Nov 2, 2023
Refactor the PendingTransactionTracker to align with the extension.
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.

5 participants