Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use common test build during CI #7196

Merged
merged 2 commits into from
Sep 21, 2019
Merged

Use common test build during CI #7196

merged 2 commits into from
Sep 21, 2019

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Sep 19, 2019

Previously both e2e test jobs were running test:build. Now there is a separate job that runs test:build that runs before each e2e test job, so that test:build is only run once instead of twice.

Previously both e2e test jobs were running `test:build`. Now there is a
separate job that runs `test:build` that runs before each e2e test job,
so that `test:build` is only run once instead of twice.
@metamaskbot
Copy link
Collaborator

Builds ready [0793647]

This prevents the test build from conflicting with the production build
in later jobs.
@metamaskbot
Copy link
Collaborator

Builds ready [cec8c74]

@Gudahtt
Copy link
Member Author

Gudahtt commented Sep 20, 2019

I'm not entirely sure this ends up being faster 🤔. It's possible that it is.

@Gudahtt Gudahtt merged commit b0ec610 into develop Sep 21, 2019
Gudahtt added a commit to Gudahtt/metamask-extension that referenced this pull request Sep 27, 2019
* origin/develop: (56 commits)
  Add advanced setting to enable editing nonce on confirmation screens (MetaMask#7089)
  Add migration on 3box imports and remove feature flag (MetaMask#7209)
  ci - install deps - limit install scripts to whitelist (MetaMask#7208)
  Add a/b test for full screen transaction confirmations (MetaMask#7162)
  Update minimum Firefox verison to 56.0 (MetaMask#7213)
  mesh-testing - submit infura rpc requests to mesh-testing container (MetaMask#7031)
  obs-store/local-store should upgrade webextension error to real error (MetaMask#7207)
  sesify-viz - bump dep for visualization enhancement (MetaMask#7175)
  address book entries by chainId (MetaMask#7205)
  Optimize images only during production build (MetaMask#7194)
  Use common test build during CI (MetaMask#7196)
  Report missing `en` locale messages to Sentry (MetaMask#7197)
  Verify locales on CI (MetaMask#7199)
  updated ganache and addons-linter (MetaMask#7204)
  fixup! add user rejected errors
  add user rejected errors
  update json-rpc-engine
  use eth-json-rpc-errors
  Remove unused locale messages (MetaMask#7190)
  Remove unused components (MetaMask#7191)
  ...
@Gudahtt Gudahtt deleted the share-test-build-during-CI branch October 2, 2019 19:23
Gudahtt added a commit that referenced this pull request Nov 13, 2019
This reverts commit b0ec610, which was
introduced in #7196. This change was preventing the sourcemaps from
being uploaded correctly.
Gudahtt added a commit that referenced this pull request Nov 13, 2019
This reverts commit b0ec610, which was
introduced in #7196. This change was preventing the sourcemaps from
being uploaded correctly.
Gudahtt added a commit that referenced this pull request Jan 20, 2020
This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.
Gudahtt added a commit that referenced this pull request Jan 20, 2020
#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.
yqrashawn pushed a commit to yqrashawn/conflux-portal that referenced this pull request Feb 3, 2020
MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.
yqrashawn pushed a commit to Conflux-Chain/conflux-portal that referenced this pull request Feb 10, 2020
MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.
yqrashawn pushed a commit to Conflux-Chain/conflux-portal that referenced this pull request Feb 10, 2020
MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.
yqrashawn added a commit to Conflux-Chain/conflux-portal that referenced this pull request Feb 10, 2020
* Fix: release file blob

* Fix: circle ci artifact url

* Docs: issue templates, codeowners, docs, support emails

* Docs: move docs to conflux-portal-docs

* Fix: MetaMask -> ConfluxPortal in announcement script

* Fix: disable misleading changelog prefix

* Fix: shelllint

* Add page navigation to e2e web driver (MetaMask#7867)

The driver now has a page navigation function that can navigate to any
of the three primary pages used in the extension. Additional pages and
support of paths can be added later as needed.

* Revert the revert of "Use common test build during CI (MetaMask#7196)" (MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.

* Add `withFixtures` helper and simple-send test (MetaMask#7862)

The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes MetaMask#6548

* Add 1 second pause at the beginning of each e2e test run (MetaMask#7872)

There have been intermittent test failures at the beginning of various
e2e test runs. Most tests start with waiting for the 'Welcome' button
to be visible and enabled, which means waiting for the loading screen
to go away.

It looks like the reason the test intermittently fails is that
sometimes the loading screen doesn't appear until a few moments _after_
the page loads (or that it vanishes and comes back).

It was rather difficult to track down each possible cause for the
loading screens, so in the meantime a pause has been added at the start
of each run. This should hopefully suffice to ensure the momentary gap
in loading has been passed by the time the first test starts up.

* Remove unnecessary `shouldComponentUpdate` (MetaMask#7875)

The `confirm-seed-phrase` component extends PureComponent, so it
doesn't need a `shouldComponentUpdate` function. The state is
effectively immutable, as all state is either a primitive type or is
updated with new instances rather than mutation.

Removing this function will silence a warning message printed to the
console during e2e tests (React doesn't want you to set this function
on `PureComponent`s).

Removing this function also exposed an unused piece of state, which has
also been removed.

* Fix intermittent e2e test failure (MetaMask#7873)

The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.

* Add benchmark script (MetaMask#7869)

The script `benchmark.js` will collect page load metrics from the
extension, and print them to a file or the console. A method for
collecting metrics was added to the web driver to help with this.

This script will calculate the min, max, average, and standard
deviation for four metrics: 'firstPaint', 'domContentLoaded', 'load',
and 'domInteractive'. The variation between samples is sometimes high,
with the results varying between samples if only 3 were taken. However,
all tests I've done locally with 5 samples have produced results within
one standard deviation of each other. The default number of samples has
been set to 10, which should be more than enough to produce consistent
results.

The benchmark can be run with the npm script `benchmark:chrome` or
`benchmark:firefox`, e.g. `yarn benchmark:chrome`.

* Update inpage provider (MetaMask#7878)

* Remove unused browser-passworder dependency from package.json (MetaMask#7879)

* Change "Log In/Out" terminology to "Unlock/Lock" (MetaMask#7853)

* log out/in -> lock/unlock

* Add mechanism to randomize seed phrase filename (MetaMask#7863)

The filename is seeded by a simple use of Math.random() pulling from an alphanumeric character bank, as opposed to a more cryptographically random solution. This provides a simple layer of difficulty for bad actors to seek out the recovery phrase file.

* Use shared MetaMask ESLint config (MetaMask#7882)

* Remove unnecessary WebRTC shim (MetaMask#7886)

The WebRTC spec is fairly stable these days, particularly among the
browsers we support. We don't need this shim for anything. I'm guessing
it may have been added primarily with IE in mind.

* Replace DetectRTC package with standard web APIs (MetaMask#7887)

The only web API that our usage of DetectRTC relied upon was
'enumerateDevices', which is supported and stable among all of our
supported browsers.

Note that the error handling here is a little... non-standard, and the
logic around how Firefox and Brave are handled should be justified, but
I've left the logic as-is for now to keep this PR small.

* Add benchmark to CI (MetaMask#7871)

* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes MetaMask#6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.

* Use ref in Mascot component rather than reaching into DOM directly (MetaMask#7893)

Accessing the dom via `document` is strongly discouraged in React.
Instead the DOM element is now referenced by ref instead.

* Remove unnecessary `withRouter` and `compose` calls (MetaMask#7890)

`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.

* Remove unnecessary get environment type parameter (MetaMask#7891)

* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.

* Add top-level error page (MetaMask#7889)

Any error caught during a React component render or lifecycle method
will now be caught by the top-level error boundary, which shows the
user this new error page. The error page will display a simple error
message, and will show the details of the error in a collapsible
section.

The caught error is also reported to Sentry.

In development the error will be re-thrown to make it easier to see on
the console, but it is not re-thrown in production.

* Update GABA dependency version (MetaMask#7894)

* Replace `request-promise` with `node-fetch` (MetaMask#7899)

`node-fetch` is a smaller and simpler project than `request-promise`,
and we already have it as a transitive dependency.

`request-promise` was also incorrectly listed as a production
dependency. `node-fetch` has been added as a `devDependency` to replace
it, as it was only used in one CI script.

* Update Sentry to v5.x (MetaMask#7880)

Theses changes were made in accordance with the provided migration
guide [1].

The two integrations added were included by default on v4.x, so this
shouldn't result in any change in behavior.

[1]:  https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md

* Minimum changes to get storybook working (MetaMask#7884)

* Minimum changes to get storybook working

Undo path changes

* Add build:storybook scripts to package.json

* Add storybook deployer

* Add storybook:deploy to package.json

* Update circle ci config

* Update yarn.lock

* Remove addon-info

* Update yarn.lock file to reflect removing of addon-info

Co-authored-by: Dan J Miller <danjm.com@gmail.com>

* Fixing broken JSON import help link (MetaMask#7910)

* Remove xtend from the dependencies list (MetaMask#7902)

* Update `classnames` to `v2.2.6` (MetaMask#7906)

This patch update includes a bug fix for ES6 imports. The bug doesn't
affect our use of this module, but it ensures that we can safely
use the `dedupe` and `bind` APIs as ES6 imports if we decide to.

* Replace bluebird with Node.js API for unhandled rejections (MetaMask#7904)

Unhandled rejections are now caught using built-in Node.js APIs instead
of with `bluebird`. `bluebird` was added as a production dependency but
was only used for this purpose. The code responsible for catching
unhandled rejection in the browser was removed, as this test helper is
never run in the browser.

Additionally, unhandled rejections are tracked over the course of all
tests, and result in a non-zero exit code if they remain at the end.
This was done because it is possible for errors to trigger the
`uncaughtRejection` event but then still be handled later on. This is
uncommon, and doesn't seem to happen in our test suite. But if it does
in the future, it'll be logged but won't result in a non-zero exit
code.

* Comment out `storybook-deploy` step (MetaMask#7913)

The Storybook deploy step is currently broken because it's using the
wrong source branch (`master` instead of `develop`), and because the
key that CircleCI is setup with doesn't have write access to the repo.

While I expect we'll get these two problems fixed soon, this ensures
that we at least have passing builds on `develop` in the meantime.

* Switch to full lodash package, and update lodash (MetaMask#7907)

* Update lodash

All versions of the full `lodash` package have been updated to 4.17.15.
The only exception is v4.17.14 which is pinned by `ganache-core`.

* Switch to using `lodash` instead of per-method packages

We have the full lodash package _ten times_ as a production transitive
dependency, so including per-method packages is not saving space (it
might instead result in slightly more space being used).

* Update `c3` and `d3` (MetaMask#7905)

This updates include a number of bug fixes. The two charts we use these
libraries for appear unaffected.

* Replace `deep-extend` with `merge` from `lodash` (MetaMask#7908)

The `merge` function from `deep-extend` is at least mostly equivalent
to `merge` from `lodash` - certainly in how we're using it.

* Improve LoginPerSite UX/devX and permissions logging (MetaMask#7649)

Update accounts permission history on accountsChanged
Create PermissionsLogController
Fix permissions activity log pruning
Add selectors, background hooks for better UX
Make selected account the first account returned
Use enums for store keys in log controller
Add last selected address history to PreferencesController

* disable import button on Import Account screen for empty string/file (MetaMask#7912)

* disable import button on Import Account screen for empty string/file
* use refs to access DOM for import-account

* Update data on Approve screen after updating custom spend limit (MetaMask#7918)

After updating the custom spend limit on the approve screen, the data
for the transaction was not being updated. Instead it showed the
original transaction data. The transaction data was being updated
correctly in the final transaction though.

The approve screen has been updated to ensure changes to the custom
spend limit are reflected correctly in the data shown.

* Remove usage of unlisted extend dependency (MetaMask#7903)

* Remove JSDoc tools (MetaMask#7897)

Our JSDoc documentation has not been updated in a very long time, and
we don't use JSDoc in enough places for the docs to have been
especially useful. The tools and scripts  used to generate and publish
these docs have been removed.

References to this documentation have also been removed from the
README.

Hopefully once the TypeScript migration has made substantial progress,
we can generate more useful documentation using something like TypeDoc.

* Update jazzicon component (MetaMask#7898)

* Use ref instead of findDOMNode in jazzicon component

The jazzicon component was using `findDOMNode` to get the DOM node for
the main div returned by the component, which is generally not
recommended. Instead a ref is now used.

* Update Jazzicon to v2

This version drops the dependency upon `raphael`, and no longer uses
the function `createSVGMatrix` which was causing unit tests to fail
(because it's not supported by jsdom).

* Allow editing max spend limit (MetaMask#7919)

In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes MetaMask#7915

* Report errors in tests to `test-metamask` Sentry project (MetaMask#7924)

Previously, all errors encountered during testing or production were
sent to the primary `metamask` Sentry project, whereas development
errors were sent to `test-metamask` instead. This change ensures that
errors encountered during tests are sent to `test-metamask` as well.

* Bump Node version to 10.18 (MetaMask#7925)

* Remove top-level symlinks (MetaMask#7927)

* Replace `clone` dependency with `cloneDeep` from lodash (MetaMask#7926)

This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.

* Remove redux-logger from mock-store (MetaMask#7930)

* Delete unused .dockerignore file (MetaMask#7929)

* Replace `debounce` package with `debounce` function from `lodash` (MetaMask#7931)

These two functions differ slightly in options, but none of those
options are being used by us, so in these cases they're functionally
equivalent. They're even both descendants of the original `debounce`
function from `underscore`.

This was done to reduce the number of direct dependencies we have. It
should not affect bundle size, as we still depend upon the `debounce`
package transitively.

* Remove unused promise-filter dependency (MetaMask#7932)

* Validate custom spend limit (MetaMask#7920)

The custom spend limit was previously not validated. It did have a
minimum of zero set, but this didn't have any affect (that minimum is
used for form constraint validation, and this field wasn't in a form).
The field was never checked to ensure the contents didn't exceed the
maximum.

The field is now checked for values that exceed the maximum, and
invalid values in general (including negative values).

The parameters to the `showEditApprovalPermissionModal` were also
alphabetized to make them easier to read. In the course of doing this,
I noticed that the origin was missing from one of the calls. This was
responsible for the modal saying "Spend limit requested by undefined"
when clicking "Edit" under the transaction details. This has been
fixed.

* Delete outdated team page (MetaMask#7928)

* Replace mkdirp with built-in functionality (MetaMask#7934)

* Sorting seed phrase confirmation buttons alphabetically (MetaMask#7933)

* Replace fast-deep-equal with isEqual from lodash (MetaMask#7935)

* Move devDeps into devDeps (MetaMask#7936)

* Remove unused number-to-bn package (MetaMask#7937)

* Add Sentry environment (MetaMask#7923)

Any error sent to Sentry will now be marked with the environment they
were sent from. The environment is set at build time, and is set
dependant upon the build flags and CI-related environment variables.

Setting the environment will let us filter error reports in Sentry to
focus specifically upon reports sent from production, release
candidates, PR testing, or whatever else.

* Move polyfill-crypto.getrandomvalues to devDeps (MetaMask#7938)

* Remove unused fs-extra and fs-promise devDependencies (MetaMask#7939)

* Remove unused rimraf devDependency (MetaMask#7940)

* Remove unnecessary 'path' dependency (MetaMask#7942)

* Only resolve ENS on mainnet (MetaMask#7944)

The ENS resolver will now bail on any network other than mainnet.

* Remove unused mocha-eslint dependency (MetaMask#7943)

* Inline isomorphic-fetch test helper (MetaMask#7945)

* Remove dead link to team page in README (MetaMask#7946)

* Remove mocha-jsdom and mocha-sinon (MetaMask#7947)

* Explicitly set Sass compiler for gulp-sass (MetaMask#7948)

As per the gulp-sass docs [1] we should be setting the `sass.compiler` property
for forwards-compatibility "in case the default ever changes."

  [1]:https://github.com/dlmanning/gulp-sass/tree/v4.0.2#basic-usage

* ci: Update shellcheck version used in CI (MetaMask#7951)

* Move issue template and contributing doc to .github (MetaMask#7952)

* Remove gulp-eslint and gulp-util dependency (MetaMask#7949)

* Update ENS registry addresses (MetaMask#7954)

* Bump tree-kill version to fix high-severity vulnerability (MetaMask#7956)

* Bump node-sass to fix low-severity vulnerability (MetaMask#7955)

* Remove cross-env (MetaMask#7950)

* Various component tests and some conditional statements (MetaMask#7765)

* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in MetaMask#7893 has prevented the need to stub it out.

Change logout to lock in account-menu test

* Update ethereum-ens-network-map in lockfile (MetaMask#7959)

* Update yarn.lock cross-spawn versions
* Use ethereum-ens-network-map@1.0.2

* Use ethereum-ens-network-map for network support (MetaMask#7960)

* Add margin of error metric (MetaMask#7877)

* Fix: syntax error

* Fix: lint

* Fix: unit tests

* Fix: settings network tab react dup key error

* Fix: no need to pass benchmark test to release for now

* Updating deprecated Etherscam link  (MetaMask#7464)

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>

* Use envify@4.1.0 (MetaMask#7983)

* Use eth-json-rpc-infura@4.0.2 (MetaMask#7981)

* Use eth-keyring-controller@5.5.0 (MetaMask#7980)

* Use gulp@4.0.2 (MetaMask#7982)

* Remove redundant eth-*-keyring versions from yarn.lock (MetaMask#7984)

* Fixes MetaMask#5706 - Adds Dai/Sai to currency display (MetaMask#7986)

With the change from infura to cryptocompare https://github.com/MetaMask/gaba/pull/30/files#diff-50c3c47cc5fa12e5213a6cc900476f41L41-R48 we have numerous conversion rates to go through and add if we like to.

* Fix: speedup tx

* Add: testnet to http://testnet-jsonrpc.conflux-chain.org:12537/

* Fix: sign typed data

* Fix: conflicts with metamask, add testnet chainid

* Fix: test:lint

* Version v0.0.5

Co-authored-by: yqrashawn <namy.19@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: ryanml <ryanlanese@gmail.com>
Co-authored-by: ricky <ricky.miller@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Brandon Lucas <38222767+thebrandonlucas@users.noreply.github.com>
Co-authored-by: Thomas Huang <tmashuang@users.noreply.github.com>
Co-authored-by: Alice Henshaw <34962750+alicevhenshaw@users.noreply.github.com>
yqrashawn added a commit to yqrashawn/conflux-portal that referenced this pull request Feb 11, 2020
* Fix: release file blob

* Fix: circle ci artifact url

* Docs: issue templates, codeowners, docs, support emails

* Docs: move docs to conflux-portal-docs

* Fix: MetaMask -> ConfluxPortal in announcement script

* Fix: disable misleading changelog prefix

* Fix: shelllint

* Add page navigation to e2e web driver (MetaMask#7867)

The driver now has a page navigation function that can navigate to any
of the three primary pages used in the extension. Additional pages and
support of paths can be added later as needed.

* Revert the revert of "Use common test build during CI (MetaMask#7196)" (MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.

* Add `withFixtures` helper and simple-send test (MetaMask#7862)

The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes MetaMask#6548

* Add 1 second pause at the beginning of each e2e test run (MetaMask#7872)

There have been intermittent test failures at the beginning of various
e2e test runs. Most tests start with waiting for the 'Welcome' button
to be visible and enabled, which means waiting for the loading screen
to go away.

It looks like the reason the test intermittently fails is that
sometimes the loading screen doesn't appear until a few moments _after_
the page loads (or that it vanishes and comes back).

It was rather difficult to track down each possible cause for the
loading screens, so in the meantime a pause has been added at the start
of each run. This should hopefully suffice to ensure the momentary gap
in loading has been passed by the time the first test starts up.

* Remove unnecessary `shouldComponentUpdate` (MetaMask#7875)

The `confirm-seed-phrase` component extends PureComponent, so it
doesn't need a `shouldComponentUpdate` function. The state is
effectively immutable, as all state is either a primitive type or is
updated with new instances rather than mutation.

Removing this function will silence a warning message printed to the
console during e2e tests (React doesn't want you to set this function
on `PureComponent`s).

Removing this function also exposed an unused piece of state, which has
also been removed.

* Fix intermittent e2e test failure (MetaMask#7873)

The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.

* Add benchmark script (MetaMask#7869)

The script `benchmark.js` will collect page load metrics from the
extension, and print them to a file or the console. A method for
collecting metrics was added to the web driver to help with this.

This script will calculate the min, max, average, and standard
deviation for four metrics: 'firstPaint', 'domContentLoaded', 'load',
and 'domInteractive'. The variation between samples is sometimes high,
with the results varying between samples if only 3 were taken. However,
all tests I've done locally with 5 samples have produced results within
one standard deviation of each other. The default number of samples has
been set to 10, which should be more than enough to produce consistent
results.

The benchmark can be run with the npm script `benchmark:chrome` or
`benchmark:firefox`, e.g. `yarn benchmark:chrome`.

* Update inpage provider (MetaMask#7878)

* Remove unused browser-passworder dependency from package.json (MetaMask#7879)

* Change "Log In/Out" terminology to "Unlock/Lock" (MetaMask#7853)

* log out/in -> lock/unlock

* Add mechanism to randomize seed phrase filename (MetaMask#7863)

The filename is seeded by a simple use of Math.random() pulling from an alphanumeric character bank, as opposed to a more cryptographically random solution. This provides a simple layer of difficulty for bad actors to seek out the recovery phrase file.

* Use shared MetaMask ESLint config (MetaMask#7882)

* Remove unnecessary WebRTC shim (MetaMask#7886)

The WebRTC spec is fairly stable these days, particularly among the
browsers we support. We don't need this shim for anything. I'm guessing
it may have been added primarily with IE in mind.

* Replace DetectRTC package with standard web APIs (MetaMask#7887)

The only web API that our usage of DetectRTC relied upon was
'enumerateDevices', which is supported and stable among all of our
supported browsers.

Note that the error handling here is a little... non-standard, and the
logic around how Firefox and Brave are handled should be justified, but
I've left the logic as-is for now to keep this PR small.

* Add benchmark to CI (MetaMask#7871)

* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes MetaMask#6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.

* Use ref in Mascot component rather than reaching into DOM directly (MetaMask#7893)

Accessing the dom via `document` is strongly discouraged in React.
Instead the DOM element is now referenced by ref instead.

* Remove unnecessary `withRouter` and `compose` calls (MetaMask#7890)

`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.

* Remove unnecessary get environment type parameter (MetaMask#7891)

* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.

* Add top-level error page (MetaMask#7889)

Any error caught during a React component render or lifecycle method
will now be caught by the top-level error boundary, which shows the
user this new error page. The error page will display a simple error
message, and will show the details of the error in a collapsible
section.

The caught error is also reported to Sentry.

In development the error will be re-thrown to make it easier to see on
the console, but it is not re-thrown in production.

* Update GABA dependency version (MetaMask#7894)

* Replace `request-promise` with `node-fetch` (MetaMask#7899)

`node-fetch` is a smaller and simpler project than `request-promise`,
and we already have it as a transitive dependency.

`request-promise` was also incorrectly listed as a production
dependency. `node-fetch` has been added as a `devDependency` to replace
it, as it was only used in one CI script.

* Update Sentry to v5.x (MetaMask#7880)

Theses changes were made in accordance with the provided migration
guide [1].

The two integrations added were included by default on v4.x, so this
shouldn't result in any change in behavior.

[1]:  https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md

* Minimum changes to get storybook working (MetaMask#7884)

* Minimum changes to get storybook working

Undo path changes

* Add build:storybook scripts to package.json

* Add storybook deployer

* Add storybook:deploy to package.json

* Update circle ci config

* Update yarn.lock

* Remove addon-info

* Update yarn.lock file to reflect removing of addon-info

Co-authored-by: Dan J Miller <danjm.com@gmail.com>

* Fixing broken JSON import help link (MetaMask#7910)

* Remove xtend from the dependencies list (MetaMask#7902)

* Update `classnames` to `v2.2.6` (MetaMask#7906)

This patch update includes a bug fix for ES6 imports. The bug doesn't
affect our use of this module, but it ensures that we can safely
use the `dedupe` and `bind` APIs as ES6 imports if we decide to.

* Replace bluebird with Node.js API for unhandled rejections (MetaMask#7904)

Unhandled rejections are now caught using built-in Node.js APIs instead
of with `bluebird`. `bluebird` was added as a production dependency but
was only used for this purpose. The code responsible for catching
unhandled rejection in the browser was removed, as this test helper is
never run in the browser.

Additionally, unhandled rejections are tracked over the course of all
tests, and result in a non-zero exit code if they remain at the end.
This was done because it is possible for errors to trigger the
`uncaughtRejection` event but then still be handled later on. This is
uncommon, and doesn't seem to happen in our test suite. But if it does
in the future, it'll be logged but won't result in a non-zero exit
code.

* Comment out `storybook-deploy` step (MetaMask#7913)

The Storybook deploy step is currently broken because it's using the
wrong source branch (`master` instead of `develop`), and because the
key that CircleCI is setup with doesn't have write access to the repo.

While I expect we'll get these two problems fixed soon, this ensures
that we at least have passing builds on `develop` in the meantime.

* Switch to full lodash package, and update lodash (MetaMask#7907)

* Update lodash

All versions of the full `lodash` package have been updated to 4.17.15.
The only exception is v4.17.14 which is pinned by `ganache-core`.

* Switch to using `lodash` instead of per-method packages

We have the full lodash package _ten times_ as a production transitive
dependency, so including per-method packages is not saving space (it
might instead result in slightly more space being used).

* Update `c3` and `d3` (MetaMask#7905)

This updates include a number of bug fixes. The two charts we use these
libraries for appear unaffected.

* Replace `deep-extend` with `merge` from `lodash` (MetaMask#7908)

The `merge` function from `deep-extend` is at least mostly equivalent
to `merge` from `lodash` - certainly in how we're using it.

* Improve LoginPerSite UX/devX and permissions logging (MetaMask#7649)

Update accounts permission history on accountsChanged
Create PermissionsLogController
Fix permissions activity log pruning
Add selectors, background hooks for better UX
Make selected account the first account returned
Use enums for store keys in log controller
Add last selected address history to PreferencesController

* disable import button on Import Account screen for empty string/file (MetaMask#7912)

* disable import button on Import Account screen for empty string/file
* use refs to access DOM for import-account

* Update data on Approve screen after updating custom spend limit (MetaMask#7918)

After updating the custom spend limit on the approve screen, the data
for the transaction was not being updated. Instead it showed the
original transaction data. The transaction data was being updated
correctly in the final transaction though.

The approve screen has been updated to ensure changes to the custom
spend limit are reflected correctly in the data shown.

* Remove usage of unlisted extend dependency (MetaMask#7903)

* Remove JSDoc tools (MetaMask#7897)

Our JSDoc documentation has not been updated in a very long time, and
we don't use JSDoc in enough places for the docs to have been
especially useful. The tools and scripts  used to generate and publish
these docs have been removed.

References to this documentation have also been removed from the
README.

Hopefully once the TypeScript migration has made substantial progress,
we can generate more useful documentation using something like TypeDoc.

* Update jazzicon component (MetaMask#7898)

* Use ref instead of findDOMNode in jazzicon component

The jazzicon component was using `findDOMNode` to get the DOM node for
the main div returned by the component, which is generally not
recommended. Instead a ref is now used.

* Update Jazzicon to v2

This version drops the dependency upon `raphael`, and no longer uses
the function `createSVGMatrix` which was causing unit tests to fail
(because it's not supported by jsdom).

* Allow editing max spend limit (MetaMask#7919)

In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes MetaMask#7915

* Report errors in tests to `test-metamask` Sentry project (MetaMask#7924)

Previously, all errors encountered during testing or production were
sent to the primary `metamask` Sentry project, whereas development
errors were sent to `test-metamask` instead. This change ensures that
errors encountered during tests are sent to `test-metamask` as well.

* Bump Node version to 10.18 (MetaMask#7925)

* Remove top-level symlinks (MetaMask#7927)

* Replace `clone` dependency with `cloneDeep` from lodash (MetaMask#7926)

This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.

* Remove redux-logger from mock-store (MetaMask#7930)

* Delete unused .dockerignore file (MetaMask#7929)

* Replace `debounce` package with `debounce` function from `lodash` (MetaMask#7931)

These two functions differ slightly in options, but none of those
options are being used by us, so in these cases they're functionally
equivalent. They're even both descendants of the original `debounce`
function from `underscore`.

This was done to reduce the number of direct dependencies we have. It
should not affect bundle size, as we still depend upon the `debounce`
package transitively.

* Remove unused promise-filter dependency (MetaMask#7932)

* Validate custom spend limit (MetaMask#7920)

The custom spend limit was previously not validated. It did have a
minimum of zero set, but this didn't have any affect (that minimum is
used for form constraint validation, and this field wasn't in a form).
The field was never checked to ensure the contents didn't exceed the
maximum.

The field is now checked for values that exceed the maximum, and
invalid values in general (including negative values).

The parameters to the `showEditApprovalPermissionModal` were also
alphabetized to make them easier to read. In the course of doing this,
I noticed that the origin was missing from one of the calls. This was
responsible for the modal saying "Spend limit requested by undefined"
when clicking "Edit" under the transaction details. This has been
fixed.

* Delete outdated team page (MetaMask#7928)

* Replace mkdirp with built-in functionality (MetaMask#7934)

* Sorting seed phrase confirmation buttons alphabetically (MetaMask#7933)

* Replace fast-deep-equal with isEqual from lodash (MetaMask#7935)

* Move devDeps into devDeps (MetaMask#7936)

* Remove unused number-to-bn package (MetaMask#7937)

* Add Sentry environment (MetaMask#7923)

Any error sent to Sentry will now be marked with the environment they
were sent from. The environment is set at build time, and is set
dependant upon the build flags and CI-related environment variables.

Setting the environment will let us filter error reports in Sentry to
focus specifically upon reports sent from production, release
candidates, PR testing, or whatever else.

* Move polyfill-crypto.getrandomvalues to devDeps (MetaMask#7938)

* Remove unused fs-extra and fs-promise devDependencies (MetaMask#7939)

* Remove unused rimraf devDependency (MetaMask#7940)

* Remove unnecessary 'path' dependency (MetaMask#7942)

* Only resolve ENS on mainnet (MetaMask#7944)

The ENS resolver will now bail on any network other than mainnet.

* Remove unused mocha-eslint dependency (MetaMask#7943)

* Inline isomorphic-fetch test helper (MetaMask#7945)

* Remove dead link to team page in README (MetaMask#7946)

* Remove mocha-jsdom and mocha-sinon (MetaMask#7947)

* Explicitly set Sass compiler for gulp-sass (MetaMask#7948)

As per the gulp-sass docs [1] we should be setting the `sass.compiler` property
for forwards-compatibility "in case the default ever changes."

  [1]:https://github.com/dlmanning/gulp-sass/tree/v4.0.2#basic-usage

* ci: Update shellcheck version used in CI (MetaMask#7951)

* Move issue template and contributing doc to .github (MetaMask#7952)

* Remove gulp-eslint and gulp-util dependency (MetaMask#7949)

* Update ENS registry addresses (MetaMask#7954)

* Bump tree-kill version to fix high-severity vulnerability (MetaMask#7956)

* Bump node-sass to fix low-severity vulnerability (MetaMask#7955)

* Remove cross-env (MetaMask#7950)

* Various component tests and some conditional statements (MetaMask#7765)

* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in MetaMask#7893 has prevented the need to stub it out.

Change logout to lock in account-menu test

* Update ethereum-ens-network-map in lockfile (MetaMask#7959)

* Update yarn.lock cross-spawn versions
* Use ethereum-ens-network-map@1.0.2

* Use ethereum-ens-network-map for network support (MetaMask#7960)

* Add margin of error metric (MetaMask#7877)

* Fix: syntax error

* Fix: lint

* Fix: unit tests

* Fix: settings network tab react dup key error

* Fix: no need to pass benchmark test to release for now

* Updating deprecated Etherscam link  (MetaMask#7464)

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>

* Use envify@4.1.0 (MetaMask#7983)

* Use eth-json-rpc-infura@4.0.2 (MetaMask#7981)

* Use eth-keyring-controller@5.5.0 (MetaMask#7980)

* Use gulp@4.0.2 (MetaMask#7982)

* Remove redundant eth-*-keyring versions from yarn.lock (MetaMask#7984)

* Fixes MetaMask#5706 - Adds Dai/Sai to currency display (MetaMask#7986)

With the change from infura to cryptocompare https://github.com/MetaMask/gaba/pull/30/files#diff-50c3c47cc5fa12e5213a6cc900476f41L41-R48 we have numerous conversion rates to go through and add if we like to.

* Fix: speedup tx

* Add: testnet to http://testnet-jsonrpc.conflux-chain.org:12537/

* Fix: sign typed data

* Fix: conflicts with metamask, add testnet chainid

* Fix: test:lint

* Version v0.0.5

Co-authored-by: yqrashawn <namy.19@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: ryanml <ryanlanese@gmail.com>
Co-authored-by: ricky <ricky.miller@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Brandon Lucas <38222767+thebrandonlucas@users.noreply.github.com>
Co-authored-by: Thomas Huang <tmashuang@users.noreply.github.com>
Co-authored-by: Alice Henshaw <34962750+alicevhenshaw@users.noreply.github.com>
yqrashawn added a commit to yqrashawn/conflux-portal that referenced this pull request Feb 11, 2020
* Fix: release file blob

* Fix: circle ci artifact url

* Docs: issue templates, codeowners, docs, support emails

* Docs: move docs to conflux-portal-docs

* Fix: MetaMask -> ConfluxPortal in announcement script

* Fix: disable misleading changelog prefix

* Fix: shelllint

* Add page navigation to e2e web driver (MetaMask#7867)

The driver now has a page navigation function that can navigate to any
of the three primary pages used in the extension. Additional pages and
support of paths can be added later as needed.

* Revert the revert of "Use common test build during CI (MetaMask#7196)" (MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.

* Add `withFixtures` helper and simple-send test (MetaMask#7862)

The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes MetaMask#6548

* Add 1 second pause at the beginning of each e2e test run (MetaMask#7872)

There have been intermittent test failures at the beginning of various
e2e test runs. Most tests start with waiting for the 'Welcome' button
to be visible and enabled, which means waiting for the loading screen
to go away.

It looks like the reason the test intermittently fails is that
sometimes the loading screen doesn't appear until a few moments _after_
the page loads (or that it vanishes and comes back).

It was rather difficult to track down each possible cause for the
loading screens, so in the meantime a pause has been added at the start
of each run. This should hopefully suffice to ensure the momentary gap
in loading has been passed by the time the first test starts up.

* Remove unnecessary `shouldComponentUpdate` (MetaMask#7875)

The `confirm-seed-phrase` component extends PureComponent, so it
doesn't need a `shouldComponentUpdate` function. The state is
effectively immutable, as all state is either a primitive type or is
updated with new instances rather than mutation.

Removing this function will silence a warning message printed to the
console during e2e tests (React doesn't want you to set this function
on `PureComponent`s).

Removing this function also exposed an unused piece of state, which has
also been removed.

* Fix intermittent e2e test failure (MetaMask#7873)

The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.

* Add benchmark script (MetaMask#7869)

The script `benchmark.js` will collect page load metrics from the
extension, and print them to a file or the console. A method for
collecting metrics was added to the web driver to help with this.

This script will calculate the min, max, average, and standard
deviation for four metrics: 'firstPaint', 'domContentLoaded', 'load',
and 'domInteractive'. The variation between samples is sometimes high,
with the results varying between samples if only 3 were taken. However,
all tests I've done locally with 5 samples have produced results within
one standard deviation of each other. The default number of samples has
been set to 10, which should be more than enough to produce consistent
results.

The benchmark can be run with the npm script `benchmark:chrome` or
`benchmark:firefox`, e.g. `yarn benchmark:chrome`.

* Update inpage provider (MetaMask#7878)

* Remove unused browser-passworder dependency from package.json (MetaMask#7879)

* Change "Log In/Out" terminology to "Unlock/Lock" (MetaMask#7853)

* log out/in -> lock/unlock

* Add mechanism to randomize seed phrase filename (MetaMask#7863)

The filename is seeded by a simple use of Math.random() pulling from an alphanumeric character bank, as opposed to a more cryptographically random solution. This provides a simple layer of difficulty for bad actors to seek out the recovery phrase file.

* Use shared MetaMask ESLint config (MetaMask#7882)

* Remove unnecessary WebRTC shim (MetaMask#7886)

The WebRTC spec is fairly stable these days, particularly among the
browsers we support. We don't need this shim for anything. I'm guessing
it may have been added primarily with IE in mind.

* Replace DetectRTC package with standard web APIs (MetaMask#7887)

The only web API that our usage of DetectRTC relied upon was
'enumerateDevices', which is supported and stable among all of our
supported browsers.

Note that the error handling here is a little... non-standard, and the
logic around how Firefox and Brave are handled should be justified, but
I've left the logic as-is for now to keep this PR small.

* Add benchmark to CI (MetaMask#7871)

* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes MetaMask#6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.

* Use ref in Mascot component rather than reaching into DOM directly (MetaMask#7893)

Accessing the dom via `document` is strongly discouraged in React.
Instead the DOM element is now referenced by ref instead.

* Remove unnecessary `withRouter` and `compose` calls (MetaMask#7890)

`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.

* Remove unnecessary get environment type parameter (MetaMask#7891)

* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.

* Add top-level error page (MetaMask#7889)

Any error caught during a React component render or lifecycle method
will now be caught by the top-level error boundary, which shows the
user this new error page. The error page will display a simple error
message, and will show the details of the error in a collapsible
section.

The caught error is also reported to Sentry.

In development the error will be re-thrown to make it easier to see on
the console, but it is not re-thrown in production.

* Update GABA dependency version (MetaMask#7894)

* Replace `request-promise` with `node-fetch` (MetaMask#7899)

`node-fetch` is a smaller and simpler project than `request-promise`,
and we already have it as a transitive dependency.

`request-promise` was also incorrectly listed as a production
dependency. `node-fetch` has been added as a `devDependency` to replace
it, as it was only used in one CI script.

* Update Sentry to v5.x (MetaMask#7880)

Theses changes were made in accordance with the provided migration
guide [1].

The two integrations added were included by default on v4.x, so this
shouldn't result in any change in behavior.

[1]:  https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md

* Minimum changes to get storybook working (MetaMask#7884)

* Minimum changes to get storybook working

Undo path changes

* Add build:storybook scripts to package.json

* Add storybook deployer

* Add storybook:deploy to package.json

* Update circle ci config

* Update yarn.lock

* Remove addon-info

* Update yarn.lock file to reflect removing of addon-info

Co-authored-by: Dan J Miller <danjm.com@gmail.com>

* Fixing broken JSON import help link (MetaMask#7910)

* Remove xtend from the dependencies list (MetaMask#7902)

* Update `classnames` to `v2.2.6` (MetaMask#7906)

This patch update includes a bug fix for ES6 imports. The bug doesn't
affect our use of this module, but it ensures that we can safely
use the `dedupe` and `bind` APIs as ES6 imports if we decide to.

* Replace bluebird with Node.js API for unhandled rejections (MetaMask#7904)

Unhandled rejections are now caught using built-in Node.js APIs instead
of with `bluebird`. `bluebird` was added as a production dependency but
was only used for this purpose. The code responsible for catching
unhandled rejection in the browser was removed, as this test helper is
never run in the browser.

Additionally, unhandled rejections are tracked over the course of all
tests, and result in a non-zero exit code if they remain at the end.
This was done because it is possible for errors to trigger the
`uncaughtRejection` event but then still be handled later on. This is
uncommon, and doesn't seem to happen in our test suite. But if it does
in the future, it'll be logged but won't result in a non-zero exit
code.

* Comment out `storybook-deploy` step (MetaMask#7913)

The Storybook deploy step is currently broken because it's using the
wrong source branch (`master` instead of `develop`), and because the
key that CircleCI is setup with doesn't have write access to the repo.

While I expect we'll get these two problems fixed soon, this ensures
that we at least have passing builds on `develop` in the meantime.

* Switch to full lodash package, and update lodash (MetaMask#7907)

* Update lodash

All versions of the full `lodash` package have been updated to 4.17.15.
The only exception is v4.17.14 which is pinned by `ganache-core`.

* Switch to using `lodash` instead of per-method packages

We have the full lodash package _ten times_ as a production transitive
dependency, so including per-method packages is not saving space (it
might instead result in slightly more space being used).

* Update `c3` and `d3` (MetaMask#7905)

This updates include a number of bug fixes. The two charts we use these
libraries for appear unaffected.

* Replace `deep-extend` with `merge` from `lodash` (MetaMask#7908)

The `merge` function from `deep-extend` is at least mostly equivalent
to `merge` from `lodash` - certainly in how we're using it.

* Improve LoginPerSite UX/devX and permissions logging (MetaMask#7649)

Update accounts permission history on accountsChanged
Create PermissionsLogController
Fix permissions activity log pruning
Add selectors, background hooks for better UX
Make selected account the first account returned
Use enums for store keys in log controller
Add last selected address history to PreferencesController

* disable import button on Import Account screen for empty string/file (MetaMask#7912)

* disable import button on Import Account screen for empty string/file
* use refs to access DOM for import-account

* Update data on Approve screen after updating custom spend limit (MetaMask#7918)

After updating the custom spend limit on the approve screen, the data
for the transaction was not being updated. Instead it showed the
original transaction data. The transaction data was being updated
correctly in the final transaction though.

The approve screen has been updated to ensure changes to the custom
spend limit are reflected correctly in the data shown.

* Remove usage of unlisted extend dependency (MetaMask#7903)

* Remove JSDoc tools (MetaMask#7897)

Our JSDoc documentation has not been updated in a very long time, and
we don't use JSDoc in enough places for the docs to have been
especially useful. The tools and scripts  used to generate and publish
these docs have been removed.

References to this documentation have also been removed from the
README.

Hopefully once the TypeScript migration has made substantial progress,
we can generate more useful documentation using something like TypeDoc.

* Update jazzicon component (MetaMask#7898)

* Use ref instead of findDOMNode in jazzicon component

The jazzicon component was using `findDOMNode` to get the DOM node for
the main div returned by the component, which is generally not
recommended. Instead a ref is now used.

* Update Jazzicon to v2

This version drops the dependency upon `raphael`, and no longer uses
the function `createSVGMatrix` which was causing unit tests to fail
(because it's not supported by jsdom).

* Allow editing max spend limit (MetaMask#7919)

In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes MetaMask#7915

* Report errors in tests to `test-metamask` Sentry project (MetaMask#7924)

Previously, all errors encountered during testing or production were
sent to the primary `metamask` Sentry project, whereas development
errors were sent to `test-metamask` instead. This change ensures that
errors encountered during tests are sent to `test-metamask` as well.

* Bump Node version to 10.18 (MetaMask#7925)

* Remove top-level symlinks (MetaMask#7927)

* Replace `clone` dependency with `cloneDeep` from lodash (MetaMask#7926)

This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.

* Remove redux-logger from mock-store (MetaMask#7930)

* Delete unused .dockerignore file (MetaMask#7929)

* Replace `debounce` package with `debounce` function from `lodash` (MetaMask#7931)

These two functions differ slightly in options, but none of those
options are being used by us, so in these cases they're functionally
equivalent. They're even both descendants of the original `debounce`
function from `underscore`.

This was done to reduce the number of direct dependencies we have. It
should not affect bundle size, as we still depend upon the `debounce`
package transitively.

* Remove unused promise-filter dependency (MetaMask#7932)

* Validate custom spend limit (MetaMask#7920)

The custom spend limit was previously not validated. It did have a
minimum of zero set, but this didn't have any affect (that minimum is
used for form constraint validation, and this field wasn't in a form).
The field was never checked to ensure the contents didn't exceed the
maximum.

The field is now checked for values that exceed the maximum, and
invalid values in general (including negative values).

The parameters to the `showEditApprovalPermissionModal` were also
alphabetized to make them easier to read. In the course of doing this,
I noticed that the origin was missing from one of the calls. This was
responsible for the modal saying "Spend limit requested by undefined"
when clicking "Edit" under the transaction details. This has been
fixed.

* Delete outdated team page (MetaMask#7928)

* Replace mkdirp with built-in functionality (MetaMask#7934)

* Sorting seed phrase confirmation buttons alphabetically (MetaMask#7933)

* Replace fast-deep-equal with isEqual from lodash (MetaMask#7935)

* Move devDeps into devDeps (MetaMask#7936)

* Remove unused number-to-bn package (MetaMask#7937)

* Add Sentry environment (MetaMask#7923)

Any error sent to Sentry will now be marked with the environment they
were sent from. The environment is set at build time, and is set
dependant upon the build flags and CI-related environment variables.

Setting the environment will let us filter error reports in Sentry to
focus specifically upon reports sent from production, release
candidates, PR testing, or whatever else.

* Move polyfill-crypto.getrandomvalues to devDeps (MetaMask#7938)

* Remove unused fs-extra and fs-promise devDependencies (MetaMask#7939)

* Remove unused rimraf devDependency (MetaMask#7940)

* Remove unnecessary 'path' dependency (MetaMask#7942)

* Only resolve ENS on mainnet (MetaMask#7944)

The ENS resolver will now bail on any network other than mainnet.

* Remove unused mocha-eslint dependency (MetaMask#7943)

* Inline isomorphic-fetch test helper (MetaMask#7945)

* Remove dead link to team page in README (MetaMask#7946)

* Remove mocha-jsdom and mocha-sinon (MetaMask#7947)

* Explicitly set Sass compiler for gulp-sass (MetaMask#7948)

As per the gulp-sass docs [1] we should be setting the `sass.compiler` property
for forwards-compatibility "in case the default ever changes."

  [1]:https://github.com/dlmanning/gulp-sass/tree/v4.0.2#basic-usage

* ci: Update shellcheck version used in CI (MetaMask#7951)

* Move issue template and contributing doc to .github (MetaMask#7952)

* Remove gulp-eslint and gulp-util dependency (MetaMask#7949)

* Update ENS registry addresses (MetaMask#7954)

* Bump tree-kill version to fix high-severity vulnerability (MetaMask#7956)

* Bump node-sass to fix low-severity vulnerability (MetaMask#7955)

* Remove cross-env (MetaMask#7950)

* Various component tests and some conditional statements (MetaMask#7765)

* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in MetaMask#7893 has prevented the need to stub it out.

Change logout to lock in account-menu test

* Update ethereum-ens-network-map in lockfile (MetaMask#7959)

* Update yarn.lock cross-spawn versions
* Use ethereum-ens-network-map@1.0.2

* Use ethereum-ens-network-map for network support (MetaMask#7960)

* Add margin of error metric (MetaMask#7877)

* Fix: syntax error

* Fix: lint

* Fix: unit tests

* Fix: settings network tab react dup key error

* Fix: no need to pass benchmark test to release for now

* Updating deprecated Etherscam link  (MetaMask#7464)

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>

* Use envify@4.1.0 (MetaMask#7983)

* Use eth-json-rpc-infura@4.0.2 (MetaMask#7981)

* Use eth-keyring-controller@5.5.0 (MetaMask#7980)

* Use gulp@4.0.2 (MetaMask#7982)

* Remove redundant eth-*-keyring versions from yarn.lock (MetaMask#7984)

* Fixes MetaMask#5706 - Adds Dai/Sai to currency display (MetaMask#7986)

With the change from infura to cryptocompare https://github.com/MetaMask/gaba/pull/30/files#diff-50c3c47cc5fa12e5213a6cc900476f41L41-R48 we have numerous conversion rates to go through and add if we like to.

* Fix: speedup tx

* Add: testnet to http://testnet-jsonrpc.conflux-chain.org:12537/

* Fix: sign typed data

* Fix: conflicts with metamask, add testnet chainid

* Fix: test:lint

* Version v0.0.5

Co-authored-by: yqrashawn <namy.19@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: ryanml <ryanlanese@gmail.com>
Co-authored-by: ricky <ricky.miller@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Brandon Lucas <38222767+thebrandonlucas@users.noreply.github.com>
Co-authored-by: Thomas Huang <tmashuang@users.noreply.github.com>
Co-authored-by: Alice Henshaw <34962750+alicevhenshaw@users.noreply.github.com>
yqrashawn added a commit to yqrashawn/conflux-portal that referenced this pull request Feb 11, 2020
* Fix: release file blob

* Fix: circle ci artifact url

* Docs: issue templates, codeowners, docs, support emails

* Docs: move docs to conflux-portal-docs

* Fix: MetaMask -> ConfluxPortal in announcement script

* Fix: disable misleading changelog prefix

* Fix: shelllint

* Add page navigation to e2e web driver (MetaMask#7867)

The driver now has a page navigation function that can navigate to any
of the three primary pages used in the extension. Additional pages and
support of paths can be added later as needed.

* Revert the revert of "Use common test build during CI (MetaMask#7196)" (MetaMask#7404) (MetaMask#7870)

This reverts commit 4b4c00e. The
original change was a possible optimization of CI, though it ended up
not having a huge impact. It was thought that it may have broken source
maps, because the test build overwrote the `dist` directory that the
source maps were written to. However this turned out not to be the
case, as the changes to `dist` are never persisted to the workspace.

This is being re-introduced because the test build is needed for an
additional job (the page load benchmark), and sharing the same build
for all three jobs would surely be faster than building it separately
three times.

* Add `withFixtures` helper and simple-send test (MetaMask#7862)

The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes MetaMask#6548

* Add 1 second pause at the beginning of each e2e test run (MetaMask#7872)

There have been intermittent test failures at the beginning of various
e2e test runs. Most tests start with waiting for the 'Welcome' button
to be visible and enabled, which means waiting for the loading screen
to go away.

It looks like the reason the test intermittently fails is that
sometimes the loading screen doesn't appear until a few moments _after_
the page loads (or that it vanishes and comes back).

It was rather difficult to track down each possible cause for the
loading screens, so in the meantime a pause has been added at the start
of each run. This should hopefully suffice to ensure the momentary gap
in loading has been passed by the time the first test starts up.

* Remove unnecessary `shouldComponentUpdate` (MetaMask#7875)

The `confirm-seed-phrase` component extends PureComponent, so it
doesn't need a `shouldComponentUpdate` function. The state is
effectively immutable, as all state is either a primitive type or is
updated with new instances rather than mutation.

Removing this function will silence a warning message printed to the
console during e2e tests (React doesn't want you to set this function
on `PureComponent`s).

Removing this function also exposed an unused piece of state, which has
also been removed.

* Fix intermittent e2e test failure (MetaMask#7873)

The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.

* Add benchmark script (MetaMask#7869)

The script `benchmark.js` will collect page load metrics from the
extension, and print them to a file or the console. A method for
collecting metrics was added to the web driver to help with this.

This script will calculate the min, max, average, and standard
deviation for four metrics: 'firstPaint', 'domContentLoaded', 'load',
and 'domInteractive'. The variation between samples is sometimes high,
with the results varying between samples if only 3 were taken. However,
all tests I've done locally with 5 samples have produced results within
one standard deviation of each other. The default number of samples has
been set to 10, which should be more than enough to produce consistent
results.

The benchmark can be run with the npm script `benchmark:chrome` or
`benchmark:firefox`, e.g. `yarn benchmark:chrome`.

* Update inpage provider (MetaMask#7878)

* Remove unused browser-passworder dependency from package.json (MetaMask#7879)

* Change "Log In/Out" terminology to "Unlock/Lock" (MetaMask#7853)

* log out/in -> lock/unlock

* Add mechanism to randomize seed phrase filename (MetaMask#7863)

The filename is seeded by a simple use of Math.random() pulling from an alphanumeric character bank, as opposed to a more cryptographically random solution. This provides a simple layer of difficulty for bad actors to seek out the recovery phrase file.

* Use shared MetaMask ESLint config (MetaMask#7882)

* Remove unnecessary WebRTC shim (MetaMask#7886)

The WebRTC spec is fairly stable these days, particularly among the
browsers we support. We don't need this shim for anything. I'm guessing
it may have been added primarily with IE in mind.

* Replace DetectRTC package with standard web APIs (MetaMask#7887)

The only web API that our usage of DetectRTC relied upon was
'enumerateDevices', which is supported and stable among all of our
supported browsers.

Note that the error handling here is a little... non-standard, and the
logic around how Firefox and Brave are handled should be justified, but
I've left the logic as-is for now to keep this PR small.

* Add benchmark to CI (MetaMask#7871)

* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes MetaMask#6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.

* Use ref in Mascot component rather than reaching into DOM directly (MetaMask#7893)

Accessing the dom via `document` is strongly discouraged in React.
Instead the DOM element is now referenced by ref instead.

* Remove unnecessary `withRouter` and `compose` calls (MetaMask#7890)

`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.

* Remove unnecessary get environment type parameter (MetaMask#7891)

* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.

* Add top-level error page (MetaMask#7889)

Any error caught during a React component render or lifecycle method
will now be caught by the top-level error boundary, which shows the
user this new error page. The error page will display a simple error
message, and will show the details of the error in a collapsible
section.

The caught error is also reported to Sentry.

In development the error will be re-thrown to make it easier to see on
the console, but it is not re-thrown in production.

* Update GABA dependency version (MetaMask#7894)

* Replace `request-promise` with `node-fetch` (MetaMask#7899)

`node-fetch` is a smaller and simpler project than `request-promise`,
and we already have it as a transitive dependency.

`request-promise` was also incorrectly listed as a production
dependency. `node-fetch` has been added as a `devDependency` to replace
it, as it was only used in one CI script.

* Update Sentry to v5.x (MetaMask#7880)

Theses changes were made in accordance with the provided migration
guide [1].

The two integrations added were included by default on v4.x, so this
shouldn't result in any change in behavior.

[1]:  https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md

* Minimum changes to get storybook working (MetaMask#7884)

* Minimum changes to get storybook working

Undo path changes

* Add build:storybook scripts to package.json

* Add storybook deployer

* Add storybook:deploy to package.json

* Update circle ci config

* Update yarn.lock

* Remove addon-info

* Update yarn.lock file to reflect removing of addon-info

Co-authored-by: Dan J Miller <danjm.com@gmail.com>

* Fixing broken JSON import help link (MetaMask#7910)

* Remove xtend from the dependencies list (MetaMask#7902)

* Update `classnames` to `v2.2.6` (MetaMask#7906)

This patch update includes a bug fix for ES6 imports. The bug doesn't
affect our use of this module, but it ensures that we can safely
use the `dedupe` and `bind` APIs as ES6 imports if we decide to.

* Replace bluebird with Node.js API for unhandled rejections (MetaMask#7904)

Unhandled rejections are now caught using built-in Node.js APIs instead
of with `bluebird`. `bluebird` was added as a production dependency but
was only used for this purpose. The code responsible for catching
unhandled rejection in the browser was removed, as this test helper is
never run in the browser.

Additionally, unhandled rejections are tracked over the course of all
tests, and result in a non-zero exit code if they remain at the end.
This was done because it is possible for errors to trigger the
`uncaughtRejection` event but then still be handled later on. This is
uncommon, and doesn't seem to happen in our test suite. But if it does
in the future, it'll be logged but won't result in a non-zero exit
code.

* Comment out `storybook-deploy` step (MetaMask#7913)

The Storybook deploy step is currently broken because it's using the
wrong source branch (`master` instead of `develop`), and because the
key that CircleCI is setup with doesn't have write access to the repo.

While I expect we'll get these two problems fixed soon, this ensures
that we at least have passing builds on `develop` in the meantime.

* Switch to full lodash package, and update lodash (MetaMask#7907)

* Update lodash

All versions of the full `lodash` package have been updated to 4.17.15.
The only exception is v4.17.14 which is pinned by `ganache-core`.

* Switch to using `lodash` instead of per-method packages

We have the full lodash package _ten times_ as a production transitive
dependency, so including per-method packages is not saving space (it
might instead result in slightly more space being used).

* Update `c3` and `d3` (MetaMask#7905)

This updates include a number of bug fixes. The two charts we use these
libraries for appear unaffected.

* Replace `deep-extend` with `merge` from `lodash` (MetaMask#7908)

The `merge` function from `deep-extend` is at least mostly equivalent
to `merge` from `lodash` - certainly in how we're using it.

* Improve LoginPerSite UX/devX and permissions logging (MetaMask#7649)

Update accounts permission history on accountsChanged
Create PermissionsLogController
Fix permissions activity log pruning
Add selectors, background hooks for better UX
Make selected account the first account returned
Use enums for store keys in log controller
Add last selected address history to PreferencesController

* disable import button on Import Account screen for empty string/file (MetaMask#7912)

* disable import button on Import Account screen for empty string/file
* use refs to access DOM for import-account

* Update data on Approve screen after updating custom spend limit (MetaMask#7918)

After updating the custom spend limit on the approve screen, the data
for the transaction was not being updated. Instead it showed the
original transaction data. The transaction data was being updated
correctly in the final transaction though.

The approve screen has been updated to ensure changes to the custom
spend limit are reflected correctly in the data shown.

* Remove usage of unlisted extend dependency (MetaMask#7903)

* Remove JSDoc tools (MetaMask#7897)

Our JSDoc documentation has not been updated in a very long time, and
we don't use JSDoc in enough places for the docs to have been
especially useful. The tools and scripts  used to generate and publish
these docs have been removed.

References to this documentation have also been removed from the
README.

Hopefully once the TypeScript migration has made substantial progress,
we can generate more useful documentation using something like TypeDoc.

* Update jazzicon component (MetaMask#7898)

* Use ref instead of findDOMNode in jazzicon component

The jazzicon component was using `findDOMNode` to get the DOM node for
the main div returned by the component, which is generally not
recommended. Instead a ref is now used.

* Update Jazzicon to v2

This version drops the dependency upon `raphael`, and no longer uses
the function `createSVGMatrix` which was causing unit tests to fail
(because it's not supported by jsdom).

* Allow editing max spend limit (MetaMask#7919)

In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes MetaMask#7915

* Report errors in tests to `test-metamask` Sentry project (MetaMask#7924)

Previously, all errors encountered during testing or production were
sent to the primary `metamask` Sentry project, whereas development
errors were sent to `test-metamask` instead. This change ensures that
errors encountered during tests are sent to `test-metamask` as well.

* Bump Node version to 10.18 (MetaMask#7925)

* Remove top-level symlinks (MetaMask#7927)

* Replace `clone` dependency with `cloneDeep` from lodash (MetaMask#7926)

This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.

* Remove redux-logger from mock-store (MetaMask#7930)

* Delete unused .dockerignore file (MetaMask#7929)

* Replace `debounce` package with `debounce` function from `lodash` (MetaMask#7931)

These two functions differ slightly in options, but none of those
options are being used by us, so in these cases they're functionally
equivalent. They're even both descendants of the original `debounce`
function from `underscore`.

This was done to reduce the number of direct dependencies we have. It
should not affect bundle size, as we still depend upon the `debounce`
package transitively.

* Remove unused promise-filter dependency (MetaMask#7932)

* Validate custom spend limit (MetaMask#7920)

The custom spend limit was previously not validated. It did have a
minimum of zero set, but this didn't have any affect (that minimum is
used for form constraint validation, and this field wasn't in a form).
The field was never checked to ensure the contents didn't exceed the
maximum.

The field is now checked for values that exceed the maximum, and
invalid values in general (including negative values).

The parameters to the `showEditApprovalPermissionModal` were also
alphabetized to make them easier to read. In the course of doing this,
I noticed that the origin was missing from one of the calls. This was
responsible for the modal saying "Spend limit requested by undefined"
when clicking "Edit" under the transaction details. This has been
fixed.

* Delete outdated team page (MetaMask#7928)

* Replace mkdirp with built-in functionality (MetaMask#7934)

* Sorting seed phrase confirmation buttons alphabetically (MetaMask#7933)

* Replace fast-deep-equal with isEqual from lodash (MetaMask#7935)

* Move devDeps into devDeps (MetaMask#7936)

* Remove unused number-to-bn package (MetaMask#7937)

* Add Sentry environment (MetaMask#7923)

Any error sent to Sentry will now be marked with the environment they
were sent from. The environment is set at build time, and is set
dependant upon the build flags and CI-related environment variables.

Setting the environment will let us filter error reports in Sentry to
focus specifically upon reports sent from production, release
candidates, PR testing, or whatever else.

* Move polyfill-crypto.getrandomvalues to devDeps (MetaMask#7938)

* Remove unused fs-extra and fs-promise devDependencies (MetaMask#7939)

* Remove unused rimraf devDependency (MetaMask#7940)

* Remove unnecessary 'path' dependency (MetaMask#7942)

* Only resolve ENS on mainnet (MetaMask#7944)

The ENS resolver will now bail on any network other than mainnet.

* Remove unused mocha-eslint dependency (MetaMask#7943)

* Inline isomorphic-fetch test helper (MetaMask#7945)

* Remove dead link to team page in README (MetaMask#7946)

* Remove mocha-jsdom and mocha-sinon (MetaMask#7947)

* Explicitly set Sass compiler for gulp-sass (MetaMask#7948)

As per the gulp-sass docs [1] we should be setting the `sass.compiler` property
for forwards-compatibility "in case the default ever changes."

  [1]:https://github.com/dlmanning/gulp-sass/tree/v4.0.2#basic-usage

* ci: Update shellcheck version used in CI (MetaMask#7951)

* Move issue template and contributing doc to .github (MetaMask#7952)

* Remove gulp-eslint and gulp-util dependency (MetaMask#7949)

* Update ENS registry addresses (MetaMask#7954)

* Bump tree-kill version to fix high-severity vulnerability (MetaMask#7956)

* Bump node-sass to fix low-severity vulnerability (MetaMask#7955)

* Remove cross-env (MetaMask#7950)

* Various component tests and some conditional statements (MetaMask#7765)

* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in MetaMask#7893 has prevented the need to stub it out.

Change logout to lock in account-menu test

* Update ethereum-ens-network-map in lockfile (MetaMask#7959)

* Update yarn.lock cross-spawn versions
* Use ethereum-ens-network-map@1.0.2

* Use ethereum-ens-network-map for network support (MetaMask#7960)

* Add margin of error metric (MetaMask#7877)

* Fix: syntax error

* Fix: lint

* Fix: unit tests

* Fix: settings network tab react dup key error

* Fix: no need to pass benchmark test to release for now

* Updating deprecated Etherscam link  (MetaMask#7464)

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>

* Use envify@4.1.0 (MetaMask#7983)

* Use eth-json-rpc-infura@4.0.2 (MetaMask#7981)

* Use eth-keyring-controller@5.5.0 (MetaMask#7980)

* Use gulp@4.0.2 (MetaMask#7982)

* Remove redundant eth-*-keyring versions from yarn.lock (MetaMask#7984)

* Fixes MetaMask#5706 - Adds Dai/Sai to currency display (MetaMask#7986)

With the change from infura to cryptocompare https://github.com/MetaMask/gaba/pull/30/files#diff-50c3c47cc5fa12e5213a6cc900476f41L41-R48 we have numerous conversion rates to go through and add if we like to.

* Fix: speedup tx

* Add: testnet to http://testnet-jsonrpc.conflux-chain.org:12537/

* Fix: sign typed data

* Fix: conflicts with metamask, add testnet chainid

* Fix: test:lint

* Version v0.0.5

Co-authored-by: yqrashawn <namy.19@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: ryanml <ryanlanese@gmail.com>
Co-authored-by: ricky <ricky.miller@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Brandon Lucas <38222767+thebrandonlucas@users.noreply.github.com>
Co-authored-by: Thomas Huang <tmashuang@users.noreply.github.com>
Co-authored-by: Alice Henshaw <34962750+alicevhenshaw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants