Skip to content

Version v8.1.3 RC#9720

Merged
Gudahtt merged 89 commits intomasterfrom
Version-v8.1.3
Oct 29, 2020
Merged

Version v8.1.3 RC#9720
Gudahtt merged 89 commits intomasterfrom
Version-v8.1.3

Conversation

@metamaskbot
Copy link
Copy Markdown
Collaborator

@metamaskbot metamaskbot commented Oct 26, 2020

📦 🚀

v8.1.3 Changelog

darkwing and others added 30 commits October 16, 2020 20:43
* Calculate savings per swap relative to median values

* Update test mock quotes, add getMedian tests

* Identify assets by sourceToken and destinationToken
The MetaMask fee is shown with two percent signs on the view quote page, because the percent sign is embedded in the fee amount as well as in the localized message.

The fee amount used now comes from the API, and does not have a percent sign. The percent sign is now only in the localized message. This allows for different locales to display the percentage differently. The old hard-coded value with a percent sign embedded has been removed, as it is no longer used anywhere.
On Windows, spawn fails if the exact filename
of a binary isn't passed. e.g. `spawn('yarn')` fails
because the binary is named `yarn.cmd`.
Instead, we depend on `cross-spawn` which handles differences
in `spawn` across platforms.
The `metaMaskFee` property on the "quote data" PropType was not used,
and it never existed in practice. This resulted in PropType errors.

The non-existent property has been removed.
This parameter to the `quotesToRenderableData` function was never
passed in. It has been removed.
The `AwaitingSwap` component was emitting a React warning when rendered
because a component was being rendered in an array without having a
`key` prop set.

A key has been added to the `CountdownTimer` component, which is passed
into the translation helper in an array. The warning no longer appears.
The `message` prop of `ActionableMessage` had a PropType of `string`,
but it was being passed a `node`. This was resulting in a PropType
error in the console on the view quote page.

The PropType has been changed to `node`, and the error is now gone.
The `InfoTooltip` component had a `contentText` prop with a PropType of
`string` that was being passed a `node` as of #9614. This resulted in a
PropType error.

The `contentText` prop was being passed directly to `Tooltip` component
as the prop `html`, which has a PropType of `node`. A string is a valid
`node` type, which is why this worked before.

The `contentText` prop is now of type `node`, and the error no longer
appears.
The `conversionRate` prop of `GasModalPageContainer` was updated
recently in PR #9623 to have a PropType of `string` instead of
`number`. This resulted in a PropType error whenever this modal was
rendered, as `conversionRate` is always a `number`.

The PropType has been reverted to the correct type, `number`.
This change removes an incorrect comment about migrations
Fix 9638 - Prevent excessive overflow from swap dropdowns
Sorting was broken for the "Quote Source" column of the quote sort
list. Attempting to sort by this column would arrange the quotes in a
seemingly random order.

It appears that this was due to this column being programmed to sort by
a property called `liquiditySource`, which does not exist in the quote
data. I'm unsure what the difference between `liquiditySource` and
`quoteSource` was supposed to be; the values in the mocks are all
identical.

All references to `liquiditySource` have been updated to refer to
`quoteSource` instead, and the sorting now works correctly.
`@metamask/eslint-config` has been updated to v4.1.0. This update
requires that we update `eslint` to v7 as well, which in turn requires
updating most `eslint`-related packages.

Most notably, `babel-eslint` was replaced with `@babel/eslint-parser`,
and `babel-eslint-plugin` was replaced by `@babel/eslint-plugin`. This
required renaming all the `babel/*` rules to `@babel/*`.

Most new or updated rules that resulted in lint errors have been
temporarily disabled. They will be fixed and re-enabled in subsequent
PRs.
Refs #9663

See [`node/no-callback-literal`][1] for more information.

This change enables `node/no-callback-literal` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-callback-literal.md
Consolidates the background and UI segment implementations into a shared solution.

This results in the introduction of our first shared module.

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Refs #9663

See [`node/no-path-concat`][1] for more information.

This change enables `node/no-path-concat` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-path-concat.md
Our ENS resolver for the browser address bar was incorrectly resolving
addresses that included query strings. We were concatenating the `path`
property with the `search` property, despite the fact that the `path`
property already contains `search`. As a result, `search` was
duplicated in the resolved addresses.

For example, if an IPFS content ID was found for this address, the
resolved address for `metamask.eth/?foo=bar` would have the path
`/?foo=bar?foo=bar`

The original intent was likely to use `pathname` in place of `path`.
The resolver has been updated to use `pathname`, and the query string
now appears only once in the resolved address.
Refs #9663

See [`node/no-deprecated-api`][1] for more information.

This change enables `node/no-deprecated-api` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md

The change to the way that `punycode` is imported is to address the fact that
third-party module is hidden by the built-in. This is a silly hack but it works.
* Check if swapTokenValue is negative and set prefix accordingly

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
The command `mocha` was included twice in `test:unit:global`
accidentally. The second occurrence was interpreted as a filename, and
would result in the following warning:

`Warning: Cannot find any files matching pattern "mocha"`

The second instance has been removed, and the warning no longer
appears.
@metamaskbot
Copy link
Copy Markdown
Collaborator Author

Builds ready [6a93664]
Page Load Metrics (592 ± 26 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint298541188
domContentLoaded3996685905426
load4016695925426
domInteractive3996675905426

@metamaskbot
Copy link
Copy Markdown
Collaborator Author

Builds ready [4b0c344]
Page Load Metrics (557 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint328343147
domContentLoaded32465255610952
load32565555710952
domInteractive32365255510952

tmashuang
tmashuang previously approved these changes Oct 28, 2020
Copy link
Copy Markdown
Contributor

@tmashuang tmashuang left a comment

Choose a reason for hiding this comment

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

LGTM

darkwing and others added 3 commits October 28, 2020 08:58
This will allow usage in areas where getting the line-height, etc
of the typography settings will introduce issues. The mixins have been
updated to references these variables so that they can be changed in
one place in the future
@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented Oct 28, 2020

I'm still able to reproduce this bug: #9726

Gudahtt and others added 5 commits October 28, 2020 16:17
This is a continuation of #9726, which did not fix the problem
described.

If the initial network when the extension is started is something other
than Mainnet, the swaps controller will never successfully retrieve
swap quotes. This is because `ethers` will continue to communicate
with whichever network the provider was initially on.

We tried fixing this by hard-coding the `chainId` to Mainnet's
`chainId` when constructing the Ethers provider, but this did not work.
I suspect this failed because the `provider` we pass to `ethers` is not
compliant with EIP 1193, as `ethers` doubtless expects it to be.

Instead the entire `ethers` provider is now reconstructed each time the
network changes. This mirrors the approach we take in some other
controllers.
The v8.1.3 changelog has been updated with all user-facing changes
included with v8.1.3

PR #9612 was left under "Current Develop Branch" because it has been
temporarily reverted for this release. It was added there now so that
we don't forget about it, as the revert might result in that commit
not being populated by the changelog script for the next release.
Three new more user-facing changes were added to the release branch.
The changelog has been updated with one minor UX improvement, and the
entry regarding failed swap fetches has been updated to point at the PR
that actually fixed the issue.
Copy link
Copy Markdown
Contributor

@tmashuang tmashuang left a comment

Choose a reason for hiding this comment

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

LGTM

@metamaskbot
Copy link
Copy Markdown
Collaborator Author

Builds ready [af704db]
Page Load Metrics (396 ± 56 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint318037105
domContentLoaded29961939411756
load30062139611756
domInteractive29861939411756

@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented Oct 28, 2020

So I have tested these changes:

I am not 100% confident that I've tested these correctly, but it seems to be working correctly as far as I can tell:

I'm looking into #9621 at the moment - I am not seeing the aggregator fee 🤔

@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented Oct 28, 2020

I was able to partially confirm #9621 - I saw that it does show the approval fee on the customize gas modal, if present. I was unable to find a quote that had an aggregator fee though, so I was unable to verify that part.

@Gudahtt
Copy link
Copy Markdown
Member

Gudahtt commented Oct 28, 2020

I have just tested "#9736: Bump eth-contract-metadata from 1.16.0 to 1.17.0"

I attempted to test "#9671: Prevent old fetches from polluting the swap state" by rapidly cancelling and re-fetching quotes. Not sure there's any great way to verify that one is fixed, but I haven't seen it fail at least.

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@danjm
Copy link
Copy Markdown
Contributor

danjm commented Oct 29, 2020

I was able to successfully test the changes of #9621 by using this code in the background console to modifiy the trade.value response:

let _fetch = window.fetch
window.fetch = async function (...args) {
  const response = await _fetch(...args);
  const responseJson = await response.json();
  if (args[0].match(/trade/)) {
    responseJson.forEach((quote) => {
      if (quote.trade) {
        quote.trade.value = (Number(quote.trade.value[0]) + 1) + quote.trade.value.slice(1)
      }
    })
  }
  return Promise.resolve({
    json: () => Promise.resolve(responseJson),
    ok: true
  })
}

@Gudahtt Gudahtt merged commit 11781e8 into master Oct 29, 2020
@Gudahtt Gudahtt deleted the Version-v8.1.3 branch October 29, 2020 02:34
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.