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

Refactor to use UUID instead of random number for txId #20952

Conversation

OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Sep 19, 2023

Explanation

Core TransactionController creates UUID strings as an id for transactions. On the otherside extension creates random number while creating transactions using createRandomId.

While we are on a mission for TransactionController alignment for both clients, for the sake of standardisation the use of UUIDs is preferred.

So this PR aims to make transaction ids to be UUID instead of random number. And also creates a migration for persisted transactions to migrate from random numbers to UUIDs.

Here is the redux state dump for three completed tx after migration ran over the old ones.
3 transaction state dump.txt

Screenshots/Screencaps

No functional change.

Manual Testing Steps

This PRs manual testing could be tricky since it's using a migration and needs a history of transactions persisted in previous commit. So testing could be done in these steps:

  1. Checkout develop
  2. Send any transaction on any network (just to have some transaction history on the home page)
  3. Checkout 1102-use-uuids-for-transaction-ids-in-extension-transaction-controller
  4. See history persist there without any issue (history should be clickable and detail modal should render without any issue)

Apart from the case above, we need to be able to navigate between transactions on multiple transaction notification:
Screenshot 2023-09-18 at 12 52 24

  1. Try to send some transaction, don't close notification
  2. Open test-dapp on another tab, and do "Personal Sign" (basically creates another transaction)
  3. Try to navigate with the arrows on top of navigation without any issue
image

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@OGPoyraz OGPoyraz requested a review from a team as a code owner September 19, 2023 11:18
@OGPoyraz OGPoyraz added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Sep 19, 2023
@metamaskbot
Copy link
Collaborator

Builds ready [b7ae5e6]
Page Load Metrics (1675 ± 64 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint118166139157
domContentLoaded14632076167513464
load14632077167513464
domInteractive14632076167513464
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 760 Bytes (0.02%)
  • ui: 107 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (8a54f65) 68.35% compared to head (d889ece) 68.36%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #20952      +/-   ##
===========================================
+ Coverage    68.35%   68.36%   +0.01%     
===========================================
  Files         1007     1008       +1     
  Lines        40269    40285      +16     
  Branches     10773    10776       +3     
===========================================
+ Hits         27524    27537      +13     
- Misses       12745    12748       +3     
Files Coverage Δ
...s/transactions/EtherscanRemoteTransactionSource.ts 89.74% <100.00%> (ø)
app/scripts/controllers/transactions/index.js 72.64% <ø> (ø)
...ripts/controllers/transactions/tx-state-manager.js 92.31% <ø> (ø)
app/scripts/migrations/099.ts 100.00% <100.00%> (ø)
app/scripts/migrations/index.js 100.00% <ø> (ø)
shared/constants/transaction.ts 100.00% <ø> (ø)
ui/ducks/app/app.ts 56.82% <ø> (ø)
...saction-base/confirm-transaction-base.container.js 80.36% <100.00%> (ø)
...nfirm-transaction/confirm-transaction.component.js 75.00% <100.00%> (ø)
ui/pages/swaps/awaiting-swap/awaiting-swap.js 96.94% <ø> (ø)
... and 3 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vinistevam
Copy link
Contributor

Great PR! Small question, shouldn't we change here too?

ui/store/actions.ts Outdated Show resolved Hide resolved
@OGPoyraz
Copy link
Member Author

OGPoyraz commented Sep 22, 2023

Great PR! Small question, shouldn't we change here too?

Thanks @vinistevam, it's fixed in: 520f9c4

@metamaskbot
Copy link
Collaborator

Builds ready [a5bd456]
Page Load Metrics (1663 ± 74 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint120199155199
domContentLoaded13681957166215374
load13681957166315374
domInteractive13681957166215374
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 760 Bytes (0.02%)
  • ui: 107 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@sleepytanya
Copy link
Contributor

sleepytanya commented Sep 22, 2023

When we create the second transaction (signature) the error occurs:
Screenshot 2023-09-22 at 1 30 59 PM
Steps to reproduce:

  1. Create regular 'send' transaction.
  2. Do not close confirmation.
  3. Go to test-dapp and create 'signature' transaction.
  4. Try to navigate between two confirmations.
  5. Try to confirm 'send' transaction.
  6. See the error message.
    Chrome (same error on Firefox):
111.mov

matthewwalsh0
matthewwalsh0 previously approved these changes Sep 26, 2023
vinistevam
vinistevam previously approved these changes Sep 26, 2023
@sleepytanya
Copy link
Contributor

sleepytanya commented Sep 26, 2023

Confirmed that transactions history persists after correctly done migration.
On develop branch:
Screenshot 2023-09-26 at 11 38 08 AM
After migrating to current branch:
Screenshot 2023-09-26 at 11 40 06 AM

@OGPoyraz OGPoyraz dismissed stale reviews from vinistevam and matthewwalsh0 via f93203a September 26, 2023 16:04
@OGPoyraz OGPoyraz force-pushed the 1102-use-uuids-for-transaction-ids-in-extension-transaction-controller-2 branch from a5bd456 to f93203a Compare September 26, 2023 16:04
@metamaskbot
Copy link
Collaborator

Builds ready [de4f958]
Page Load Metrics (977 ± 414 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint92161119199
domContentLoaded731481082010
load851992977863414
domInteractive731481082010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 760 Bytes (0.02%)
  • ui: 107 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d889ece]
Page Load Metrics (508 ± 305 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint8014297157
domContentLoaded7013489178
load771571508635305
domInteractive6913489178
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 760 Bytes (0.02%)
  • ui: 107 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@OGPoyraz OGPoyraz merged commit 45eb408 into develop Sep 27, 2023
9 checks passed
@OGPoyraz OGPoyraz deleted the 1102-use-uuids-for-transaction-ids-in-extension-transaction-controller-2 branch September 27, 2023 12:08
@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2023
@metamaskbot metamaskbot added the release-11.3.0 Issue or pull request that will be included in release 11.3.0 label Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed release-11.3.0 Issue or pull request that will be included in release 11.3.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants