fix: set submittedTime at pay publish hook start for accurate time-to-complete metrics#8439
Merged
fix: set submittedTime at pay publish hook start for accurate time-to-complete metrics#8439
Conversation
matthewwalsh0
previously approved these changes
Apr 13, 2026
fae4277 to
db54890
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
…-complete metrics
db54890 to
5907d59
Compare
matthewwalsh0
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
For intent-based flows (e.g., perps withdrawals via Hyperliquid + Relay), the entire Relay execution happens inside
TransactionPayPublishHook.TransactionControlleronly setssubmittedTimeafter the publish hook returns, which meanssubmittedTimeis nearly identical to the finalization time. This causesmm_pay_time_to_complete_sto report ~0.5s instead of the actual seconds/minutes it takes.transaction-pay-controller:TransactionPayPublishHooknow setssubmittedTimeon the transaction at the start of the hook (beforestrategy.execute), capturing the moment the user initiates the action.transaction-controller:submittedTimeassignment in#approveTransactionchanged from=to??=so it preserves a value pre-set by the publish hook. Normal flows wheresubmittedTimeis not pre-set are unaffected.References
Checklist
Note
Low Risk
Low risk behavioral tweak to transaction metadata timestamping; main risk is subtle impact on metrics or downstream assumptions about when
submittedTimeis set.Overview
Improves intent-based MetaMask Pay timing metrics by setting
submittedTimeat the start ofTransactionPayPublishHook(beforestrategy.execute) when quotes exist, rather than effectively at the end of the pay strategy.Updates
TransactionControllerto preserve any pre-setsubmittedTime(e.g., set by a publish hook) by using nullish assignment when marking a transaction assubmitted, 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.