Skip to content

test: add spec signs message with verifyingContract field missing#31630

Merged
DDDDDanica merged 9 commits intomainfrom
e2e-verifying-contract-missing
Apr 10, 2025
Merged

test: add spec signs message with verifyingContract field missing#31630
DDDDDanica merged 9 commits intomainfrom
e2e-verifying-contract-missing

Conversation

@seaona
Copy link
Copy Markdown
Member

@seaona seaona commented Apr 5, 2025

Description

The typed signatures were broken when we don't pass a verifyingContract value in the message. This was fixed, and now we add a spec to cover this user flow.

PR with the fix: #31613

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Check ci or run spec locally

Screenshots/Recordings

Before

verifyi9ng-contract-broken.mp4

After

verifyi9ng-contract-working.mp4

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 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.

@metamaskbot metamaskbot added the team-qa QA team label Apr 5, 2025
@seaona seaona added the team-confirmations Push issues to confirmations team label Apr 5, 2025
await openDapp(
driver,
null,
`${DAPP_URL}/request?method=eth_signTypedData_v4&params=["${DEFAULT_FIXTURE_ACCOUNT}",{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"chainId","type":"uint256"},{"name":"version","type":"string"}],"Person":[{"name":"name","type":"string"},{"name":"wallets","type":"address[]"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person[]"},{"name":"contents","type":"string"},{"name":"attachment","type":"bytes"}]},"primaryType":"Mail","domain":{"chainId":"0x539","name":"Ether Mail","version":"1"},"message":{"contents":"Hello, Bob!","from":{"name":"Cow","wallets":["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},"to":[{"name":"Bob","wallets":["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}],"attachment":"0x"}}]`,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ℹ️ using the same test dapp message for v4 without the verifying contract field. This way, we can use the assertInfoValues method almost identically , with the caveat that now there's not verifying contract field

@seaona seaona marked this pull request as ready for review April 5, 2025 07:15
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [5d0748d]
UI Startup Metrics (1208 ± 56 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1208110913855612311360
load10569511230511091992
domContentLoaded10519461224511101990
domInteractive16133851629
firstPaint737831229417231985
backgroundConnect96304910
firstReactRender19156981934
getState10433768
initialActions001001
loadScripts80169297751823947
setupStore8520378
WebpackHomeuiStartup20811666251618922102342
load16191297207114917151836
domContentLoaded16131294206714817111830
domInteractive171257121453
firstPaint167645647527188
backgroundConnect281072143164
firstReactRender169533621107693
getState10329589
initialActions512642635
loadScripts16051290205714617031820
setupStore446297792868
FirefoxBrowserifyHomeuiStartup13491185185714213781695
load12111043168813512471551
domContentLoaded12101043168713512461551
domInteractive9843182278996
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect24166692450
firstReactRender22193632228
getState7446578
initialActions001001
loadScripts11881027165113312211517
setupStore6417267
WebpackHomeuiStartup14751311207314915221852
load12741107180313513081611
domContentLoaded12741107180313513081610
domInteractive9237167249197
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23178372328
firstReactRender34285853546
getState7430578
initialActions001011
loadScripts12531090178113412851591
setupStore7425378
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [13feaca]
UI Startup Metrics (1208 ± 66 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1208109815366612391312
load10669661368611159993
domContentLoaded10609611364621155985
domInteractive17137491528
firstPaint770901175400257986
backgroundConnect106455810
firstReactRender19154052031
getState11444768
initialActions001001
loadScripts812712108761839907
setupStore7524379
WebpackHomeuiStartup20821684256116221862313
load16171318193212917301798
domContentLoaded16121315191213017261792
domInteractive171270131457
firstPaint166644236523679
backgroundConnect271065143360
firstReactRender162533511036296
getState1031691679
initialActions316134
loadScripts16031312188813017201783
setupStore30629660288
FirefoxBrowserifyHomeuiStartup13201160190913213471647
load11871042174512712201490
domContentLoaded11871041174412712191490
domInteractive9538188228794
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23165882449
firstReactRender21194032128
getState6324378
initialActions002001
loadScripts11651024170612512001471
setupStore6417257
WebpackHomeuiStartup14911306215815415511859
load12891138192813813411605
domContentLoaded12891137192813813401605
domInteractive9238233298895
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23165242431
firstReactRender33287063445
getState7326378
initialActions002111
loadScripts12681119190613813201582
setupStore7519278
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@@ -0,0 +1,26 @@
import { Driver } from '../../webdriver/driver';

class TestDappIndividualRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does this need to be a class? 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not "needed" per se, but I'm applying page objects, as we do in the rest of the dapps/screens.
I agree in this case could be too much? but still if this page grows (have more divs/btns), we'll already have it implemented, if that makes sense

https://github.com/MetaMask/metamask-extension/tree/main/test/e2e/page-objects/pages

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [718653a]
UI Startup Metrics (1259 ± 63 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1259114214066312971388
load109897312626211351240
domContentLoaded109196712566311341256
domInteractive17136571730
firstPaint771831262431219290
backgroundConnect1267710910
firstReactRender20147482034
getState14437879
initialActions001001
loadScripts832704101262863947
setupStore8520378
WebpackHomeuiStartup21461713241117422772362
load16711325206015617671954
domContentLoaded16621322205015317571875
domInteractive181358111452
firstPaint168663876524873
backgroundConnect3611418553651
firstReactRender183533731115796
getState12443869
initialActions317145
loadScripts16541319202515217471872
setupStore21632432348
FirefoxBrowserifyHomeuiStartup13831225173812414561661
load12411042161412113101532
domContentLoaded12411041161412113101532
domInteractive9942284308998
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect281697133054
firstReactRender22193422226
getState7428379
initialActions001001
loadScripts12151020158812212861512
setupStore7436567
WebpackHomeuiStartup15631361212513616211814
load13431169188212413951568
domContentLoaded13431169188212413941568
domInteractive9635180219096
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25184962643
firstReactRender37305764150
getState10456789
initialActions102111
loadScripts13201149185612313701542
setupStore8526489

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [48056cd]
UI Startup Metrics (1219 ± 65 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1219110515006512561320
load10699651297551117994
domContentLoaded10629611291541129998
domInteractive17137791629
firstPaint8371351301384192302
backgroundConnect107273910
firstReactRender20145262037
getState14576979
initialActions001001
loadScripts814723103653836890
setupStore8431378
WebpackHomeuiStartup21391637258219122612415
load16651280213616717431970
domContentLoaded16591274213216617381950
domInteractive161263101446
firstPaint161615926822079
backgroundConnect3110106153749
firstReactRender176533951085689
getState11434679
initialActions318146
loadScripts16501260212216317311925
setupStore26637546317
FirefoxBrowserifyHomeuiStartup13631169174012614351642
load12231049158011913051428
domContentLoaded12221049158011913051428
domInteractive9838290338996
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23165472446
firstReactRender22194232230
getState941921879
initialActions001001
loadScripts12011032156311912861405
setupStore6432367
WebpackHomeuiStartup16041422204413316811905
load13761213178812014621623
domContentLoaded13751213178812014611623
domInteractive9766170229199
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect27195153037
firstReactRender40316374555
getState9531589
initialActions102111
loadScripts13501193175811914341598
setupStore9532489

Comment on lines +3 to +4
const DAPP_HOST_ADDRESS = '127.0.0.1:8080';
const DAPP_URL = `http://${DAPP_HOST_ADDRESS}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aren't those available in the e2e constants file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

aww yeahh nice catch! I copied the existing code from the test-dapp >.< I've updated both files now


const DAPP_HOST_ADDRESS = '127.0.0.1:8080';
const DAPP_URL = `http://${DAPP_HOST_ADDRESS}`;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

changed because of review comment

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [a699053]
UI Startup Metrics (1254 ± 59 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1254111414075912981347
load10979651277641154992
domContentLoaded10919591271641150988
domInteractive18136791729
firstPaint7361001276436228967
backgroundConnect106293910
firstReactRender22155282443
getState145921279
initialActions001001
loadScripts84071199961883936
setupStore9533579
WebpackHomeuiStartup21661722257019323312424
load16961298220816818121950
domContentLoaded16871294220316318041895
domInteractive171267121452
firstPaint164633396227092
backgroundConnect4611380643958
firstReactRender174523571155890
getState3543207269
initialActions317136
loadScripts16771291219816117941892
setupStore22620131539
FirefoxBrowserifyHomeuiStartup13541183185712014041602
load12201038171612212801472
domContentLoaded12201038171612212801471
domInteractive10640187298797
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect241598132350
firstReactRender21192922127
getState7436478
initialActions001001
loadScripts11971017169612212601422
setupStore6413266
WebpackHomeuiStartup15971373224214616681891
load13811179201113814591642
domContentLoaded13811179201113814591642
domInteractive9638195249097
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25185152637
firstReactRender36295353947
getState7529389
initialActions102111
loadScripts13581161198313714401619
setupStore8528389

}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async request(method: string, params: any[]) {
Copy link
Copy Markdown
Member Author

@seaona seaona Apr 9, 2025

Choose a reason for hiding this comment

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

this belongs to the test dapp individual request class, not the test dapp "home" default page, so I've moved it there

@chloeYue
Copy link
Copy Markdown
Contributor

LGTM !

@DDDDDanica DDDDDanica added this pull request to the merge queue Apr 10, 2025
Merged via the queue into main with commit dae58e6 Apr 10, 2025
166 checks passed
@DDDDDanica DDDDDanica deleted the e2e-verifying-contract-missing branch April 10, 2025 10:22
@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Apr 10, 2025
@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented Apr 14, 2025

Thanks for adding this test! I had started work on this myself, but got distracted by other work. This is a better solution than what I had drafted anyway.

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

Labels

release-12.17.0 Issue or pull request that will be included in release 12.17.0 team-confirmations Push issues to confirmations team team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants