Skip to content

Conversation

Akaryatrh
Copy link
Contributor

@Akaryatrh Akaryatrh commented Jun 25, 2025

Description

Adds ledger e2e test for the following scenario:

  • ERC20 token creation from test-dapp

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/948

Manual testing steps

Locally:

yarn start:test
# wait for end of build
yarn test:e2e:single test/e2e/tests/hardware-wallets/ledger-erc20.spec.ts

On CI, check e2e tests job

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.

Copy link
Contributor

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.

@metamaskbot
Copy link
Collaborator

Builds ready [98a4212]
UI Startup Metrics (1184 ± 67 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1184105313416712231321
load102188511646610641152
domContentLoaded101588111586610581146
domInteractive17144551733
firstPaint726155116739110431117
backgroundConnect84336825
firstReactRender22174152337
getState1363071926
initialActions001001
loadScripts81169095465855935
setupStore85243817
WebpackHomeuiStartup21661672271921522812569
load16411196202118117431961
domContentLoaded16341193201318017331956
domInteractive171283131356
firstPaint1536031357179274
backgroundConnect2310319302335
firstReactRender25988465123381410
getState1144161226
initialActions315134
loadScripts16311191200317817311945
setupStore177304291825
FirefoxBrowserifyHomeuiStartup13671195173811014111599
load1202106213717912621346
domContentLoaded1202106213707912611346
domInteractive1143534155123284
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2413114172277
firstReactRender24205342531
getState12514222934
initialActions001001
loadScripts1182105213507612361324
setupStore84527826
WebpackHomeuiStartup15531348209916016261951
load13421179185013714311641
domContentLoaded13421179185013714311640
domInteractive95323175890274
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect21154362340
firstReactRender40324734345
getState1375171331
initialActions102111
loadScripts13231155183013714151627
setupStore85425816
Benchmark value 25 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 260 exceeds gate value 235 for chrome webpack home mean firstReactRender
Benchmark value 2569 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 410 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 114 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 13 exceeds gate value 11 for firefox browserify home mean getState
Benchmark value 284 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 77 exceeds gate value 70 for firefox browserify home p95 backgroundConnect
Benchmark value 34 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 41 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 1951 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 274 exceeds gate value 156 for firefox webpack home p95 domInteractive
Sum of mean exceeds: 34ms | Sum of p95 exceeds: 402ms
Sum of all benchmark exceeds: 436ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 23 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 15 Bytes (0%)

Copy link
Contributor

@seaona seaona left a comment

Choose a reason for hiding this comment

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

We are using a mocked class for Common and this class doesn't include a param function, as it was very minimal. For regular sends work well but it seems that for contract deployments (and maybe interactions?) we need to support this method.
This would be the minimal things we need. If you add this in the Common class, this should fix the error common.param is not a function":

/**
   * Returns the value of a parameter for the current hardfork.
   * This is a minimal implementation that returns default values for common parameters.
   *
   * @param {string} param - The parameter name.
   * @returns {any} The parameter value.
   */
  param(param) {
    // Return default values for common parameters that @ethereumjs/tx might request
    const defaults = {
      gasLimitBoundDivisor: 1024,
      baseFeeChangeDenominator: 8,
      elasticityMultiplier: 2,
      maxPriorityFeePerGas: 0,
      maxFeePerGas: 0,
    };
    return defaults[param] || 0;
  }

@Akaryatrh Akaryatrh force-pushed the feat/ledger-erc20deploy-e2etest branch from 9b692fb to cc3c5cf Compare June 27, 2025 14:04
@Akaryatrh Akaryatrh marked this pull request as ready for review June 27, 2025 14:05
@Akaryatrh Akaryatrh marked this pull request as draft June 27, 2025 14:23
@metamaskbot
Copy link
Collaborator

Builds ready [cc3c5cf]
UI Startup Metrics (1173 ± 58 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1173104614115812121268
load100291111465310291112
domContentLoaded99590411395210231102
domInteractive17134261639
firstPaint66081112240310221108
backgroundConnect74333812
firstReactRender22174752333
getState1563982131
initialActions001001
loadScripts79370492850817893
setupStore85274817
WebpackHomeuiStartup22581795282719323302657
load17441343209217018311998
domContentLoaded17371338208316918271992
domInteractive1912142181458
firstPaint1656348082195355
backgroundConnect2511282282441
firstReactRender21191413107332406
getState165316311443
initialActions215134
loadScripts17341337207216918251981
setupStore217314401727
FirefoxBrowserifyHomeuiStartup14511255214913815141729
load1262110216438913271410
domContentLoaded1262110216438913271410
domInteractive1213757369127299
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2714202242553
firstReactRender26234132632
getState155191281051
initialActions001001
loadScripts1241108516248913061390
setupStore164320401058
WebpackHomeuiStartup16621427251022818062173
load14161227189016515071733
domContentLoaded14161227189016515071732
domInteractive105334387794324
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect261790102741
firstReactRender44355744650
getState238410521346
initialActions002111
loadScripts13951204187016414881707
setupStore15535042929
cc: @HowardBraham
Benchmark value 2258 exceeds gate value 2192 for chrome webpack home mean uiStartup
Benchmark value 1744 exceeds gate value 1711 for chrome webpack home mean load
Benchmark value 1738 exceeds gate value 1704 for chrome webpack home mean domContentLoaded
Benchmark value 1735 exceeds gate value 1699 for chrome webpack home mean loadScripts
Benchmark value 2657 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 59 exceeds gate value 57 for chrome webpack home p95 domInteractive
Benchmark value 356 exceeds gate value 334 for chrome webpack home p95 firstPaint
Benchmark value 406 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 1981 exceeds gate value 1970 for chrome webpack home p95 loadScripts
Benchmark value 1452 exceeds gate value 1405 for firefox browserify home mean uiStartup
Benchmark value 1262 exceeds gate value 1245 for firefox browserify home mean load
Benchmark value 1262 exceeds gate value 1239 for firefox browserify home mean domContentLoaded
Benchmark value 121 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 27 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 26 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 15 exceeds gate value 11 for firefox browserify home mean getState
Benchmark value 1242 exceeds gate value 1230 for firefox browserify home mean loadScripts
Benchmark value 16 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 1729 exceeds gate value 1660 for firefox browserify home p95 uiStartup
Benchmark value 299 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 51 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 58 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 1662 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1417 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1416 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 105 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 24 exceeds gate value 15 for firefox webpack home mean getState
Benchmark value 1395 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 16 exceeds gate value 13 for firefox webpack home mean setupStore
Benchmark value 2173 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1733 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1732 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 324 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 46 exceeds gate value 32 for firefox webpack home p95 getState
Benchmark value 1707 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Benchmark value 29 exceeds gate value 28 for firefox webpack home p95 setupStore
Sum of mean exceeds: 471ms | Sum of p95 exceeds: 1148ms
Sum of all benchmark exceeds: 1619ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 170 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 15 Bytes (0%)

@Akaryatrh Akaryatrh marked this pull request as ready for review June 27, 2025 15:27
@Akaryatrh Akaryatrh force-pushed the feat/ledger-erc20deploy-e2etest branch from 7fb4053 to e61eca0 Compare June 27, 2025 15:28
'0x100000000000000000000',
)) ?? console.error('localNodes is undefined or empty');
await loginWithoutBalanceValidation(driver);
const testDappPage = new TestDappPage(driver);
Copy link
Contributor

