Skip to content

Conversation

@dawnseeker8
Copy link
Contributor

@dawnseeker8 dawnseeker8 commented Nov 21, 2025

Description

This PR fix incorrect transaction approved events log when user reject in hardware wallet, which relative to #18361

Basically this pr override the transactionApproved listener in Transaction-controller-init.ts and check the transactionMetadata return, if the metadata status is failed or rejected, then we should log transaction rejected event instead, which mean user reject in hardware wallet side which cause the transaction rejected.

This PR fix the incorrect

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Override Transaction Approved event listener to handle hardware wallet user rejected event.

Related issues

Fixes: #18361
https://consensyssoftware.atlassian.net/browse/HWB-76

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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.

Note

Updates the transactionApproved listener to call rejected handling when the transaction status is failed or rejected (hardware wallet user rejection), otherwise proceed with approved; adds TransactionStatus import.

  • Controller listeners (app/scripts/controller-init/confirmations/transaction-controller-init.ts):
    • Update TransactionController:transactionApproved subscription to:
      • Call handleTransactionRejected when transactionMeta.status is TransactionStatus.failed or TransactionStatus.rejected.
      • Fallback to handleTransactionApproved when status is not failed/rejected or when transactionMeta is absent.
  • Imports: Add TransactionStatus from @metamask/transaction-controller.

Written by Cursor Bugbot for commit e5715b5. This will update automatically on new commits. Configure here.

…lets

- Updated the transaction controller to properly handle transaction approval and rejection events, particularly for hardware wallets.
- Added logic to differentiate between failed and rejected transactions, ensuring that the appropriate event handlers are invoked based on the transaction status.
- revert the createRPCMethodTrackingMiddleware.js back to main version.

This change aims to provide a more robust user experience when interacting with hardware wallets during transaction confirmations.
…ing middleware

- Adjusted the indentation of the error message status assignment in the createRPCMethodTrackingMiddleware.js file to improve code readability and maintain consistency with surrounding code structure.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

CLA Signature Action:

Thank you for your submission, we really appreciate it. We ask that you all read and sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just by adding a comment to this pull request with this exact sentence:

I have read the CLA Document and I hereby sign the CLA

By commenting with the above message you are agreeing to the terms of the CLA. Your account will be recorded as agreeing to our CLA so you don't need to sign it again for future contributions to this repository.

1 out of 2 committers have signed the CLA.
@dawnseeker8
@cursoragent

@metamaskbot metamaskbot added the team-accounts-framework Accounts Framework team label Nov 21, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Nov 21, 2025

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (1 files, +19 -1)
  • 📁 app/
    • 📁 scripts/
      • 📁 controller-init/
        • 📁 confirmations/
          • 📄 transaction-controller-init.ts +19 -1

@metamaskbot
Copy link
Collaborator

Builds ready [65e499e]
UI Startup Metrics (1153 ± 94 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup115399815609412051308
load97782413398610301120
domContentLoaded97082213328610241113
domInteractive211382161874
firstPaint5587511393929841059
backgroundConnect18917424411194206
firstReactRender29174783344
getState321875123654
initialActions105113
loadScripts789646113284843923
setupStore1162631218
numNetworkReqs1257820573
BrowserifyPower User HomeuiStartup18751530300625820492382
load99586919401779951423
domContentLoaded98086419161759711413
domInteractive36162144129158
firstPaint5387719334289401423
backgroundConnect21919826212224242
firstReactRender78461491684109
getState17912930141200276
initialActions104112
loadScripts77866416861727711207
setupStore201061102742
numNetworkReqs1416729454181265
WebpackStandard HomeuiStartup818724136985850971
load617559113478620787
domContentLoaded613556112677616781
domInteractive241493182175
firstPaint233103735151219628
backgroundConnect1053361126
firstReactRender3020135123237
getState301364103845
initialActions104112
loadScripts610554111675614770
setupStore1273641419
numNetworkReqs1257819567
WebpackPower User HomeuiStartup14371082247424216001988
load67458412811296791002
domContentLoaded6645781270128664993
domInteractive36161873629139
firstPaint2621061008199233691
backgroundConnect1574271829
firstReactRender8254108119098
getState15412225028161215
initialActions103112
loadScripts6615761259125662984
setupStore23763133445
numNetworkReqs1487130554186278
FirefoxBrowserifyStandard HomeuiStartup11951029165411412491472
load101088712548010761177
domContentLoaded100988512548010751177
domInteractive53291902975111
firstPaint------
backgroundConnect3520114183679
firstReactRender20173432130
getState1167511919
initialActions103012
loadScripts98987211787610541152
setupStore105376925
numNetworkReqs1257617762
BrowserifyPower User HomeuiStartup25901891349330627603283
load1166959181717512221514
domContentLoaded1165957181717612221511
domInteractive16333829149193531
firstPaint------
backgroundConnect19423985207230723
firstReactRender83371391990125
getState23673822237186789
initialActions3133426
loadScripts1118920178916611671441
setupStore11910770172115678
numNetworkReqs965421342104208
WebpackStandard HomeuiStartup14081232184213314751675
load1198104214809312641377
domContentLoaded1198104214799312641376
domInteractive62232023983137
firstPaint------
backgroundConnect3819127194176
firstReactRender26204142834
getState156212281047
initialActions102122
loadScripts1176102814569012401348
setupStore12510516956
numNetworkReqs1156916661
WebpackPower User HomeuiStartup27432111353131729033397
load13781109192917414981722
domContentLoaded13781109192917414981722
domInteractive14231713133146486
firstPaint------
backgroundConnect15625659154180602
firstReactRender82391802090118
getState30072914280581828
initialActions41498228
loadScripts13431093189316814481683
setupStore102676216394627
numNetworkReqs985823345100214
📊 Page Load Benchmark Results

Current Commit: 65e499e | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±46ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 719ms (±63ms) 🟢 | historical mean value: 732ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 88ms (±128ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 46ms 1.00s 1.39s 1.04s 1.39s
domContentLoaded 719ms 63ms 693ms 1.28s 732ms 1.28s
firstPaint 88ms 128ms 60ms 1.36s 88ms 1.36s
firstContentfulPaint 88ms 128ms 60ms 1.36s 88ms 1.36s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.39 KiB (0.03%)
  • ui: 9.56 KiB (0.14%)
  • common: 2.36 KiB (0.03%)

@metamaskbot
Copy link
Collaborator

Builds ready [717b815]
UI Startup Metrics (1350 ± 137 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13501087192213713981622
load1056852149511111131252
domContentLoaded1049846148611111071241
domInteractive2715145252298
firstPaint609124132342710591244
backgroundConnect22120127815228252
firstReactRender4423125145067
getState66171803176127
initialActions1015226
loadScripts83564612351068831043
setupStore1576881729
numNetworkReqs41271463431143
BrowserifyPower User HomeuiStartup23111869286225124962769
load1032897150012910431394
domContentLoaded1018891149013010311377
domInteractive39183034333154
firstPaint57886150241210001294
backgroundConnect258206723103237569
firstReactRender944417826111144
getState18714436130198229
initialActions103112
loadScripts80868612841318121171
setupStore221185122549
numNetworkReqs1506840173183381
WebpackStandard HomeuiStartup89675212351099061155
load65757692579695866
domContentLoaded65257291779692859
domInteractive2816112232395
firstPaint26787922198297676
backgroundConnect1063641016
firstReactRender4119218284098
getState57251302679102
initialActions1016212
loadScripts64957090977690850
setupStore227303401746
numNetworkReqs41281493430145
WebpackPower User HomeuiStartup19381388242624721102356
load6835871245111685954
domContentLoaded6735821238112671949
domInteractive35181873031120
firstPaint2941011251221310695
backgroundConnect98764718331601
firstReactRender944714323113127
getState18513569185178250
initialActions103112
loadScripts6715801229110668940
setupStore201061122251
numNetworkReqs1607040177200384
FirefoxBrowserifyStandard HomeuiStartup13931170186016515051722
load105692813429311121266
domContentLoaded105592813429311121266
domInteractive58301393185127
firstPaint------
backgroundConnect59252053767149
firstReactRender26175083144
getState269175212661
initialActions205122
loadScripts102891213198510681224
setupStore28112223325103
numNetworkReqs39281252634118
BrowserifyPower User HomeuiStartup26092025411336828033174
load1143930193416311391514
domContentLoaded1142929193416311391514
domInteractive12331456100116397
firstPaint------
backgroundConnect125311024115141299
firstReactRender88411882899163
getState27978945206372728
initialActions2133423
loadScripts1108910180015610911493
setupStore15810737175161634
numNetworkReqs102613136480250
WebpackStandard HomeuiStartup16061368227921217092149
load12561084161212313261526
domContentLoaded12561082161212313211525
domInteractive52272903765118
firstPaint------
backgroundConnect71223515976196
firstReactRender33198193848
getState2712155252564
initialActions203123
loadScripts12261067153111213021468
setupStore2992143521130
numNetworkReqs41281352938127
WebpackPower User HomeuiStartup32082417875795533025083
load15881197668568715132964
domContentLoaded15871196668468715122964
domInteractive131311041167104468
firstPaint------
backgroundConnect1753212402391531009
firstReactRender994037746107196
getState334681388261496820
initialActions3035427
loadScripts15071172657762314842523
setupStore1367773176154623
numNetworkReqs101623056278254
📊 Page Load Benchmark Results

Current Commit: 717b815 | Date: 11/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±79ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 734ms (±104ms) 🟢 | historical mean value: 726ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±82ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 79ms 1.02s 1.79s 1.09s 1.79s
domContentLoaded 734ms 104ms 704ms 1.74s 759ms 1.74s
firstPaint 85ms 82ms 64ms 900ms 84ms 900ms
firstContentfulPaint 85ms 82ms 64ms 900ms 84ms 900ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 246 Bytes (0.01%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

…ad handling

Updated the transaction controller listener to destructure `transactionMeta` from the payload directly, improving code clarity. This change ensures that the handling of transaction approval and rejection remains consistent while reducing redundancy in the function calls.
@metamaskbot
Copy link
Collaborator

Builds ready [c937ecc]
UI Startup Metrics (1356 ± 137 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13561075187513714131638
load1065877151410611081252
domContentLoaded1058872151010511051239
domInteractive29151682823103
firstPaint58186128442210581207
backgroundConnect22219627116230261
firstReactRender4222157174968
getState68142263781146
initialActions2011215
loadScripts8436701242998951015
setupStore1564881932
numNetworkReqs41281483330141
BrowserifyPower User HomeuiStartup21421844276725022562731
load1032911148613010381354
domContentLoaded1019905147813110201339
domInteractive35171673130130
firstPaint5638613584079831280
backgroundConnect25420763693234532
firstReactRender914213922108122
getState18112726327194232
initialActions103112
loadScripts81069812481308131138
setupStore221082122644
numNetworkReqs1136440361120268
WebpackStandard HomeuiStartup90976416341259131198
load667562115696698889
domContentLoaded662559114995694883
domInteractive2816132252292
firstPaint246106912169226681
backgroundConnect1067081023
firstReactRender4224128214197
getState56151222773114
initialActions104112
loadScripts659557114093692873
setupStore178102151752
numNetworkReqs41161493430146
WebpackPower User HomeuiStartup19041312242323720692333
load681584105794687907
domContentLoaded671577103694681898
domInteractive37171873035113
firstPaint290109962205287707
backgroundConnect99764617740575
firstReactRender944415524114135
getState17313266953179203
initialActions107112
loadScripts668575102792678896
setupStore211052122448
numNetworkReqs1537339170196296
FirefoxBrowserifyStandard HomeuiStartup15121233202216816271823
load113498613419012121295
domContentLoaded113298513419112121295
domInteractive793423840107145
firstPaint------
backgroundConnect73282214291182
firstReactRender27196383043
getState251091132753
initialActions205123
loadScripts110096713118211751232
setupStore3511131284695
numNetworkReqs40281212738119
BrowserifyPower User HomeuiStartup26811920474547928263433
load1203989251124112271545
domContentLoaded1202989250324112271545
domInteractive1253347199134379
firstPaint------
backgroundConnect127351014124121394
firstReactRender89373353694142
getState326631010243486868
initialActions2034323
loadScripts1154962237719611691514
setupStore1587715168169634
numNetworkReqs101613166192247
WebpackStandard HomeuiStartup17031437335023717832068
load13321135290619013731525
domContentLoaded13311135290619013711525
domInteractive60271963685143
firstPaint------
backgroundConnect74192174281169
firstReactRender332279103648
getState2411171182444
initialActions2141423
loadScripts13011117286918613461483
setupStore2711183262671
numNetworkReqs41281262737125
WebpackPower User HomeuiStartup30212225805083230534536
load15151131628962514442634
domContentLoaded15151131628962514442634
domInteractive171304353462100452
firstPaint------
backgroundConnect132231184155143315
firstReactRender86412193191163
getState310581154243414796
initialActions208123
loadScripts14781111625860914192522
setupStore1415819177181550
numNetworkReqs100632625599252
📊 Page Load Benchmark Results

Current Commit: c937ecc | Date: 11/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 728ms (±36ms) 🟢 | historical mean value: 721ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±10ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.01s 1.33s 1.08s 1.33s
domContentLoaded 728ms 36ms 706ms 1.00s 756ms 1.00s
firstPaint 77ms 10ms 60ms 156ms 88ms 156ms
firstContentfulPaint 77ms 10ms 60ms 156ms 88ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 218 Bytes (0%)
  • ui: 74 Bytes (0%)
  • common: 20 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [8d60926]
UI Startup Metrics (1324 ± 135 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13241054167713514131583
load1049859127310911331241
domContentLoaded1042856126210811261228
domInteractive28141302622103
firstPaint51182127441310061232
backgroundConnect21419126714221241
firstReactRender392475114362
getState65181612775123
initialActions105113
loadScripts83665410571059021017
setupStore1373051623
numNetworkReqs41271503430144
BrowserifyPower User HomeuiStartup22451715343031124872755
load100587717881539891391
domContentLoaded99286817761549741370
domInteractive35171633131128
firstPaint5139614313759201308
backgroundConnect263195807127234592
firstReactRender914315125107136
getState18313069261200244
initialActions104113
loadScripts78866315531537731163
setupStore221070122446
numNetworkReqs1376838970185289
WebpackStandard HomeuiStartup92076714411269461223
load667589102389678881
domContentLoaded662586101689670876
domInteractive2816120242394
firstPaint24587747165232665
backgroundConnect126168171129
firstReactRender45232193640125
getState59201252685103
initialActions104112
loadScripts659584100587668866
setupStore16781121643
numNetworkReqs41281503430145
WebpackPower User HomeuiStartup18701327246623720182326
load6875791017105689956
domContentLoaded6785721000105678949
domInteractive38181763534156
firstPaint29195947209305709
backgroundConnect72762715125553
firstReactRender934614623109135
getState19213375997186234
initialActions105114
loadScripts675570997103676940
setupStore20758122251
numNetworkReqs1606740472199365
FirefoxBrowserifyStandard HomeuiStartup14421182231119815561820
load1089936164713211611392
domContentLoaded1088931164613211581392
domInteractive59302604277143
firstPaint------
backgroundConnect72233825899174
firstReactRender2918100123354
getState2512217232456
initialActions214123
loadScripts1054915157411711181316
setupStore2512141182454
numNetworkReqs40281312733121
BrowserifyPower User HomeuiStartup26902064513541128653438
load1201984252920712361529
domContentLoaded1200984252920712341529
domInteractive12832496101119430
firstPaint------
backgroundConnect1273366694140306
firstReactRender885214921101129
getState30165907225337834
initialActions217123
loadScripts1162968232619111831496
setupStore1695755194177711
numNetworkReqs102643146286247
WebpackStandard HomeuiStartup17941517250621319012282
load13831187171711714361634
domContentLoaded13831187171611714351626
domInteractive68292053689132
firstPaint------
backgroundConnect873430857104223
firstReactRender35238894052
getState2812159212753
initialActions207123
loadScripts13491169163210714101563
setupStore33102353824131
numNetworkReqs41281312836127
WebpackPower User HomeuiStartup29492299530663731644358
load14661176270040514652571
domContentLoaded14651176270040514642571
domInteractive14234953186101490
firstPaint------
backgroundConnect145321093138167412
firstReactRender85392322894120
getState27273918213338759
initialActions3133437
loadScripts14091092267036813332454
setupStore1269627155121522
numNetworkReqs102633106379248
📊 Page Load Benchmark Results

Current Commit: 8d60926 | Date: 11/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 726ms (±38ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±9ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.02s 1.35s 1.06s 1.35s
domContentLoaded 726ms 38ms 701ms 1.02s 738ms 1.02s
firstPaint 77ms 9ms 60ms 156ms 84ms 156ms
firstContentfulPaint 77ms 9ms 60ms 156ms 84ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 218 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

dawnseeker8 and others added 2 commits November 26, 2025 20:16
…s for hardware wallets

Updated comments in the transaction controller to better explain the handling of rejected transactions when using hardware wallets. This addresses the issue where the transaction controller erroneously triggers a transactionApproved event after a user rejects a transaction on their device, clarifying the expected behavior for both Ledger and Trezor devices.
@cursor
Copy link

cursor bot commented Nov 26, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@metamaskbot
Copy link
Collaborator

Builds ready [75a67d4]
UI Startup Metrics (1301 ± 132 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13011053187713213381562
load1034850142110010661240
domContentLoaded102884514089910611234
domInteractive28141462722103
firstPaint4798414293999851236
backgroundConnect2131972439218235
firstReactRender37207594253
getState61211712770121
initialActions104113
loadScripts8216461196978481028
setupStore1463461825
numNetworkReqs41281523430144
BrowserifyPower User HomeuiStartup21271783275123222502660
load1019891151013010441359
domContentLoaded1005881150413110251351
domInteractive35171593130128
firstPaint5238914163949321338
backgroundConnect24520362889225528
firstReactRender894416523107130
getState18813267673197242
initialActions105112
loadScripts80067312991308221153
setupStore2084692444
numNetworkReqs103652835497269
WebpackStandard HomeuiStartup87573812001029241116
load65755886586702842
domContentLoaded65255485985698832
domInteractive2715102222293
firstPaint21690806140211601
backgroundConnect1053861223
firstReactRender3624187223763
getState48151242561101
initialActions107112
loadScripts64955284984696823
setupStore15775111441
numNetworkReqs41281503430142
WebpackPower User HomeuiStartup18311309273226420022318
load7065901318117724962
domContentLoaded6975841313118710951
domInteractive38191833337129
firstPaint324109921215411726
backgroundConnect68764314922554
firstReactRender904115426111134
getState17813031127186234
initialActions103112
loadScripts6945821302116708949
setupStore23655143451
numNetworkReqs1436439673195293
FirefoxBrowserifyStandard HomeuiStartup14271179192217415581769
load1085936155512411681336
domContentLoaded1084930155412411681336
domInteractive63312524184159
firstPaint------
backgroundConnect63233625270177
firstReactRender2818136162954
getState2782242823102
initialActions104122
loadScripts1056918150311611431255
setupStore237127182171
numNetworkReqs39281272734122
BrowserifyPower User HomeuiStartup25842001406832727373084
load1144961246121411321471
domContentLoaded1143961246021411321471
domInteractive1203548691116375
firstPaint------
backgroundConnect116331049110129240
firstReactRender85411531992127
getState23755822183250679
initialActions2131326
loadScripts1104940223916710981431
setupStore18314763193228649
numNetworkReqs102623156780301
WebpackStandard HomeuiStartup16341350225617617002013
load12781082174612613431546
domContentLoaded12781082174512613431545
domInteractive61262544284142
firstPaint------
backgroundConnect64201923680143
firstReactRender332187133577
getState221185122354
initialActions103123
loadScripts12501071160611913061525
setupStore2681532921109
numNetworkReqs41281282637121
WebpackPower User HomeuiStartup30882267577778031414792
load14931108290547315832751
domContentLoaded14931107290547315832749
domInteractive172281035244102968
firstPaint------
backgroundConnect13323996146139321
firstReactRender85392792891126
getState277811252240290825
initialActions301021027
loadScripts14461090289044815152671
setupStore15861103233146671
numNetworkReqs102602546079244
📊 Page Load Benchmark Results

Current Commit: 75a67d4 | Date: 11/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±68ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 726ms (±66ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±43ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 68ms 1.02s 1.66s 1.07s 1.66s
domContentLoaded 726ms 66ms 704ms 1.33s 740ms 1.33s
firstPaint 80ms 43ms 56ms 500ms 84ms 500ms
firstContentfulPaint 80ms 43ms 56ms 500ms 84ms 500ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 223 Bytes (0%)
  • ui: 2.87 KiB (0.04%)
  • common: 20 Bytes (0%)

@dawnseeker8
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@metamaskbot
Copy link
Collaborator

Builds ready [e5715b5]
UI Startup Metrics (1225 ± 109 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12251021152010913191397
load102886212289911021197
domContentLoaded102285712179810961190
domInteractive2514137212184
firstPaint4517412463839421192
backgroundConnect21319325713218249
firstReactRender311870103652
getState3515145184264
initialActions107112
loadScripts816654102595891981
setupStore1263851425
numNetworkReqs1257820572
BrowserifyPower User HomeuiStartup20681761272424021612569
load1036898147713510491336
domContentLoaded1022889146713610421329
domInteractive36181593133119
firstPaint51910515063959521321
backgroundConnect265199800121231553
firstReactRender6041120166399
getState20215073994202311
initialActions105112
loadScripts81469012581358321124
setupStore2083862432
numNetworkReqs102662825696272
WebpackStandard HomeuiStartup811696116584834999
load62856295372646784
domContentLoaded62355794572642779
domInteractive2614162242185
firstPaint23384848165234623
backgroundConnect1062951326
firstReactRender2819132143235
getState261365113349
initialActions106112
loadScripts62055593670640769
setupStore1063141218
numNetworkReqs1257721576
WebpackPower User HomeuiStartup16831333261827719612232
load6846001242109681969
domContentLoaded6745921235109670962
domInteractive36171613332134
firstPaint28990758181345683
backgroundConnect99760618820575
firstReactRender62458586877
getState17614070455181201
initialActions103112
loadScripts6715901226108668954
setupStore221058132454
numNetworkReqs1697044183212411
FirefoxBrowserifyStandard HomeuiStartup13301098175615314391633
load110194513919211581272
domContentLoaded110194513919211571271
domInteractive61321562984105
firstPaint------
backgroundConnect47231693248122
firstReactRender24185782441
getState1166781025
initialActions102112
loadScripts107192713218211211225
setupStore146188241036
numNetworkReqs1156616659
BrowserifyPower User HomeuiStartup27122033530964328644277
load1206950295533411741596
domContentLoaded1206950295533411741595
domInteractive11836520101109437
firstPaint------
backgroundConnect125281138162118329
firstReactRender63382953163106
getState330741008245530834
initialActions218123
loadScripts1171933276131511401566
setupStore1507761185151603
numNetworkReqs102612506280243
WebpackStandard HomeuiStartup15031282204313915621789
load1239108515249013111392
domContentLoaded1239108515249013111391
domInteractive61261333286128
firstPaint------
backgroundConnect48221282655117
firstReactRender292178103042
getState136181181323
initialActions103112
loadScripts1213107214958512831365
setupStore13684131432
numNetworkReqs1156915756
WebpackPower User HomeuiStartup30032230628177529434657
load15031202319345114712767
domContentLoaded15031202319345114712766
domInteractive1073050396101380
firstPaint------
backgroundConnect166331313240140981
firstReactRender66431612171120
getState30377967227402841
initialActions2062623
loadScripts14181181299734914182538
setupStore1417971197138660
numNetworkReqs996028255113239
📊 Page Load Benchmark Results

Current Commit: e5715b5 | Date: 12/1/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 718ms (±36ms) 🟢 | historical mean value: 724ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 81ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.01s 1.32s 1.05s 1.32s
domContentLoaded 718ms 36ms 699ms 994ms 734ms 994ms
firstPaint 76ms 10ms 60ms 160ms 88ms 160ms
firstContentfulPaint 76ms 10ms 60ms 160ms 88ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 223 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 20 Bytes (0%)

@dawnseeker8
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

@dawnseeker8
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

// after user reject the transaction in devices. So we need to handle the transaction rejected here.
// ledger will make status as failed, and trezor will make status as rejected.
if (
transactionMeta.status === TransactionStatus.failed ||
Copy link
Member

Choose a reason for hiding this comment

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

This still shouldn't be possible and I worry we're not treating the root cause.

If a transaction is unapproved, it should become only approved or rejected, does this suggest we're changing the status to failed somewhere when we should instead just be rejecting with a custom hardware wallet specific error?

Copy link
Member

Choose a reason for hiding this comment

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

I just debugged and this seems like an edge case we need to fix @matthewwalsh0, I think there is a race condition when hardware wallet rejects but this event cant catch up.

We can fix race condition later - but an easy fix will be status check and early return in handleTransactionApproved

Screenshot 2025-12-01 at 14 12 47

Copy link
Member

@matthewwalsh0 matthewwalsh0 Dec 1, 2025

Choose a reason for hiding this comment

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

This event should only fire once the approval promise is resolved.

So we should have as long as we want to reject, but is there a bad code path that is failing instead and rejecting also?

Copy link
Member

@OGPoyraz OGPoyraz Dec 1, 2025

Choose a reason for hiding this comment

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

I think we have missing check - when user rejects on hardware wallet:

  1. It comes at this spot and fails transaction
    https://github.com/MetaMask/core/blob/main/packages/transaction-controller/src/TransactionController.ts#L3325

  2. But the result of #approveTransaction is not handled here
    https://github.com/MetaMask/core/blob/main/packages/transaction-controller/src/TransactionController.ts#L3088
    We are not checking approvalResult to be ApprovalState.NotApproved hence it proceeds and publish :transactionApproved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, @matthewwalsh0 and @OGPoyraz yea, you last comments is exactly what i found out before, actually i have another PR MetaMask/core#7214. which do the same fix to this issue, (if we keep that one, this PR is not required, event will be checked.), sorry i dont hve time and keep that PR sitting there too long.

My another fix in Transaction controller, basically i didnt check ApprovalState.NotApproved, but instead, i still check updatedTransactionMeta to see whether publish transaction failed event.

yea, i agree that fixing transaction-controller should be better fix then putting code in mobile level.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks both, this makes sense now.

So the root issue is nothing to do with rejection, but if any keyring throws during signing, we change the status to failed internally, but continue to publish the approved event higher up the stack as no exception is thrown.

I agree we should fix in the original controller PR by checking ApprovalState result before publishing.

Comment on lines +305 to +309
const { transactionMeta } = payload;
if (!transactionMeta) {
await handleTransactionApproved(transactionMetricsRequest, payload);
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I follow this check. Why we are triggering handler if there is no transactionMeta? Can you elaborate what case this is fixing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

await handleTransactionRejected(transactionMetricsRequest, payload);
} else {
await handleTransactionApproved(transactionMetricsRequest, payload);
}
Copy link
Member

Choose a reason for hiding this comment

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

Rather than handling it here - can we carry this implementation into handleTransactionApproved handler. This file just supposed to connect handlers ideally we don't implement any logic here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here.

transactionMeta.status === TransactionStatus.failed ||
transactionMeta.status === TransactionStatus.rejected
) {
await handleTransactionRejected(transactionMetricsRequest, payload);
Copy link
Member

@OGPoyraz OGPoyraz Dec 1, 2025

Choose a reason for hiding this comment

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

Exactly as it's commented above - this handler is getting triggered when rejected from device. But I can also see handleTransactionFailed is getting triggered afterwards. So triggering here once again will duplicate the events.

Rather than trying to trigger handleTransactionRejected or handleTransactionFailed what we need to do is just check transactionMeta if there is an error and status is not "approved" then we just interrupt.

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-S team-accounts-framework Accounts Framework team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(Ext) [Bug]: Sign types fire an Approved event when I reject the signature on Hardware Wallets

7 participants