Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new completion_time_onchain property to Transaction Finalized events #29474

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Jan 7, 2025

Description

The new property completion_time_onchain has the number of seconds (rounded to the hundredths) between submitted time and the block timestamp.

This number is necessarily lower than the previously existing completion_time property, which captures the time between block validation and UI finalization and depends on the polling interval.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3503

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Screenshot 2025-01-07 at 13 39 29

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Jan 7, 2025
@pedronfigueiredo pedronfigueiredo self-assigned this Jan 7, 2025
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner January 7, 2025 13:40
Copy link
Contributor

github-actions bot commented Jan 7, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@pedronfigueiredo pedronfigueiredo changed the title Add new completion_time_onchain property to Transaction Finalized events feat: Add new completion_time_onchain property to Transaction Finalized events Jan 7, 2025
@pedronfigueiredo pedronfigueiredo changed the title feat: Add new completion_time_onchain property to Transaction Finalized events feat: Add new completion_time_onchain property to Transaction Finalized events Jan 7, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [af59f40]
Page Load Metrics (1837 ± 182 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint31726821613499240
domContentLoaded145527161814373179
load150127461837378182
domInteractive25223655727
backgroundConnect107028189
firstReactRender16100442813
getState577232311
initialActions00000
loadScripts108320521367292140
setupStore689172110
uiStartup169730982113425204

matthewwalsh0
matthewwalsh0 previously approved these changes Jan 7, 2025
const DECIMAL_DIGITS = 2;

return (
Math.round(
Copy link
Member

Choose a reason for hiding this comment

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

Minor, could we use some extra variables here to make this logic more readable?

submittedTime: number,
blockTimestamp: string,
): string {
const DECIMAL_DIGITS = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Minor, constants at top of file with extra context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is only really going to be used in this function, I find it better to keep it as local constant, which makes it easier to understand its context too.


if (submittedTime) {
extraParams.completion_time = getTransactionCompletionTime(submittedTime);
}

if (submittedTime && blockTimestamp) {
Copy link
Member

Choose a reason for hiding this comment

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

Minor, but is it worth a unit test given the amount of logic in this file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants