Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Update @ethereumjs/util, @ethereumjs/tx, @metamask/eth-sig-util #146

Merged
merged 2 commits into from
Jan 30, 2023
Merged

Update @ethereumjs/util, @ethereumjs/tx, @metamask/eth-sig-util #146

merged 2 commits into from
Jan 30, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Dec 19, 2022

This PR updates the following packages to the latest major versions, in order to optimize the extension bundle size.

Changes

  • ethereumjs-util@^7 substituted with @ethereumjs/util@^8
  • @ethereumjs/tx@^3 to @ethereumjs/tx@^4
  • @metamask/eth-sig-util^4 to @metamask/eth-sig-util@^5
  • DEV dep @ethereumjs/common^2 to @ethereumjs/common^3

With the new major version of @ethereumjs/tx@^4, tx.common.chainIdBN() has been changed to tx.common.chainId(), as BN.js has been substituted with BigInt.
As a consequence, the return type of chainId() is now an instance of BigInt, and needed the following changes:

  • chainIdBN().toNumber() is now Number(chainId())
  • chainIdBN().toString('hex') is now chainId().toString(16)

Fixes #15928

@socket-security
Copy link

socket-security bot commented Dec 19, 2022

Socket Security Pull Request Report

👍 No new dependency issues detected in pull request

Pull request report summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script confusion ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@2.4.2

Ignoring: @ethereumjs/rlp@4.0.0, rlp@2.2.7

Powered by socket.dev

@mikesposito mikesposito changed the title Update @ethereumjs/util, @metamask/eth-sig-util Update @ethereumjs/util, @ethereumjs/tx, @metamask/eth-sig-util Dec 21, 2022
@mikesposito mikesposito marked this pull request as ready for review December 21, 2022 11:30
@mikesposito mikesposito requested a review from a team as a code owner December 21, 2022 11:30
@adonesky1
Copy link
Contributor

@SocketSecurity ignore rlp@2.2.7 @ethereumjs/rlp@4.0.0

package.json Outdated
"ethereumjs-util": "^7.0.9",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.0",
"@metamask/eth-sig-util": "^5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

This version is deprecated, could you bump up to the latest: v5.0.2

Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM to me. Would be good to get @darkwing to take a look, and may @PeterYinusa to test this by packing it, adding it to a local extension build and then signing trezor transactions with it if possible.

@adonesky1
Copy link
Contributor

@mikesposito sorry bout that but looks like this needs another rebase!

@mikesposito
Copy link
Member Author

@mikesposito sorry bout that but looks like this needs another rebase!

@adonesky1 np, done!

darkwing
darkwing previously approved these changes Jan 12, 2023
Copy link
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

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

Awesome @mikesposito !

yarn.lock Outdated
Comment on lines 4345 to 4231
"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
dependencies:
safe-buffer: ^5.1.0
checksum: d779499376bd4cbb435ef3ab9a957006c8682f343f14089ed5f27764e4645114196e75b7f6abf1cbd84fd247c0cb0651698444df8c9bf30e62120fbbc52269d6
languageName: node
linkType: hard

Copy link
Contributor

Choose a reason for hiding this comment

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

seems like yarn 3.3.1 release relies on randombytes... but doesn't implement it or import it itself so appears to rely on it being in our dependency tree elsewhere... can this be right @Gudahtt?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@Gudahtt Gudahtt Jan 12, 2023

Choose a reason for hiding this comment

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

Hmm. Agreed that that doesn't sound right. Even if they did rely on that, randombytes is still in our dependency tree. (oh I see, nvm, it was added to fix this)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, it seems to be an undeclared dependency in the version of trezor-connect that we're using

Copy link
Contributor

Choose a reason for hiding this comment

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

@mikesposito I started to investigate this but got sidetracked. Basically trezor-connect no longer recommends using sub 9.0.0 versions and have marked other versions as deprecated. I started to attempt the migration up to version 9, but it was a bit trickier than I hoped. We should do that as a pre-requisite to completing this ticket.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually a PR to update to v9 already exists: #133.

Copy link
Contributor

Choose a reason for hiding this comment

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

And it's merged!

mikesposito and others added 2 commits January 30, 2023 12:14

Unverified

This user has not yet uploaded their public signing key.
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@adonesky1 adonesky1 merged commit 34517dd into MetaMask:main Jan 30, 2023
@adonesky1 adonesky1 mentioned this pull request Feb 23, 2023
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.

Update eth-trezor-keyring to use latest versions of ethereumjs/util @metamask/eth-sig-util, @ethereumjs/tx
4 participants