1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00
Commit Graph

284 Commits

Author SHA1 Message Date
Brad Decker
6d1170f06c
upgrade yarn to version 3 (#16232)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: ricky <ricky.miller@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net>
2022-12-08 10:38:04 -06:00
Frederik Bolding
6416936eec
Fix production builds for Flask (#16757) 2022-12-01 14:19:14 +01:00
seaona
f44af06f9b
[e2e] Setup MV3 specific test folder and add 1 simple testcase introducing Service Worker re-start (#16606)
* First e2e mv3 specific dapp testcase

* Fix testpath for snaps

* Update `it` description

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* e2e test paths improvement

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-11-25 12:06:48 +01:00
Elliot Winkler
51cffa15dd
Migrate to new controller packages (#16547)
* Migrate to new controller packages

`@metamask/controllers` is deprecated, and most of the controllers that
lived here are now located in their own package ([1]). This commit
replaces `@metamask/controllers` in `package.json` with references to
these packages and updates `import` lines to match.

[1]: https://github.com/MetaMask/controllers/pull/831

* Support GitHub registry for draft PRs (#16549)

* Add additional allowed host to lockfile linter

* Update LavaMoat policies

* Add policy exception for nanoid

* Add additional nanoid overrides

* Update LavaMoat policies again

* Bump controller packages

* Update lavamoat

* Bump controller packages

* Update packages to v1.0.0

* Expand gitignore comment

* Unpin controller dependencies, using ^ range instead

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-11-24 16:29:07 -03:30
Mark Stacey
65f2f17695
Fix bundle size diff message (#16576)
The bundle size diff message is using the wrong point of comparision,
leading to misleading results on feature branches that have been
merged with `develop` since they were created.

When this feature was introduced, we went back and forth a few times on
what we should be comparing the branch with to get an accurate bundle
size comparison.

The first attempt used `develop` as the point of comparison, but that
didn't work because it was a moving target, and because it didn't
reflect the changes made on this branch. As bundle increases or
decreases were added on `develop`, they would alter the diff on each
feature PR.

Then we chose to use the fork-point of the branch, the commit of
`develop` that the branch forked off of. This works for feature
branches that don't merge in `develop`. But the minute `develop` gets
merged in, then unrelated changes on `develop` affect the measurement.

The _most recent_ commit from `develop` on the current branch is a
better comparison. Any difference between this commit and the feature
branch in terms of bundle size would be attributable to the feature
branch changes. This is what `merge-base` gives us.
2022-11-23 13:35:57 -03:30
George Marshall
45ad946697
Removing storybook tests (#16577) 2022-11-18 07:32:20 -08:00
Dan J Miller
27e8f0ffaa
Ensure prod beta build is created when merging to master (#16557)
* Ensure prod beta build is created when merging to master

* Fix: remove negation

* Update .circleci/config.yml

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-11-17 17:05:13 -03:30
Peter Yinusa
d39c0f8096
Upgrade geckodriver to latest version, run ci tests with Firefox v106.0.4 (#16383)
* update geckodriver

* update ff binary in ci

* dedupe
2022-11-10 11:16:02 +00:00
Michele Esposito
522eb72e49
chore: add bundle size diff to metamaskbot (#16098) 2022-11-09 09:02:44 -06:00
Frederik Bolding
02088e445d
Parallelize E2E tests to cut CI time in half (#16417)
* Experiment with parallellizing E2E

* Fix lint

* Try parallelism 8

* Apply suggestions from code review

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-11-08 18:28:06 +01:00
seaona
c246eaa8e2
Updating chromedriver to last stable version (#16310)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-11-02 11:14:43 +01:00
Peter Yinusa
65e3047a74
Chromedriver v106 (#16213)
* update chromedriver

* update chrome binary in ci
2022-10-24 14:36:08 +01:00
Michele Esposito
c00749dcf7
ci: fix stats-module-load-init step (#16196) 2022-10-18 17:47:13 -05:00
Michele Esposito
41e3ab189c
chore: add build stats history json file (#16168) 2022-10-13 11:59:22 +02:00
seaona
1b3dc0db54
[MV3] Add e2e chrome test job for MV3 build (#15991)
* Add filter tag

* Fix tag

* test tag

* fix

* Changed tag

* Add test-e2e-chrome

* Filter by branch instead of tag

* Move tests to correct mv3 folder

* Remove ignore from e2e regular chrome job

* Remove filter, so it's run on all PRs

* Handling red X for MV3 e2e failures

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-10-10 14:33:13 +02:00
Mark Stacey
e4dc8ce012
Fix intermittent storybook build failure (#16124)
The CI job for building storybook will fail occasionally, presumably
due to a Node.js process running out of heap memory. This job is the
only build job that runs with default Node.js memory settings.

It has been updated to use a larger instance size and to set the heap
size to 2GB, matching our other build jobs.
2022-10-07 13:08:38 -02:30
seaona
dd660f83ae
Add test insights on circle ci for test-unit job (#15839)
* Test results for jest

* Add jest-junit package for reporting

* Order alphabetically
2022-09-19 13:30:34 +02:00
Jyoti Puri
441e894e9a
Graph improvements (#15793) 2022-09-16 22:26:36 +05:30
seaona
d322c89bb2
Updating Chromedriver to the last version (#15798)
* Updating Chromedriver to the last version

* Update Chrome version to last stable v105
2022-09-13 16:31:19 +02:00
legobeat
ef9d5d117b
chore: Adjust trailing whitespace (#15636)
Co-authored-by: ryanml <ryanlanese@gmail.com>
2022-08-24 14:11:49 -05:00
Mark Stacey
48c02ef641
Add validation to production build script (#15468)
Validation has been added to the build script when the "prod" target is
selected. We now ensure that all expected environment variables are
set, and that no extra environment variables are present (which might
indicate that the wrong configuration file is being used).

The `prod` target uses a new `.metamaskprodrc` configuration file. Each
required variable can be specified either via environment variable or
via this config file. CI will continue set these via environment
variable, but for local manual builds we can use the config file to
simplify the build process and ensure consistency.

A new "dist" target has been added to preserve the ability to build a
"production-like" build without this validation.

The config validation is invoked early in the script, in the CLI
argument parsing step, so that it would fail more quickly. Otherwise
we'd have to wait a few minutes longer for the validation to run.
This required some refactoring, moving functions to the utility module
and moving the config to a dedicated module.

Additionally, support has been added for all environment variables to
be set via the config file. Previously the values `PUBNUB_PUB_KEY`,
`PUBNUB_SUB_KEY`, `SENTRY_DSN`, and `SWAPS_USE_DEV_APIS` could only be
set via environment variable. Now, all of these variables can be set
either way.

Closes #15003
2022-08-19 15:46:18 -02:30
Erik Marks
8210e3a812
Convert LavaMoat policy generation script to Yargs application (#15626)
This PR converts `generate-lavamoat-policies.sh` to `.js` using Yargs. This makes it easier to only generate policy files for a specific build type (using the `-t` flag), which is often useful during Flask development. In addition, the `lavamoat:background:auto` scripts are renamed, and the main readme is updated with some useful tips.

Note that `lavamoat:background:auto:dev` is removed and `lavamoat:background:auto` should be used during local development.
2022-08-18 16:09:26 -07:00
seaona
437acdb74c
Capture user actions times for MV2 benchmark and generate artifacts (#15353)
* User actions benchmark and artifacts

* Lint and fix identation

* Fix lint

* Updated path

* lint

* Add user actions benchmark to pre release job

* Remove title

* Out path updated

* See if url is finally fixed

* Adding some console logs

* lint

* fix lint

* fix lint

* Updated persisting and store artifacts path

* Added MetaMask bot correct link and remove console logs

* Remove console log

* Sort Imports

* Fix lint

* Update loadAccount function and prop name for clarity to loadNewAccount

* Run yarn setup

* Fix yarn

* Update Create Account element for Create account

* Remove unnecessary step on send

Co-authored-by: Jyoti Puri <jyotipuri@gmail.com>
2022-08-12 19:41:20 +02:00
Elliot Winkler
024b41546b
Fix deployment of TS migration dashboard (again) (#15528)
An improper deploy key was used to deploy the TypeScript
migration dashboard. A new key has been created on the GitHub side for
the `metamask-extension-ts-migration-dashboard` repo and also added to
CircleCI. The new fingerprint for this key is provided in this commit.
This should hopefully make it possible for us to deploy to this repo
from CircleCI.
2022-08-10 12:38:43 -06:00
Elliot Winkler
2dc8ba32da
Fix deploying the TS migration dashboard (#15516)
When the TypeScript migration dashboard is updated, it is built and
deployed in another repo, which is then deployed via GitHub Pages. To
push to this repo we have to set a Git username and email. This is
missing from the CircleCI config, so this commit uses the metamaskbot
GitHub account to do that.
2022-08-10 09:45:21 -06:00
Elliot Winkler
a7d98b695f
Add TypeScript migration dashboard (#13820)
As we convert parts of the codebase to TypeScript, we will want a way to
track progress. This commit adds a dashboard which displays all of the
files that we wish to convert to TypeScript and which files we've
already converted.

The list of all possible files to convert is predetermined by walking
the dependency graph of each entrypoint the build system uses to compile
the extension (the files that the entrypoint imports, the files that the
imports import, etc). The list should not need to be regenerated, but
you can do it by running:

    yarn ts-migration:enumerate

The dashboard is implemented as a separate React app. The CircleCI
configuration has been updated so that when a new commit is pushed, the
React app is built and stored in the CircleCI artifacts. When a PR is
merged, the built files will be pushed to a separate repo whose sole
purpose is to serve the dashboard via GitHub Pages (this is the same
way that the Storybook works). All of the app code and script to build
the app are self-contained under
`development/ts-migration-dashboard`. To build this app yourself, you
can run:

    yarn ts-migration:dashboard:build

or if you want to build automatically as you change files, run:

    yarn ts-migration:dashboard:watch

Then open the following file in your browser (there is no server
component):

    development/ts-migration-dashboard/build/index.html

Finally, although you shouldn't have to do this, to manually deploy the
dashboard once built, you can run:

    git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git
    yarn ts-migration:dashboard:deploy
2022-08-09 14:16:08 -06:00
Jyoti Puri
d4075b099f
Fix for script to measure bundle size over time (#15338) 2022-07-27 16:37:15 +05:30
Jyoti Puri
80c830373e
Fix build (#15328) 2022-07-23 00:40:08 +05:30
Jyoti Puri
45f5635cd8
Bundlesize stats over time (#15209)
* Adding tasks for MV3 test build

* more changes

* fix

* fix

* fix

* MV3 CI fixes

* fixes

* fix

* Initial work to capture the logs, write to file, and parse it.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* chrome debug logs

* Pull logs from webdriver and save to json file.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* comment out stats stuffs

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint Fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove console.log

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* fixes

* Adding build artifact for initialisation time

* change

* fix lint

* fix

* fix

* fix

* fix

* fixes

* Capturing load time stats

* fix

* fix

* fix

* fix

* fix build

* fix

* fix

* fix

* fix

* fix

* Initial work to capture the logs, write to file, and parse it.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* chrome debug logs

* Pull logs from webdriver and save to json file.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* comment out stats stuffs

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint Fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove console.log

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* fix

* fix

* fix

* fix

* Initial work to capture the logs, write to file, and parse it.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

chrome debug logs

Pull logs from webdriver and save to json file.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

Remove console.log

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

split output of lavamoat to 2 files. background and ui

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* fix

* fix

* fix

* Enable logging to chrome_debug only if in MV3

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* fix

* fix

* fix

* fixes

* fix

* fix

* fix

* fix

* fixes

* test

* test

* fix

* fix

* MV3 bundle size stats

* fix

* Committing bundle size status to extension_bundlesize_stats repo

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* Initial commit

* Initial commit

* Initial commit

* Initial commit

* fixes

* fix

* fix

* fix

* fix

* fix

* fix

Co-authored-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
2022-07-21 12:25:18 -10:00
Jyoti Puri
45cecf385d
Adding artifacts (#15145) 2022-07-20 19:33:16 +04:00
Jyoti Puri
aeb0147846
Adding tasks for MV3 test build (#15133) 2022-07-14 03:34:33 +04:00
Erik Marks
08cc6c5e77
Bump minimum Node.js version to 16 (#15131) 2022-07-02 23:32:18 -07:00
PeterYinusa
4e1dbc6194
State logs e2e (#15123)
* download dir

* state logs e2e

* update ff version
2022-07-01 20:46:12 +01:00
PeterYinusa
bf9140aa57
Chromedriver v103 (#15015)
* update chromdriver to v103

* update chrome binary to v103
2022-06-24 08:41:55 -04:00
PeterYinusa
2fd4549333
Update chromedriver and chrome binary (#14877)
* Update chromedriver and chrome binary

* yarn deduplicate
2022-06-07 16:02:11 +01:00
PeterYinusa
12cda5eb2d
Chromedriver v101 (#14617)
* update chromedriver package

* update chrome binary used in ci
2022-05-11 13:17:49 +01:00
PeterYinusa
4127583224
Jest tests - incremental coverage (#14612)
* add jest-it-up dependancy

* add reporter

* post test run jest-it-up

* Add CI check

* update coverage

* deduplicate dependancies
2022-05-04 17:02:42 +01:00
ricky
0fd1cea1fe
Feature/remove bitmask (#14489)
* remove bitmask

* add --fail-on-missing-exclusions

* add .iyarc
2022-04-21 17:58:57 -04:00
kumavis
0f4417684b
unblock ci: update vuln deps + fix npm registry for snaps firefox (#14437)
* dep-audit-fix for async@2.6.3

* deps - update async for vuln fix and remove patch

* deps/ci-yarn-audit - remove outdated ignored vulns

* deps/lock - deduplicate async@2

* deps/lock - deduplicate async@2 + remove indirectly used dep

* Use regular NPM registry for snaps on Firefox (#14439)

* Use regular NPM registry for snaps on FF

* Fix linting

* Update app/scripts/metamask-controller.js

Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Shane <jonas.shane@gmail.com>
2022-04-13 17:28:03 -10:00
PeterYinusa
1582efdc06
update chromedriver and chrome binary to v100 (#14337) 2022-04-04 16:02:54 +01:00
PeterYinusa
c07e477c13
E2e metrics (#13904)
* remove metrics build

* remove segment server from tests

* enable cors

* mock segment globally

* metrics e2e test

* running test builds

* move file

* destructuring
2022-03-15 13:17:48 -03:00
Mark Stacey
6aaeab2f24
Automate the Flask release process (#13898)
* Automate the Flask release

A Flask release will now be published alongside each main extension
release. The version of each Flask release will be the same as the
extension version except it will have the suffix `-flask.0`.

* Programmatically remove build prefix

The create GH release Bash script derives the Flask version from the
Flask build filename by removing the build prefix, leaving just the
version. Rather than hard-coding the prefix size to remove, it is now
calculated programmatically so that it is easier to read and update.

* Fix tag publishing

The tab publishing step used the wrong credentials, and didn't properly
identify the commit author. This has now been fixed.
2022-03-15 08:54:37 -02:30
Shane
1f55af3151
Fixed firefox Snaps + add initial end-to-end tests (#13671)
* Changed registryUrl for snaps only in firefox
Fixed getPlatform to only be imported into metamask-controller in flask
Removed snaps specific testrunner script and use run-all with a cli option

* Fixed flakey tests

* Removed unneeded await

* Added delay

* Fixed linting
2022-03-10 14:01:55 -08:00
PeterYinusa
4f6eb02854
update chromedriver (#13854) 2022-03-07 19:05:58 +00:00
PeterYinusa
2b1256faf4
Update to latest ChromeDriver (#13616) 2022-02-14 17:06:10 +00:00
PeterYinusa
2b010710ae
update chromedriver to v97 (#13502) 2022-02-03 15:02:56 +00:00
Brad Decker
022f0efcd7
Update vulnerability ignore list (#13390) 2022-01-25 14:34:50 -06:00
Erik Marks
31cf7c10a4
Permission System 2.0 (#12243)
# Permission System 2.0

## Background

This PR migrates the extension permission system to [the new `PermissionController`](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions).
The original permission system, based on [`rpc-cap`](https://github.com/MetaMask/rpc-cap), introduced [`ZCAP-LD`](https://w3c-ccg.github.io/zcap-ld/)-like permissions to our JSON-RPC stack.
We used it to [implement](https://github.com/MetaMask/metamask-extension/pull/7004) what we called "LoginPerSite" in [version 7.7.0](https://github.com/MetaMask/metamask-extension/releases/tag/v7.7.0) of the extension, which enabled the user to choose which accounts, if any, should be exposed to each dapp.
While that was a worthwhile feature in and of itself, we wanted a permission _system_ in order to enable everything we are going to with Snaps.
Unfortunately, the original permission system was difficult to use, and necessitated the creation of the original `PermissionsController` (note the "s"), which was more or less a wrapper for `rpc-cap`.

With this PR, we shake off the yoke of the original permission system, in favor of the modular, self-contained, ergonomic, and more mature permission system 2.0.

Note that [the `PermissionController` readme](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions/README.md) explains how the new permission system works.

The `PermissionController` and `SubjectMetadataController` are currently shipped via `@metamask/snap-controllers`. This is a temporary state of affairs, and we'll move them to `@metamask/controllers` once they've landed in prod.

## Changes in Detail

First, the changes in this PR are not as big as they seem. Roughly half of the additions in this PR are fixtures in the test for the new migration (number 68), and a significant portion of the remaining ~2500 lines are due to find-and-replace changes in other test fixtures and UI files.

- The extension `PermissionsController` has been deleted, and completely replaced with the new `PermissionController` from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The original `PermissionsController` "domain metadata" functionality is now managed by the new `SubjectMetadataController`, also from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The permission activity and history log controller has been renamed `PermissionLogController` and has its own top-level state key, but is otherwise functionally equivalent to the existing implementation.
- Migration number 68 has been added to account for the new state changes.
- The tests in `app/scripts/controllers/permissions` have been migrated from `mocha` to `jest`.

Reviewers should focus their attention on the following files:

- `app/scripts/`
  - `metamask-controller.js`
    - This is where most of the integration work for the new `PermissionController` occurs.
      Some functions that were internal to the original controller were moved here.
  - `controllers/permissions/`
    - `selectors.js`
      - These selectors are for `ControllerMessenger` selector subscriptions. The actual subscriptions occur in `metamask-controller.js`. See the `ControllerMessenger` implementation for details.
    - `specifications.js`
      - The caveat and permission specifications are required by the new `PermissionController`, and are used to specify the `eth_accounts` permission and its JSON-RPC method implementation.
        See the `PermissionController` readme for details.
  - `migrations/068.js`
    - The new state should be cross-referenced with the controllers that manage it.
      The accompanying tests should also be thoroughly reviewed.

Some files may appear new but have just moved and/or been renamed:

- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js`
  - This was previously implemented in `controllers/permissions/permissionsMethodMiddleware.js`.
- `test/mocks/permissions.js`
  - A truncated version of `test/mocks/permission-controller.js`.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-12-06 19:16:49 -08:00
PeterYinusa
9babc8b804
update chromedriver to v96 (#12921) 2021-12-01 18:21:29 +00:00
Dan J Miller
76158bf26b
Use node-browsers-medium-plus executor for validate-lavamoat-config job (#12884) 2021-11-29 17:34:51 -03:30