Skip to content

fix: set submittedTime at pay publish hook start for accurate time-to-complete metrics#8439

Merged
dan437 merged 1 commit intomainfrom
perps-time-to-complete
Apr 14, 2026
Merged

fix: set submittedTime at pay publish hook start for accurate time-to-complete metrics#8439
dan437 merged 1 commit intomainfrom
perps-time-to-complete

Conversation

@dan437
Copy link
Copy Markdown
Contributor

@dan437 dan437 commented Apr 13, 2026

Explanation

For intent-based flows (e.g., perps withdrawals via Hyperliquid + Relay), the entire Relay execution happens inside TransactionPayPublishHook. TransactionController only sets submittedTime after the publish hook returns, which means submittedTime is nearly identical to the finalization time. This causes mm_pay_time_to_complete_s to report ~0.5s instead of the actual seconds/minutes it takes.

transaction-pay-controller: TransactionPayPublishHook now sets submittedTime on the transaction at the start of the hook (before strategy.execute), capturing the moment the user initiates the action.

transaction-controller: submittedTime assignment in #approveTransaction changed from = to ??= so it preserves a value pre-set by the publish hook. Normal flows where submittedTime is not pre-set are unaffected.

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

Low Risk
Low risk behavioral tweak to transaction metadata timestamping; main risk is subtle impact on metrics or downstream assumptions about when submittedTime is set.

Overview
Improves intent-based MetaMask Pay timing metrics by setting submittedTime at the start of TransactionPayPublishHook (before strategy.execute) when quotes exist, rather than effectively at the end of the pay strategy.

Updates TransactionController to preserve any pre-set submittedTime (e.g., set by a publish hook) by using nullish assignment when marking a transaction as submitted, and adds targeted tests plus changelog entries to cover the new behavior.

Reviewed by Cursor Bugbot for commit 5907d59. Bugbot is set up for automated code reviews on this repo. Configure here.

@dan437 dan437 requested a review from a team as a code owner April 13, 2026 13:57
@dan437 dan437 changed the title fix: set submittedTime at pay publish hook start for accurate time-to… fix: set submittedTime at pay publish hook start for accurate time-to-complete metrics Apr 13, 2026
@dan437 dan437 requested a review from a team as a code owner April 13, 2026 14:57
matthewwalsh0
matthewwalsh0 previously approved these changes Apr 13, 2026
@dan437 dan437 force-pushed the perps-time-to-complete branch from fae4277 to db54890 Compare April 14, 2026 08:08
Copy link
Copy Markdown

@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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit db54890. Configure here.

@dan437 dan437 enabled auto-merge April 14, 2026 08:34
@dan437 dan437 added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit 06ed8ee Apr 14, 2026
341 checks passed
@dan437 dan437 deleted the perps-time-to-complete branch April 14, 2026 08:36
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.

2 participants