Skip to content

Commit b1257bd

Browse files
seaonametamaskbot
andauthored
test: add snap-account-abstraction-keyring-site as a local server and remove live requests to the site (#36801)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR implements a localserver for the `snap-account-abstraction-keyring-site` instead of going to the live site, in our e2e, to avoid flakiness. This implies the following: - Removing all related live requests from the allowlist - Adding the `snap-account-abstraction-keyring-site` as an npm package - Updating the snap simple keyring binaries, as the version was updated to 1.0.0 . The changes are just the result of running this yarn update-snap-binary --snap-account-abstraction-keyring@1.0.0 - In our tests, we are not going to localhost directly, as localhost is not in the allowlist for that snap. So we take the same approach as we did before, suggested by @FrederikBolding , where we proxy the localhost, so we still see the origin as metamask.github so then we don't get errors, and we avoid adding localhost in the allowlist (this was a small security concern). Context: https://consensys.slack.com/archives/GN3SR3GNM/p1759489395046839 Usage in our e2e: ```javascript await withFixtures( { dapp: true, dappPaths: ['snap-account-abstraction-keyring-site'], ... ``` - Related work: [test: add snap-simple-keyring-site as a local server and remove live requests to the site](#36557) - Snap Account Abstraction Keyring Release PR: MetaMask/snap-account-abstraction-keyring#216 [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/36801?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MMQA-428 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > E2E tests now use a locally served `@metamask/snap-account-abstraction-keyring-site` with new mocks, removing live site requests and updating related configs and dependencies (including ethers 5.8). > > - **E2E/Testing**: > - Serve `@metamask/snap-account-abstraction-keyring-site` locally via `dappPaths` and new mock proxy (`account-abstraction-keyring-site-mocks.ts`). > - Replace snap mocks import; install flow updated to wait for dialog close; integrate site and swaps mocks together. > - Remove live site URLs from `test/e2e/mock-e2e-allowlist.js`. > - **Config/Tooling**: > - Add `@metamask/snap-account-abstraction-keyring-site` to `package.json` and `.depcheckrc.yml` ignore list. > - Update snap binary headers for `snap-account-abstraction-keyring@1.0.0`. > - Extend test helper to resolve local site path. > - **Security Policy**: > - Adjust LavaMoat Browserify/Webpack policies to reference `ethers` subpackages consistently (switch to `ethers>@ethersproject/*`). > - **Dependencies**: > - Bump `ethers` and all `@ethersproject/*` to `5.8.0`; update `ws`, `elliptic` accordingly. > - Refresh MetaMask packages (`json-rpc-engine`, `json-rpc-middleware-stream`, add legacy `providers` for site) and add site-related packages. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit bc72af3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
1 parent e1958ff commit b1257bd

File tree

15 files changed

+655
-681
lines changed

15 files changed

+655
-681
lines changed

.depcheckrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ignores:
2929
- '@metamask/test-dapp-multichain'
3030
- '@metamask/test-dapp-solana'
3131
- '@metamask/snap-simple-keyring-site'
32+
- '@metamask/snap-account-abstraction-keyring-site'
3233
- '@metamask/design-tokens' # Only imported in index.css
3334
- '@tsconfig/node22' # required dynamically by TS, used in tsconfig.json
3435
- '@sentry/cli' # invoked as `sentry-cli`

lavamoat/browserify/beta/policy.json

Lines changed: 34 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@
142142
"@ethersproject/bytes": true,
143143
"ethers>@ethersproject/constants": true,
144144
"ethers>@ethersproject/hash": true,
145-
"@ethersproject/abi>@ethersproject/keccak256": true,
146-
"@ethersproject/abi>@ethersproject/logger": true,
145+
"ethers>@ethersproject/keccak256": true,
146+
"ethers>@ethersproject/logger": true,
147147
"ethers>@ethersproject/properties": true,
148148
"ethers>@ethersproject/strings": true
149149
}
@@ -152,22 +152,22 @@
152152
"packages": {
153153
"@ethersproject/bignumber": true,
154154
"@ethersproject/bytes": true,
155-
"@ethersproject/abi>@ethersproject/logger": true,
155+
"ethers>@ethersproject/logger": true,
156156
"ethers>@ethersproject/properties": true
157157
}
158158
},
159159
"ethers>@ethersproject/abstract-signer": {
160160
"packages": {
161-
"@ethersproject/abi>@ethersproject/logger": true,
161+
"ethers>@ethersproject/logger": true,
162162
"ethers>@ethersproject/properties": true
163163
}
164164
},
165165
"ethers>@ethersproject/address": {
166166
"packages": {
167167
"@ethersproject/bignumber": true,
168168
"@ethersproject/bytes": true,
169-
"@ethersproject/abi>@ethersproject/keccak256": true,
170-
"@ethersproject/abi>@ethersproject/logger": true,
169+
"ethers>@ethersproject/keccak256": true,
170+
"ethers>@ethersproject/logger": true,
171171
"ethers>@ethersproject/rlp": true
172172
}
173173
},
@@ -189,23 +189,13 @@
189189
"@ethersproject/bignumber": {
190190
"packages": {
191191
"@ethersproject/bytes": true,
192-
"@ethersproject/abi>@ethersproject/logger": true,
192+
"ethers>@ethersproject/logger": true,
193193
"bn.js": true
194194
}
195195
},
196196
"@ethersproject/bytes": {
197197
"packages": {
198-
"@ethersproject/abi>@ethersproject/logger": true
199-
}
200-
},
201-
"ethers>@ethersproject/keccak256>@ethersproject/bytes": {
202-
"packages": {
203-
"ethers>@ethersproject/keccak256>@ethersproject/bytes>@ethersproject/logger": true
204-
}
205-
},
206-
"ethers>@ethersproject/bytes": {
207-
"packages": {
208-
"ethers>@ethersproject/bytes>@ethersproject/logger": true
198+
"ethers>@ethersproject/logger": true
209199
}
210200
},
211201
"ethers>@ethersproject/constants": {
@@ -224,7 +214,7 @@
224214
"ethers>@ethersproject/address": true,
225215
"@ethersproject/bignumber": true,
226216
"@ethersproject/bytes": true,
227-
"@ethersproject/abi>@ethersproject/logger": true,
217+
"ethers>@ethersproject/logger": true,
228218
"ethers>@ethersproject/properties": true,
229219
"ethers>@ethersproject/transactions": true
230220
}
@@ -235,8 +225,8 @@
235225
"ethers>@ethersproject/base64": true,
236226
"@ethersproject/bignumber": true,
237227
"@ethersproject/bytes": true,
238-
"@ethersproject/abi>@ethersproject/keccak256": true,
239-
"@ethersproject/abi>@ethersproject/logger": true,
228+
"ethers>@ethersproject/keccak256": true,
229+
"ethers>@ethersproject/logger": true,
240230
"ethers>@ethersproject/properties": true,
241231
"ethers>@ethersproject/strings": true
242232
}
@@ -246,7 +236,7 @@
246236
"ethers>@ethersproject/basex": true,
247237
"@ethersproject/bignumber": true,
248238
"@ethersproject/bytes": true,
249-
"@ethersproject/abi>@ethersproject/logger": true,
239+
"ethers>@ethersproject/logger": true,
250240
"ethers>@ethersproject/pbkdf2": true,
251241
"ethers>@ethersproject/properties": true,
252242
"ethers>@ethersproject/sha2": true,
@@ -261,8 +251,8 @@
261251
"ethers>@ethersproject/address": true,
262252
"@ethersproject/bytes": true,
263253
"@ethersproject/hdnode": true,
264-
"@ethersproject/abi>@ethersproject/keccak256": true,
265-
"@ethersproject/abi>@ethersproject/logger": true,
254+
"ethers>@ethersproject/keccak256": true,
255+
"ethers>@ethersproject/logger": true,
266256
"ethers>@ethersproject/pbkdf2": true,
267257
"ethers>@ethersproject/properties": true,
268258
"ethers>@ethersproject/random": true,
@@ -272,41 +262,20 @@
272262
"ethers>@ethersproject/json-wallets>scrypt-js": true
273263
}
274264
},
275-
"@ethersproject/abi>@ethersproject/keccak256": {
276-
"packages": {
277-
"@ethersproject/bytes": true,
278-
"eth-ens-namehash>js-sha3": true
279-
}
280-
},
281265
"ethers>@ethersproject/keccak256": {
282266
"packages": {
283-
"ethers>@ethersproject/keccak256>@ethersproject/bytes": true,
267+
"@ethersproject/bytes": true,
284268
"eth-ens-namehash>js-sha3": true
285269
}
286270
},
287-
"@ethersproject/abi>@ethersproject/logger": {
288-
"globals": {
289-
"console": true
290-
}
291-
},
292-
"ethers>@ethersproject/keccak256>@ethersproject/bytes>@ethersproject/logger": {
293-
"globals": {
294-
"console": true
295-
}
296-
},
297-
"ethers>@ethersproject/bytes>@ethersproject/logger": {
298-
"globals": {
299-
"console": true
300-
}
301-
},
302271
"ethers>@ethersproject/logger": {
303272
"globals": {
304273
"console": true
305274
}
306275
},
307276
"ethers>@ethersproject/networks": {
308277
"packages": {
309-
"@ethersproject/abi>@ethersproject/logger": true
278+
"ethers>@ethersproject/logger": true
310279
}
311280
},
312281
"ethers>@ethersproject/pbkdf2": {
@@ -317,7 +286,7 @@
317286
},
318287
"ethers>@ethersproject/properties": {
319288
"packages": {
320-
"@ethersproject/abi>@ethersproject/logger": true
289+
"ethers>@ethersproject/logger": true
321290
}
322291
},
323292
"@ethersproject/providers": {
@@ -340,7 +309,7 @@
340309
"@ethersproject/bytes": true,
341310
"ethers>@ethersproject/constants": true,
342311
"ethers>@ethersproject/hash": true,
343-
"@ethersproject/abi>@ethersproject/logger": true,
312+
"ethers>@ethersproject/logger": true,
344313
"ethers>@ethersproject/networks": true,
345314
"ethers>@ethersproject/properties": true,
346315
"ethers>@ethersproject/random": true,
@@ -357,26 +326,26 @@
357326
},
358327
"packages": {
359328
"@ethersproject/bytes": true,
360-
"@ethersproject/abi>@ethersproject/logger": true
329+
"ethers>@ethersproject/logger": true
361330
}
362331
},
363332
"ethers>@ethersproject/rlp": {
364333
"packages": {
365334
"@ethersproject/bytes": true,
366-
"@ethersproject/abi>@ethersproject/logger": true
335+
"ethers>@ethersproject/logger": true
367336
}
368337
},
369338
"ethers>@ethersproject/sha2": {
370339
"packages": {
371340
"@ethersproject/bytes": true,
372-
"@ethersproject/abi>@ethersproject/logger": true,
341+
"ethers>@ethersproject/logger": true,
373342
"ethers>@ethersproject/sha2>hash.js": true
374343
}
375344
},
376345
"ethers>@ethersproject/signing-key": {
377346
"packages": {
378347
"@ethersproject/bytes": true,
379-
"@ethersproject/abi>@ethersproject/logger": true,
348+
"ethers>@ethersproject/logger": true,
380349
"ethers>@ethersproject/properties": true,
381350
"@toruslabs/eccrypto>elliptic": true
382351
}
@@ -385,8 +354,8 @@
385354
"packages": {
386355
"@ethersproject/bignumber": true,
387356
"@ethersproject/bytes": true,
388-
"@ethersproject/abi>@ethersproject/keccak256": true,
389-
"@ethersproject/abi>@ethersproject/logger": true,
357+
"ethers>@ethersproject/keccak256": true,
358+
"ethers>@ethersproject/logger": true,
390359
"ethers>@ethersproject/sha2": true,
391360
"ethers>@ethersproject/strings": true
392361
}
@@ -395,7 +364,7 @@
395364
"packages": {
396365
"@ethersproject/bytes": true,
397366
"ethers>@ethersproject/constants": true,
398-
"@ethersproject/abi>@ethersproject/logger": true
367+
"ethers>@ethersproject/logger": true
399368
}
400369
},
401370
"ethers>@ethersproject/transactions": {
@@ -404,8 +373,8 @@
404373
"@ethersproject/bignumber": true,
405374
"@ethersproject/bytes": true,
406375
"ethers>@ethersproject/constants": true,
407-
"@ethersproject/abi>@ethersproject/keccak256": true,
408-
"@ethersproject/abi>@ethersproject/logger": true,
376+
"ethers>@ethersproject/keccak256": true,
377+
"ethers>@ethersproject/logger": true,
409378
"ethers>@ethersproject/properties": true,
410379
"ethers>@ethersproject/rlp": true,
411380
"ethers>@ethersproject/signing-key": true
@@ -414,7 +383,7 @@
414383
"ethers>@ethersproject/units": {
415384
"packages": {
416385
"@ethersproject/bignumber": true,
417-
"@ethersproject/abi>@ethersproject/logger": true
386+
"ethers>@ethersproject/logger": true
418387
}
419388
},
420389
"ethers>@ethersproject/wallet": {
@@ -426,8 +395,8 @@
426395
"ethers>@ethersproject/hash": true,
427396
"@ethersproject/hdnode": true,
428397
"ethers>@ethersproject/json-wallets": true,
429-
"@ethersproject/abi>@ethersproject/keccak256": true,
430-
"@ethersproject/abi>@ethersproject/logger": true,
398+
"ethers>@ethersproject/keccak256": true,
399+
"ethers>@ethersproject/logger": true,
431400
"ethers>@ethersproject/properties": true,
432401
"ethers>@ethersproject/random": true,
433402
"ethers>@ethersproject/signing-key": true,
@@ -443,7 +412,7 @@
443412
"packages": {
444413
"ethers>@ethersproject/base64": true,
445414
"@ethersproject/bytes": true,
446-
"@ethersproject/abi>@ethersproject/logger": true,
415+
"ethers>@ethersproject/logger": true,
447416
"ethers>@ethersproject/properties": true,
448417
"ethers>@ethersproject/strings": true
449418
}
@@ -452,7 +421,7 @@
452421
"packages": {
453422
"@ethersproject/bytes": true,
454423
"ethers>@ethersproject/hash": true,
455-
"@ethersproject/abi>@ethersproject/logger": true,
424+
"ethers>@ethersproject/logger": true,
456425
"ethers>@ethersproject/properties": true,
457426
"ethers>@ethersproject/strings": true
458427
}
@@ -1900,7 +1869,7 @@
19001869
},
19011870
"packages": {
19021871
"@ethersproject/bytes": true,
1903-
"@ethersproject/abi>@ethersproject/keccak256": true,
1872+
"ethers>@ethersproject/keccak256": true,
19041873
"ethers>@ethersproject/transactions": true,
19051874
"@metamask/controller-utils": true,
19061875
"@metamask/controller-utils>@metamask/eth-query": true,
@@ -3468,7 +3437,7 @@
34683437
"ethers>@ethersproject/base64": true,
34693438
"ethers>@ethersproject/basex": true,
34703439
"@ethersproject/bignumber": true,
3471-
"ethers>@ethersproject/bytes": true,
3440+
"@ethersproject/bytes": true,
34723441
"ethers>@ethersproject/constants": true,
34733442
"@ethersproject/contracts": true,
34743443
"ethers>@ethersproject/hash": true,

0 commit comments

Comments
 (0)