Choose a reason for hiding this comment

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

to prevent flakiness, could we make sure we have the expected balance once we land in the hompage?
Something like:

Suggested change
const testDappPage = new TestDappPage(driver);
const homePage = new HomePage(driver);
await homePage.check_expectedBalanceIsDisplayed('1208925.8196');
const testDappPage = new TestDappPage(driver);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used instead loginWithBalanceValidation (and added an optional value parameter to this function). Is that ok for you?

Copy link
Contributor

@seaona seaona left a comment

Choose a reason for hiding this comment

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

Overall looks good! Nice job 🙌 I just added a small comment for preventing flakiness 🙏

@metamaskbot
Copy link
Collaborator

Builds ready [e61eca0]
UI Startup Metrics (1191 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1191105213745712351287
load101991311195310651108
domContentLoaded101290611135210601099
domInteractive18134261739
firstPaint60777112740510161082
backgroundConnect74284812
firstReactRender23164762335
getState1563382230
initialActions001001
loadScripts80669890252853889
setupStore95325923
WebpackHomeuiStartup22081676275920023052562
load16871198204917117901963
domContentLoaded16801194204417017841959
domInteractive1812102171464
firstPaint1776562484195351
backgroundConnect2711291382753
firstReactRender22289414114362401
getState224330541543
initialActions217134
loadScripts16771193203416917771957
setupStore1575471926
FirefoxBrowserifyHomeuiStartup13861223188811814191648
load1208105714108012671350
domContentLoaded1208105714108012671350
domInteractive1213653776122250
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2514158202370
firstReactRender25223422529
getState1057611936
initialActions001001
loadScripts1187102813968012531323
setupStore12420023950
WebpackHomeuiStartup16031357253520516852031
load13701168168813714691639
domContentLoaded13701167168713714681638
domInteractive97303516390285
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect241598152452
firstReactRender41345944447
getState187258341138
initialActions001011
loadScripts13491149167013414501605
setupStore16527141832
Benchmark value 23 exceeds gate value 17 for chrome browserify home p95 setupStore
Benchmark value 2208 exceeds gate value 2192 for chrome webpack home mean uiStartup
Benchmark value 2563 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 64 exceeds gate value 57 for chrome webpack home p95 domInteractive
Benchmark value 351 exceeds gate value 334 for chrome webpack home p95 firstPaint
Benchmark value 401 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 121 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 13 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 250 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 36 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 50 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 19 exceeds gate value 15 for firefox webpack home mean getState
Benchmark value 16 exceeds gate value 13 for firefox webpack home mean setupStore
Benchmark value 2031 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 285 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 52 exceeds gate value 49 for firefox webpack home p95 backgroundConnect
Benchmark value 38 exceeds gate value 32 for firefox webpack home p95 getState
Benchmark value 32 exceeds gate value 28 for firefox webpack home p95 setupStore
Sum of mean exceeds: 42ms | Sum of p95 exceeds: 498ms
Sum of all benchmark exceeds: 540ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 170 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 15 Bytes (0%)

@Akaryatrh Akaryatrh force-pushed the feat/ledger-erc20deploy-e2etest branch from e248970 to a657e52 Compare June 28, 2025 06:56
@metamaskbot
Copy link
Collaborator

Builds ready [a657e52]
UI Startup Metrics (1181 ± 65 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1181105914116512161285
load101590311796110591115
domContentLoaded100889511696110531108
domInteractive17144761634
firstPaint68078117540810291095
backgroundConnect74364811
firstReactRender25185482745
getState1565491930
initialActions001001
loadScripts80669595059851909
setupStore95284917
WebpackHomeuiStartup21941612278023023162656
load16521210209018417711968
domContentLoaded16451207207418317661959
domInteractive1912115181457
firstPaint1696647169202290
backgroundConnect2710288372545
firstReactRender25488430121386402
getState155310311228
initialActions316134
loadScripts16421205206218117641947
setupStore187305291828
FirefoxBrowserifyHomeuiStartup13961194234718514271811
load12121042206912812511438
domContentLoaded12111042206812812511437
domInteractive121351066114121195
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3013524542478
firstReactRender26215362735
getState17518633990
initialActions001001
loadScripts11891024205412312331375
setupStore11424025833
WebpackHomeuiStartup16921406250521718032170
load14501211200616015641742
domContentLoaded14491211200516015641742
domInteractive103344236695282
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3116368472561
firstReactRender44327864552
getState2462924814140
initialActions001011
loadScripts14261194182815115401712
setupStore1057110833
Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 2195 exceeds gate value 2192 for chrome webpack home mean uiStartup
Benchmark value 255 exceeds gate value 235 for chrome webpack home mean firstReactRender
Benchmark value 2656 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 402 exceeds gate value 370 for chrome webpack home p95 firstReactRender
Benchmark value 122 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 30 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 26 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 18 exceeds gate value 11 for firefox browserify home mean getState
Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 1811 exceeds gate value 1660 for firefox browserify home p95 uiStartup
Benchmark value 78 exceeds gate value 70 for firefox browserify home p95 backgroundConnect
Benchmark value 90 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 33 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 1692 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1450 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1450 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 104 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 25 exceeds gate value 15 for firefox webpack home mean getState
Benchmark value 1426 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 2170 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1742 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1742 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 282 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 61 exceeds gate value 49 for firefox webpack home p95 backgroundConnect
Benchmark value 52 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 140 exceeds gate value 32 for firefox webpack home p95 getState
Benchmark value 1712 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Benchmark value 33 exceeds gate value 28 for firefox webpack home p95 setupStore
Sum of mean exceeds: 361ms | Sum of p95 exceeds: 1199ms
Sum of all benchmark exceeds: 1560ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 182 Bytes (0%)
  • ui: 36.06 KiB (0.5%)
  • common: 679 Bytes (0.01%)

Copy link
Contributor

@dawnseeker8 dawnseeker8 left a comment

Choose a reason for hiding this comment

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

LGTM

@dawnseeker8 dawnseeker8 added this pull request to the merge queue Jul 2, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 2, 2025
@Akaryatrh Akaryatrh added this pull request to the merge queue Jul 2, 2025
Merged via the queue into main with commit f871042 Jul 2, 2025
145 checks passed
@Akaryatrh Akaryatrh deleted the feat/ledger-erc20deploy-e2etest branch July 2, 2025 15:58
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2025
@metamaskbot metamaskbot added the release-12.23.0 Issue or pull request that will be included in release 12.23.0 label Jul 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.23.0 Issue or pull request that will be included in release 12.23.0 team-hardware-wallets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants