Skip to content

Commit 1c9b6ca

Browse files
chore: align ethereumjs versions (#5347)
## Explanation Align `@ethereumjs/*` package versions to avoid any risk of incompatibility and simplify future maintenance. Upgrade originally required by `@metamask/transaction-controller` to support EIP-7702 transactions. ## References - `@metamask/accounts` [PR](MetaMask/accounts#209) ## Changelog See changelogs. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --------- Co-authored-by: Michele Esposito <michele@esposito.codes> Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com>
1 parent d9b0353 commit 1c9b6ca

21 files changed

Lines changed: 139 additions & 101 deletions

File tree

packages/accounts-controller/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **BREAKING:** Bump `@metamask/keyring-utils` from `^2.3.1` to `^3.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
13+
- **BREAKING:** Bump `@metamask/keyring-internal-api` from `^5.0.0` to `^6.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
14+
- **BREAKING:** Bump `@metamask/eth-snap-keyring` from `^11.1.0` to `^12.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
15+
- **BREAKING:** Bump `@ethereumjs/util` from `^8.1.0` to `^9.1.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
16+
1017
## [25.0.0]
1118

1219
### Changed

packages/accounts-controller/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
4848
},
4949
"dependencies": {
50-
"@ethereumjs/util": "^8.1.0",
50+
"@ethereumjs/util": "^9.1.0",
5151
"@metamask/base-controller": "^8.0.0",
52-
"@metamask/eth-snap-keyring": "^11.1.0",
52+
"@metamask/eth-snap-keyring": "^12.0.0",
5353
"@metamask/keyring-api": "^17.2.0",
54-
"@metamask/keyring-internal-api": "^5.0.0",
55-
"@metamask/keyring-utils": "^2.3.1",
54+
"@metamask/keyring-internal-api": "^6.0.0",
55+
"@metamask/keyring-utils": "^3.0.0",
5656
"@metamask/network-controller": "^22.2.1",
5757
"@metamask/snaps-sdk": "^6.17.1",
5858
"@metamask/snaps-utils": "^8.10.0",

packages/accounts-controller/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { toBuffer } from '@ethereumjs/util';
21
import { isCustodyKeyring, KeyringTypes } from '@metamask/keyring-controller';
2+
import { hexToBytes } from '@metamask/utils';
33
import { sha256 } from 'ethereum-cryptography/sha256';
44
import type { V4Options } from 'uuid';
55
import { v4 as uuid } from 'uuid';
@@ -58,7 +58,7 @@ export function getUUIDOptionsFromAddressOfNormalAccount(
5858
address: string,
5959
): V4Options {
6060
const v4options = {
61-
random: sha256(toBuffer(address)).slice(0, 16),
61+
random: sha256(hexToBytes(address)).slice(0, 16),
6262
};
6363

6464
return v4options;

packages/assets-controllers/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **BREAKING:** Bump `@metamask/keyring-internal-api` from `^5.0.0` to `^6.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
13+
- **BREAKING:** Bump `@ethereumjs/util` from `^8.1.0` to `^9.1.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
14+
1015
## [52.0.0]
1116

1217
### Changed

packages/assets-controllers/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
4848
},
4949
"dependencies": {
50-
"@ethereumjs/util": "^8.1.0",
50+
"@ethereumjs/util": "^9.1.0",
5151
"@ethersproject/abi": "^5.7.0",
5252
"@ethersproject/address": "^5.7.0",
5353
"@ethersproject/bignumber": "^5.7.0",
@@ -82,7 +82,7 @@
8282
"@metamask/auto-changelog": "^3.4.4",
8383
"@metamask/ethjs-provider-http": "^0.3.0",
8484
"@metamask/keyring-controller": "^20.0.0",
85-
"@metamask/keyring-internal-api": "^5.0.0",
85+
"@metamask/keyring-internal-api": "^6.0.0",
8686
"@metamask/keyring-snap-client": "^4.0.1",
8787
"@metamask/network-controller": "^22.2.1",
8888
"@metamask/permission-controller": "^11.0.6",

packages/assets-controllers/src/Standards/ERC20Standard.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { toUtf8 } from '@ethereumjs/util';
1+
import { bytesToUtf8 } from '@ethereumjs/util';
22
import { Contract } from '@ethersproject/contracts';
33
import type { Web3Provider } from '@ethersproject/providers';
44
import { decodeSingle } from '@metamask/abi-utils';
55
import { ERC20 } from '@metamask/controller-utils';
66
import { abiERC20 } from '@metamask/metamask-eth-abis';
7-
import { assertIsStrictHexString } from '@metamask/utils';
7+
import { assertIsStrictHexString, hexToBytes } from '@metamask/utils';
88
import type BN from 'bn.js';
99

1010
import { ethersBigNumberToBN } from '../assetsUtil';
@@ -98,7 +98,15 @@ export class ERC20Standard {
9898

9999
// Parse as bytes - treat empty string as failure
100100
try {
101-
const utf8 = toUtf8(result);
101+
// Not done in bytesToUtf8 in ethereumjs/util.
102+
const regexPreceedingAndTrailingZeroes = /^(00)+|(00)+$/gu;
103+
104+
const resultTrimmed = result?.replace(
105+
regexPreceedingAndTrailingZeroes,
106+
'',
107+
);
108+
109+
const utf8 = bytesToUtf8(hexToBytes(resultTrimmed));
102110
if (utf8.length > 0) {
103111
return utf8;
104112
}

packages/controller-utils/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Bump `@ethereumjs/util` from `^8.1.0` to `^9.1.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
13+
1014
## [11.5.0]
1115

1216
### Added

packages/controller-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
4848
},
4949
"dependencies": {
50-
"@ethereumjs/util": "^8.1.0",
50+
"@ethereumjs/util": "^9.1.0",
5151
"@metamask/eth-query": "^4.0.0",
5252
"@metamask/ethjs-unit": "^0.3.0",
5353
"@metamask/utils": "^11.2.0",

packages/keyring-controller/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14+
- Bump `@metamask/keyring-internal-api` from `^5.0.0` to `^6.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
15+
- Bump `@metamask/eth-simple-keyring` from `^9.0.0` to `^10.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
16+
- Bump `@metamask/eth-hd-keyring` from `^11.0.0` to `^12.0.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
17+
- Bump `@ethereumjs/util` from `^8.1.0` to `^9.1.0` ([#5347](https://github.com/MetaMask/core/pull/5347))
1418
- **BREAKING:** `addNewKeyring` method now returns `Promise<KeyringMetadata>` instead of `Promise<unknown>` ([#5372](https://github.com/MetaMask/core/pull/5372))
1519
- Consumers can use the returned `KeyringMetadata.id` to access the created keyring instance via `withKeyring`.
1620
- **BREAKING:** `withKeyring` method now requires a callback argument of type `({ keyring: SelectedKeyring; metadata: KeyringMetadata }) => Promise<CallbackResult>` ([#5372](https://github.com/MetaMask/core/pull/5372))

packages/keyring-controller/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,29 @@
4747
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
4848
},
4949
"dependencies": {
50-
"@ethereumjs/util": "^8.1.0",
50+
"@ethereumjs/util": "^9.1.0",
5151
"@keystonehq/metamask-airgapped-keyring": "^0.14.1",
5252
"@metamask/base-controller": "^8.0.0",
5353
"@metamask/browser-passworder": "^4.3.0",
54-
"@metamask/eth-hd-keyring": "^11.0.0",
54+
"@metamask/eth-hd-keyring": "^12.0.0",
5555
"@metamask/eth-sig-util": "^8.2.0",
56-
"@metamask/eth-simple-keyring": "^9.0.0",
56+
"@metamask/eth-simple-keyring": "^10.0.0",
5757
"@metamask/keyring-api": "^17.2.0",
58-
"@metamask/keyring-internal-api": "^5.0.0",
58+
"@metamask/keyring-internal-api": "^6.0.0",
5959
"@metamask/utils": "^11.2.0",
6060
"async-mutex": "^0.5.0",
6161
"ethereumjs-wallet": "^1.0.1",
6262
"immer": "^9.0.6",
6363
"ulid": "^2.3.0"
6464
},
6565
"devDependencies": {
66-
"@ethereumjs/common": "^3.2.0",
67-
"@ethereumjs/tx": "^4.2.0",
66+
"@ethereumjs/common": "^4.4.0",
67+
"@ethereumjs/tx": "^5.4.0",
6868
"@keystonehq/bc-ur-registry-eth": "^0.19.0",
6969
"@lavamoat/allow-scripts": "^3.0.4",
7070
"@lavamoat/preinstall-always-fail": "^2.1.0",
7171
"@metamask/auto-changelog": "^3.4.4",
72-
"@metamask/keyring-utils": "^2.3.1",
72+
"@metamask/keyring-utils": "^3.0.0",
7373
"@metamask/scure-bip39": "^2.1.1",
7474
"@types/jest": "^27.4.1",
7575
"deepmerge": "^4.2.2",

0 commit comments

Comments
 (0)