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

Only resolve ENS on mainnet #7944

Merged
merged 1 commit into from
Jan 30, 2020
Merged

Only resolve ENS on mainnet #7944

merged 1 commit into from
Jan 30, 2020

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jan 30, 2020

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

The ENS resolver will now bail on any network other than mainnet.
@metamaskbot
Copy link
Collaborator

Builds ready [b49ea7b]
Page Load Metrics (605 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeNotificationfirstPaint338844157
domContentLoaded563647603199
load565649605199
domInteractive563647603199

Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

LGTM

@Gudahtt Gudahtt merged commit ee41505 into develop Jan 30, 2020
@Gudahtt Gudahtt deleted the only-resolve-ens-on-mainnet branch January 30, 2020 00:57
Gudahtt added a commit that referenced this pull request Jan 30, 2020
The ENS resolver will now bail on any network other than mainnet.
@xmaysonnave
Copy link
Contributor

Why that? The new registry has been deployed with the same address on mainnet, rinkeby, goerli and ropsten? How are we supposed to test and develop? Thanks for your comments.

@xmaysonnave
Copy link
Contributor

@Gudahtt
Copy link
Member Author

Gudahtt commented Jan 31, 2020

This is just for the ENS resolver that acts on addresses in the browser address bar; there were usability concerns with resolving testnet addresses there, as the user might not know what the current network is.

ENS resolution for the input fields will still work on mainnet and Ropsten (as it had before), and support for the other testnets is in develop already and will be included in a future release.

@xmaysonnave
Copy link
Contributor

As far as I know MetaMask is the only tool in the browser who gives the flexibility to resolve wherever ENS is deployed and supported. This is a great plus.
IMHO, I see this PR as a regression as it has financial and organisational impact.

@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 1, 2020

I would appreciate it if you could explain why testnet ENS resolution in the browser address bar in particular is a useful feature for you, or why you think it could be useful for others (maybe in a new issue? That would be preferred). I had assumed people mainly used testnets for testing, and I can't see how this feature would be essential for testing (since all we did is redirect to https://app.ens.domains/name/[address], and you could navigate there yourself).

Personally I'm open to considering adding this feature back, but only if we can find some way to mitigate the usability concern (e.g. ensure the user knows they're resolving testnet addresses). Maybe on an opt-in basis as well, as most users wouldn't benefit from this feature. But only if there's a case to be made for this being useful for users in the first place.

@xmaysonnave
Copy link
Contributor

Thanks for your comments.
1 - Right now our users always use the same url to reach our dapps.
https://bluelightav.eth resolves either on mainnet and/or rinkeby.
The difference is the production version or the dev/test version, frontend and smart contracts.
I see this as an improvement over the tradionnal dns approach with a dot beta or dev URL prefix.
Question: What about Metamask set to Rinkeby while .eth is resolved on Mainnet ?
2 - The fact that a browser user input URL resolves on Mainnet, Ropsten, Rinkeby or Goerli (deployed ENS registries) doesn't prevent users to understand what Metamask is doing. However .eth are resolved even a user didn't log with Metamask. In other word a user could use the .eth resolver without any relationship with the Ethereum/Smart Contract, etc...You are right to say that it could be seen as a user confusion/inconvenience.
3 - In the current situation Metamask takes the hand and the landing page is the ipfs url content.
For instance https://app.ens.domains/name/bluelightav.eth redirects to the app and not the content (7.7.3 behaviour, I didn't test the 7.7.4 yet.).
4 - In the current landscape AFAIK Metamask is the only one who provides this flexibility. Opera only resolves on Mainnet even you switch the integrated wallet to the Rinkeby network. I see that as a real plus. We could also imagine that when .eth will be an official resolved TLD. Major browsers will only resolve on Mainet. I see this point as a Metamask strength.
6 - if this PR is maintained and if I understand well we need to educate usesr to use this kind of URL https://app.ens.domains/name/bluelightav.eth, not very convenient and as seen in the past this kind of URL could change....
Warmly

yqrashawn pushed a commit to yqrashawn/conflux-portal that referenced this pull request Feb 3, 2020
The ENS resolver will now bail on any network other than mainnet.
@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 3, 2020

@xmaysonnave I can see why you value this feature. I'm considering now how we could accomplish this in a safe way.

Would it meet your requirements if we added back testnet ENS resolution, but moved to a warning page first to confirm the user understands what network they're on? Then proceeded from there to the same destination it used to go to, after the user presses "Continue"

@xmaysonnave
Copy link
Contributor

@gudhatt I was thinking about your proposal.
In the current situation when a user input an eth domain there is a temporary page who's blinking with the ENS logo. If a user install Metamask and do not setup any account the eth redirection is functional and takes the default Ethereum network. If a user setup an account he starts his Metamask/Ethereum learning curve and I hope that he is aware of the different networks available. Anyway the default is Mainnet. I see two different use cases here. If a user select Ropsten for instance I really hopes that he is aware that is going to transact with Ropsten The same reasoning applies to the ENS resolution. If a user select Ropsten and he is confused to resolve against Ropsten it sounds like a user confusion.
I see three ways:
1 - An extra confirmation dialog as you suggest. This suggestion implies an user interaction.
2 - A specialized color per network or the traditional yellow warning color on the temporary page could be a user free interaction.
3 - Metamask on Android is less confusing as the current selected network is displayed. I have no idea if this behavior could be implemented on desktop browsers.
Thanks

yqrashawn pushed a commit to Conflux-Chain/conflux-portal that referenced this pull request Feb 10, 2020
The ENS resolver will now bail on any network other than mainnet.
yqrashawn pushed a commit to Conflux-Chain/conflux-portal that referenced this pull request Feb 10, 2020
The ENS resolver will now bail on any network other than mainnet.
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>
@xmaysonnave
Copy link
Contributor

@gudhatt
Any progress on your side ?
You suggested to open an enhancement request.
It will be easier to contributors to comment.
Thanks

@marsrobertson
Copy link

marsrobertson commented Apr 26, 2020

FYI, the existing error message is misleading: https://ethereum.stackexchange.com/questions/82780/ens-on-rinkeby-network-does-not-support-ens/82804

image

It's the Metamask that does not support the network.

@marsrobertson
Copy link

Regardless Rinkeby, error message should be better

image

I'm on the mainnet already. It's the resolver that is not configured. On the other hand, no need to overcomplicate with technical details.

It just feels weird "switch to mainnet if already on the mainnet"

@xmaysonnave
Copy link
Contributor

@marsrobertson Your report is not related to the current issue. I suggest to open a new request. I'm talking here the way Metamask is behaving when a user input a .eth adress in the browser address bar not in the Metamask browser extension itself.
Thanks

@rsodre
Copy link

rsodre commented Aug 10, 2023

@Gudahtt: I would appreciate it if you could explain why testnet ENS resolution in the browser address bar in particular is a useful feature for you, or why you think it could be useful for others (maybe in a new issue? That would be preferred).

I'm building an application that relies on ENS records and deploys static clients using ENC content hash. Opening an ens address from the url is important for us. That's THE thing we're doing, and we can't test it on a testnet.

I don't mind a confirmation before opening the content.
Or add some settings to enable it, if MetaMask still believes this is a security risk.

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.

6 participants