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

dependencies: Update dependency ethers to v5 #2289

Merged
merged 17 commits into from
Nov 2, 2020
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 23, 2020

Fixes #1707
Upgrades ethers to v5 and switch pnpm for yarn workspaces, since pnpm had issues detecting and installing sub-dependencies of ethers v5.

This PR contains the following updates:

Package Type Update Change
ethers peerDependencies major ^4.0.48 -> ^5.0.19
ethers dependencies major ^4.0.48 -> ^5.0.19

Release Notes

ethers-io/ethers.js

v5.0.19

Compare Source

v5.0.18

Compare Source

v5.0.17

Compare Source

  • Better error message for parseUnits of non-strings. (#​981; 5abc2f3)
    • Add gzip support to AlchemyProivder and InfuraProvider fetching. (#​1085; 38a068b)
    • Add gzip support to getUrl in node. (#​1085; 65772a8)
    • Added CommunityResourcable to mark Providers as highly throttled. (a022093)
    • Added debug event info to WebSocketProvider. (#​1018; 8e682cc)

v5.0.16

Compare Source

v5.0.15

Compare Source

  • Add more accurate intrinsic gas cost to ABI calls with specified gas property. (#​1058; f0a5869)

v5.0.14

Compare Source

v5.0.13

Compare Source

v5.0.12

Compare Source

  • Allow events to use compact bytes ABI coded data for Solidity 0.4 external events. (#​891, #​992; 4e394fc)

v5.0.11

Compare Source

  • Synced unorm in shims to most recent version. (bdccf7b)
    • Fixed LedgerSigner sendTransaction. (#​936; cadb28d)
    • Added BrainWallet to experimental exports. (72385c2)
    • More readable server errors. (201e5ce)

v5.0.10

Compare Source

v5.0.9

Compare Source

v5.0.8

Compare Source

v5.0.7

Compare Source

v5.0.6

Compare Source

  • Removed unnecessary dependency from BigNumber. (#​951; 78b350b)
    • Longer Etherscan throttle slot interval. (9f20258)
    • Fixed ENS overrides for the default provider. (#​959; 63dd3d4)
    • Added Retry-After support and adjustable slot interval to fetchJson. (7d43545)
    • Added initial throttling support. (#​139, #​904, #​926; 88c7eae)
    • Use status code 1000 on WebSocket hangup for compatibility. (588f64c)
    • Updated WebSocketProvider to use web-style event listener API. (57fd6f0)
    • Normalize formatUnits to simplified decimals. (79b1da1)
    • Prevent zero-padding on Solidity type lengths. (e128bfc)
    • Set sensible defaults for INFURA and AlchemyAPI getWebSocketProvider methods. (e3d3e60)
    • Added logger assert methods. (619a888)
    • Added initial code coverage testing. (0c1d55b)
    • Added destroy to WebSocketProvider. (d0a79c6)
    • Updated packages (security updates). (c660176)

v5.0.5

Compare Source

v5.0.4

Compare Source

  • Prevent negative exponents in BigNumber. (#​925; 84e253f)
    • Fixed StaticJsonRpcProvider when auto-detecting network. (#​901; 0fd9aa5)
    • Added WebSocket static method to Alchemy provider and updated Alchemy URLs. (4838874)

v5.0.3

Compare Source

  • Fixed typo in error string. (7fe702d)
    • Updated elliptic package to address possible malleability issue; which should not affect Ethereum. (9e14345)
    • Fixed FixedNumber unguarded constructor and added isZero. (#​898; 08c74e9)
    • Added StaticJsonRpcProvider for reducing calls to chainId in certain cases. (#​901; c53864d)
    • Allow getDefaultProvider to accept a URL as a network. (8c1ff4c)
    • Make network an optional parameter to WebSocketProvider. (987b535)
    • Removed deprecated errors package. (f9e9347)
    • Updated badges in docs. (d00362e)
    • Create security policy. Create security policy. (88e6849)

v5.0.2

Compare Source

  • Allow provider.ready to stall until the network is available. (#​882; bbb4f40)
    • Reduce dependencies to squash security issues. (738d349)
    • Updated admin scripts for publishing prod releases. (e0e0dbe)

v5.0.1

Compare Source

v5.0.0

Compare Source


Renovate configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Oct 23, 2020
@CLAassistant
Copy link

CLAassistant commented Oct 23, 2020

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Oct 27, 2020

You modified raiden-dapp/src,
Please remember to add a change log entry at raiden-dapp/CHANGELOG.md if necessary.

@andrevmatos
Copy link
Contributor

andrevmatos commented Oct 27, 2020

Ok, I managed to get the SDK to build with ethers v5.
So, the SDK part should be done until we get the rest of the imports fixed and are able to test with automated tests and build the dApp to test it by hand, then we go back to fix SDK if needed.
This part can be split out, and worked in parallel. If we do it right, there shouldn't be rebase/merge conflicts, as long as you keep an eye to pull committed changes before committing their part.

@andrevmatos
Copy link
Contributor

Some implementation suggestions:
On ethers v5, the library is split among several namespaced packages (under @ethersproject), and then the exported/relevant members are exported as the ethers package.

On SDK, in order to minimize code changes, I opted to import the named exports from the @ethersproject packages. @agatsoh , please, try to keep it like that also on the SDK tests imports: e.g. BigNumber is now imported from @ethersproject/bignumber, Network is imported from @ethersproject/networks, etc. Please, refer to the current commits for examples from where you should import the previous names. Also, you can refer to the ethers.ts and utils.ts to identify from which package a var/function/type is imported. I already added most of the required packages, but you can also add a new from the namespace if not already included. Please, if you import some name only for its type, try to use import type feature.

On dApp and CLI, I think it's not worth the weight of adding the individual namespaced packages, so we should use the types and exports from the ethers package. Downside is that some things aren't name-exported, so you may need to use it from the modules. e.g. BigNumber can be imported from ethers, but most utils are inside some re-exported objects, so one may need to use something like

import { BigNumber, ethers } from 'ethers';
const formated = ethers.utils.formatEther(BigNumber.from(10));

i.e. accessing from the namespaced mapping object, in order to use utilities and even some types from the exported subpackages, specially from ethers.utils, ethers.constants and ethers.providers.

As already shown above, bigNumberify is gone, and one must use BigNumber.from to create BigNumber instances from now on. Please, refer to the migrations guide and commits already in this PR for examples.

Please, let me know if there's any question. Thank you very much.

@weilbith
Copy link
Contributor

weilbith commented Oct 28, 2020

Thank you very much @andrevmatos 🙏

Hmm, I think the package for the dApp is already huge. Also I do not like to use the namespace objects to much. 🤔
Let's see how much we actually need from the whole namespace and then I would like to do the decision which approach fits better.

Btw: Does the @ not clash with our webpack configuration? 🤔

@weilbith
Copy link
Contributor

Note for the careful reader: @palango his question was answered in a channel external of GitHub.

@andrevmatos
Copy link
Contributor

andrevmatos commented Oct 28, 2020

Hmm, I think the package for the dApp is already huge. Also I do not like to use the namespace objects to much.
Let's see how much we actually need from the whole namespace and then I would like to do the decision which approach fits better.

We need to test. These packages should be imported from their (new) ESM build automatically by tools like webpack, so maybe it won't grow the package in any way more than using the namespaced packages. Notice also importing from the exports in ethers is the suggested way in their documentation, and I had to dig about to be able to import from the projects subpackages to get the named exports out of it for the SDK.

Btw: Does the @ not clash with our webpack configuration?

It shouldn't, because it's not @/ , and instead @etherspackage/, which differentiates.

@weilbith
Copy link
Contributor

weilbith commented Oct 28, 2020

Btw: Does the @ not clash with our webpack configuration? 🤔

Okay no, at least for the dApp this is configured as @/.

@andrevmatos
Copy link
Contributor

@agatsoh So I think I managed to fix tests fixtures and mocks. Most channels.spec.ts tests, and all utils.spec.ts are already passing, so you can start converting the rest of the tests. Please, let me know if you have any question, but the previous commits should give you good leads on how to proceed.

If ts-jest keeps bothering you because some unrelated test is failing to compile (since it always tries to transpile everything), you may temporarily and only on your workdir enable isolated modules option, which will allow you to force-run each test suite despite transpile errors and check if they pass, and then you should be able to disable it again after all tests are fixed.

@andrevmatos andrevmatos force-pushed the renovate/ethers-5.x branch 2 times, most recently from 287e0f4 to 42e7d76 Compare October 30, 2020 00:56
@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #2289 into master will decrease coverage by 0.14%.
The diff coverage is 98.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2289      +/-   ##
==========================================
- Coverage   94.94%   94.80%   -0.15%     
==========================================
  Files         156      156              
  Lines        6293     6294       +1     
  Branches     1166     1078      -88     
==========================================
- Hits         5975     5967       -8     
- Misses        253      262       +9     
  Partials       65       65              
Flag Coverage Δ
dapp 91.83% <97.50%> (-0.02%) ⬇️
sdk 95.99% <98.51%> (-0.20%) ⬇️
sdk_e2e ?
sdk_integration 68.58% <87.40%> (+0.03%) ⬆️
sdk_unit 85.53% <87.40%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
raiden-dapp/src/components/AmountDisplay.vue 100.00% <ø> (ø)
...en-dapp/src/components/channels/ChannelDialogs.vue 100.00% <ø> (ø)
.../src/components/dialogs/TransferProgressDialog.vue 94.44% <ø> (ø)
raiden-dapp/src/filters.ts 100.00% <ø> (ø)
raiden-dapp/src/store/index.ts 98.05% <ø> (ø)
raiden-ts/src/channels/state.ts 100.00% <ø> (ø)
raiden-ts/src/services/types.ts 100.00% <ø> (ø)
raiden-ts/src/transfers/state.ts 100.00% <ø> (ø)
raiden-ts/src/types.ts 100.00% <ø> (ø)
raiden-dapp/src/views/OpenChannelRoute.vue 92.18% <50.00%> (ø)
... and 43 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 073b06f...ce704ab. Read the comment docs.

@andrevmatos
Copy link
Contributor

andrevmatos commented Oct 30, 2020

SDK tests are green. I'll investigate the dApp build errors tomorrow. They're caused by tsc/webpack not seeing the sub-dependencies of the ethers package, probably because of how pnpm links them.
Solution may be to switch to yarn workspaces.
@weilbith if you wanna give a look at ^--

@andrevmatos andrevmatos force-pushed the renovate/ethers-5.x branch 2 times, most recently from 2076fe1 to 140ca4d Compare October 31, 2020 03:07
@andrevmatos andrevmatos self-assigned this Oct 31, 2020
@andrevmatos andrevmatos added the infrastructure 🚧 Tests, CI, and general project infrastructure label Oct 31, 2020
@andrevmatos
Copy link
Contributor

I have tested it: transfers, channel open, close, deposit, UDC deposit, UDC withdraw, ETH subkey deposit.. everything seems to be working as expected.
@taleldayekh I've got some weird errors when accessing the notification area (it looks like there should be some notifications there which didn't show up because of this error). Can you confirm it's not related to this upgrade?
The error:

vue.runtime.esm.js:1888 Error: Cannot find module './undefined.svg'
    at webpackContextResolve (eval at ./src/assets sync recursive ^\.\/.*\.svg$ (13.js:148), <anonymous>:38:11)
    at webpackContext (eval at ./src/assets sync recursive ^\.\/.*\.svg$ (13.js:148), <anonymous>:33:11)
    at Proxy.render (eval at ../node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"2a8bdb58-vue-loader-template"}!../node_modules/vue-loader/lib/loaders/templateLoader.js?!../node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!./src/components/notification-panel/NotificationCard.vue?vue&type=template&id=5cb96eb0&scoped=true& (13.js:47), <anonymous>:28:91)
    at VueComponent.Vue._render (vue.runtime.esm.js:3548)
    at VueComponent.updateComponent (vue.runtime.esm.js:4066)
    at Watcher.get (vue.runtime.esm.js:4479)
    at new Watcher (vue.runtime.esm.js:4468)
    at mountComponent (vue.runtime.esm.js:4073)
    at VueComponent.Vue.$mount (vue.runtime.esm.js:8415)
    at init (vue.runtime.esm.js:3118)

@weilbith
Copy link
Contributor

weilbith commented Nov 1, 2020

@taleldayekh I've got some weird errors when accessing the notification area (it looks like there should be some notifications there which didn't show up because of this error). Can you confirm it's not related to this upgrade?
The error:

Allow me to answer for him: yes, atm this is an issue for some notifications. @taleldayekh was there an issue to add all missing icons?

Copy link
Contributor

@weilbith weilbith left a comment

Choose a reason for hiding this comment

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

@andrevmatos thank you so much for all the work you have invested here! 🙏
I was prepared this morning to start to fully adopt the project from pnpm to yarn but you already did it. All the changes look good to me. 👍

@andrevmatos andrevmatos merged commit dde6594 into master Nov 2, 2020
@andrevmatos andrevmatos deleted the renovate/ethers-5.x branch November 2, 2020 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file infrastructure 🚧 Tests, CI, and general project infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to ethers v5
5 participants