From 913d96bb5e1e46d251f19cbae8071fb51c812ee9 Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Tue, 4 Feb 2025 16:25:12 +0000 Subject: [PATCH 1/9] feat: replace forked ethereumjs packages with originals --- packages/hardhat-core/package.json | 8 +- .../hardhat-core/src/builtin-tasks/node.ts | 4 +- .../internal/core/jsonrpc/types/base-types.ts | 2 +- .../src/internal/core/providers/accounts.ts | 22 ++-- .../src/internal/core/providers/util.ts | 2 +- .../hardhat-network/jsonrpc/client.ts | 5 +- .../hardhat-network/provider/node-types.ts | 2 +- .../hardhat-network/provider/provider.ts | 2 +- .../provider/utils/convertToEdr.ts | 2 +- .../provider/utils/makeAccount.ts | 7 +- .../provider/utils/makeCommon.ts | 2 +- .../hardhat-network/provider/utils/random.ts | 9 +- .../hardhat-network/provider/vm/minimal-vm.ts | 4 +- .../hardhat-network/provider/vm/types.ts | 2 +- .../stack-traces/consoleLogger.ts | 2 +- .../stack-traces/solidity-errors.ts | 2 +- .../internal/solidity/compiler/downloader.ts | 2 +- .../core/jsonrpc/types/input/validation.ts | 2 +- .../test/internal/core/providers/accounts.ts | 6 +- .../hardhat-network/helpers/assertions.ts | 2 +- .../hardhat-network/helpers/blockchain.ts | 4 +- .../hardhat-network/helpers/constants.ts | 2 +- .../hardhat-network/helpers/leftPad32.ts | 2 +- .../hardhat-network/helpers/providers.ts | 2 +- .../hardhat-network/helpers/retrieveCommon.ts | 2 +- .../hardhat-network/helpers/transactions.ts | 4 +- .../hardhat-network/jsonrpc/client.ts | 5 +- .../test/internal/util/hardforks.ts | 2 +- .../test/internal/util/keys-derivation.ts | 2 +- pnpm-lock.yaml | 122 ++++++------------ 30 files changed, 85 insertions(+), 151 deletions(-) diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index 3ab6506f6b..ecaf1cc468 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -59,7 +59,6 @@ "devDependencies": { "@nomicfoundation/eslint-plugin-hardhat-internal-rules": "workspace:^", "@nomicfoundation/eslint-plugin-slow-imports": "workspace:^", - "@nomicfoundation/ethereumjs-block": "5.0.4", "@types/async-eventemitter": "^0.2.1", "@types/bn.js": "^5.1.0", "@types/chai": "^4.2.0", @@ -98,12 +97,12 @@ "typescript": "~5.0.0" }, "dependencies": { + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", "@nomicfoundation/edr": "^0.8.0", - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-tx": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", @@ -118,7 +117,6 @@ "enquirer": "^2.3.0", "env-paths": "^2.2.0", "ethereum-cryptography": "^1.0.3", - "ethereumjs-abi": "^0.6.8", "find-up": "^5.0.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", diff --git a/packages/hardhat-core/src/builtin-tasks/node.ts b/packages/hardhat-core/src/builtin-tasks/node.ts index 7c268df5b2..cd2421d60e 100644 --- a/packages/hardhat-core/src/builtin-tasks/node.ts +++ b/packages/hardhat-core/src/builtin-tasks/node.ts @@ -1,4 +1,4 @@ -import type EthereumjsUtilT from "@nomicfoundation/ethereumjs-util"; +import type EthereumjsUtilT from "@ethereumjs/util"; import picocolors from "picocolors"; import debug from "debug"; @@ -56,7 +56,7 @@ function logHardhatNetworkAccounts(networkConfig: HardhatNetworkConfig) { privateToAddress, toBytes, toChecksumAddress, - } = require("@nomicfoundation/ethereumjs-util") as typeof EthereumjsUtilT; + } = require("@ethereumjs/util") as typeof EthereumjsUtilT; console.log("Accounts"); console.log("========"); diff --git a/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts b/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts index c3cedecea3..510ff4b8d6 100644 --- a/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts +++ b/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts @@ -2,7 +2,7 @@ import { bytesToHex as bufferToHex, isValidAddress, toBytes, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import * as t from "io-ts"; import * as BigIntUtils from "../../../util/bigint"; diff --git a/packages/hardhat-core/src/internal/core/providers/accounts.ts b/packages/hardhat-core/src/internal/core/providers/accounts.ts index d60d7ec757..bdf8075c9b 100644 --- a/packages/hardhat-core/src/internal/core/providers/accounts.ts +++ b/packages/hardhat-core/src/internal/core/providers/accounts.ts @@ -1,7 +1,7 @@ import * as t from "io-ts"; import { signTypedData, SignTypedDataVersion } from "@metamask/eth-sig-util"; -import { FeeMarketEIP1559Transaction } from "@nomicfoundation/ethereumjs-tx"; +import { FeeMarketEIP1559Transaction } from "@ethereumjs/tx"; import { EIP1193Provider, RequestArguments } from "../../../types"; import { HardhatError } from "../errors"; import { ERRORS } from "../errors-list"; @@ -49,7 +49,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { toRpcSig, toBytes, bytesToHex: bufferToHex, - } = await import("@nomicfoundation/ethereumjs-util"); + } = await import("@ethereumjs/util"); if ( args.method === "eth_accounts" || @@ -197,7 +197,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { bytesToHex: bufferToHex, toBytes, privateToAddress, - } = require("@nomicfoundation/ethereumjs-util"); + } = require("@ethereumjs/util"); const privateKeys: Buffer[] = localAccountsHexPrivateKeys.map((h) => toBytes(h) @@ -210,9 +210,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { } private _getPrivateKeyForAddress(address: Buffer): Buffer { - const { - bytesToHex: bufferToHex, - } = require("@nomicfoundation/ethereumjs-util"); + const { bytesToHex: bufferToHex } = require("@ethereumjs/util"); const pk = this._addressToPrivateKey.get(bufferToHex(address)); if (pk === undefined) { throw new HardhatError(ERRORS.NETWORK.NOT_LOCAL_ACCOUNT, { @@ -232,9 +230,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { } private async _getNonce(address: Buffer): Promise { - const { bytesToHex: bufferToHex } = await import( - "@nomicfoundation/ethereumjs-util" - ); + const { bytesToHex: bufferToHex } = await import("@ethereumjs/util"); const response = (await this._wrappedProvider.request({ method: "eth_getTransactionCount", @@ -250,10 +246,10 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { privateKey: Buffer ): Promise { const { AccessListEIP2930Transaction, LegacyTransaction } = await import( - "@nomicfoundation/ethereumjs-tx" + "@ethereumjs/tx" ); - const { Common } = await import("@nomicfoundation/ethereumjs-common"); + const { Common } = await import("@ethereumjs/common"); const txData = { ...transactionRequest, @@ -320,9 +316,7 @@ export class HDWalletProvider extends LocalAccountsProvider { passphrase ); - const { - bytesToHex: bufferToHex, - } = require("@nomicfoundation/ethereumjs-util"); + const { bytesToHex: bufferToHex } = require("@ethereumjs/util"); const privateKeysAsHex = privateKeys.map((pk) => bufferToHex(pk)); super(provider, privateKeysAsHex); } diff --git a/packages/hardhat-core/src/internal/core/providers/util.ts b/packages/hardhat-core/src/internal/core/providers/util.ts index 9d73415536..775712cc37 100644 --- a/packages/hardhat-core/src/internal/core/providers/util.ts +++ b/packages/hardhat-core/src/internal/core/providers/util.ts @@ -53,7 +53,7 @@ export function normalizeHardhatNetworkAccountsConfig( return accountsConfig; } - const { bytesToHex } = require("@nomicfoundation/ethereumjs-util"); + const { bytesToHex } = require("@ethereumjs/util"); return derivePrivateKeys( accountsConfig.mnemonic, diff --git a/packages/hardhat-core/src/internal/hardhat-network/jsonrpc/client.ts b/packages/hardhat-core/src/internal/hardhat-network/jsonrpc/client.ts index 82bd9e6c98..30ea7ab9dd 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/jsonrpc/client.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/jsonrpc/client.ts @@ -1,7 +1,4 @@ -import { - Address, - bytesToHex as bufferToHex, -} from "@nomicfoundation/ethereumjs-util"; +import { Address, bytesToHex as bufferToHex } from "@ethereumjs/util"; import fsExtra from "fs-extra"; import * as t from "io-ts"; import path from "path"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/node-types.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/node-types.ts index 8049b4e019..dc93e59a3d 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/node-types.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/node-types.ts @@ -72,7 +72,7 @@ export interface LegacyTransactionParams extends BaseTransactionParams { export interface AccessListTransactionParams extends BaseTransactionParams { gasPrice: bigint; - // We use this access list format because @nomicfoundation/ethereumjs-tx access list data + // We use this access list format because @ethereumjs/tx access list data // forces us to use it or stringify them accessList: AccessListBufferItem[]; // We don't include chainId as it's not necessary, the node diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts index ea64269997..79e6a7f9d9 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts @@ -14,7 +14,7 @@ import type { HttpHeader, TracingConfigWithBuffers, } from "@nomicfoundation/edr"; -import { Common } from "@nomicfoundation/ethereumjs-common"; +import { Common } from "@ethereumjs/common"; import picocolors from "picocolors"; import debug from "debug"; import { EventEmitter } from "events"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts index a955ef1225..848357f5d4 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts @@ -7,7 +7,7 @@ import type { TracingMessageResult, TracingStep, } from "@nomicfoundation/edr"; -import { Address } from "@nomicfoundation/ethereumjs-util"; +import { Address } from "@ethereumjs/util"; import { requireNapiRsModule } from "../../../../common/napi-rs"; import { HardforkName } from "../../../util/hardforks"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeAccount.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeAccount.ts index 2a17985c3d..0896c437ff 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeAccount.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeAccount.ts @@ -1,9 +1,4 @@ -import { - Account, - Address, - privateToAddress, - toBytes, -} from "@nomicfoundation/ethereumjs-util"; +import { Account, Address, privateToAddress, toBytes } from "@ethereumjs/util"; import { GenesisAccount } from "../node-types"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeCommon.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeCommon.ts index 55c000e7ca..20631cfd9e 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeCommon.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeCommon.ts @@ -1,4 +1,4 @@ -import { Common } from "@nomicfoundation/ethereumjs-common"; +import { Common } from "@ethereumjs/common"; import { LocalNodeConfig } from "../node-types"; import { HardforkName } from "../../../util/hardforks"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/random.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/random.ts index 8267290a1b..a2af6186c6 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/random.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/random.ts @@ -1,4 +1,4 @@ -import type EthereumjsUtilT from "@nomicfoundation/ethereumjs-util"; +import type EthereumjsUtilT from "@ethereumjs/util"; import type * as UtilKeccakT from "../../../util/keccak"; export class RandomBufferGenerator { @@ -37,7 +37,7 @@ export class RandomBufferGenerator { export const randomHash = () => { const { bytesToHex: bufferToHex } = - require("@nomicfoundation/ethereumjs-util") as typeof EthereumjsUtilT; + require("@ethereumjs/util") as typeof EthereumjsUtilT; return bufferToHex(randomHashBuffer()); }; @@ -47,14 +47,13 @@ export const randomHashBuffer = (): Uint8Array => { }; export const randomAddress = () => { - const { Address } = - require("@nomicfoundation/ethereumjs-util") as typeof EthereumjsUtilT; + const { Address } = require("@ethereumjs/util") as typeof EthereumjsUtilT; return new Address(randomAddressBuffer()); }; export const randomAddressString = () => { const { bytesToHex: bufferToHex } = - require("@nomicfoundation/ethereumjs-util") as typeof EthereumjsUtilT; + require("@ethereumjs/util") as typeof EthereumjsUtilT; return bufferToHex(randomAddressBuffer()); }; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts index f80fa55d61..84246a8f3c 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/minimal-vm.ts @@ -1,12 +1,12 @@ import type { Provider as EdrProviderT } from "@nomicfoundation/edr"; -import type { Address } from "@nomicfoundation/ethereumjs-util"; +import type { Address } from "@ethereumjs/util"; import type { MinimalEVMResult, MinimalInterpreterStep, MinimalMessage, } from "./types"; -import { AsyncEventEmitter } from "@nomicfoundation/ethereumjs-util"; +import { AsyncEventEmitter } from "@ethereumjs/util"; /** * Used by the provider to keep the `_vm` variable used by some plugins. This diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/types.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/types.ts index ba4332ec5d..5fa485635f 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/vm/types.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/vm/types.ts @@ -1,5 +1,5 @@ import type { ExceptionalHalt, SuccessReason } from "@nomicfoundation/edr"; -import type { Address } from "@nomicfoundation/ethereumjs-util"; +import type { Address } from "@ethereumjs/util"; /** * These types are minimal versions of the values returned by ethereumjs diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/consoleLogger.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/consoleLogger.ts index 5e2ef4a1d7..a26a63e0dd 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/consoleLogger.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/consoleLogger.ts @@ -3,7 +3,7 @@ import { bytesToHex as bufferToHex, bytesToInt, fromSigned, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import util from "util"; import { diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidity-errors.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidity-errors.ts index cce9bfe9e3..3246c0cbe1 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidity-errors.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidity-errors.ts @@ -1,4 +1,4 @@ -import { bytesToHex as bufferToHex } from "@nomicfoundation/ethereumjs-util"; +import { bytesToHex as bufferToHex } from "@ethereumjs/util"; import { ReturnData } from "../provider/return-data"; import { panicErrorCodeToMessage } from "./panic-errors"; diff --git a/packages/hardhat-core/src/internal/solidity/compiler/downloader.ts b/packages/hardhat-core/src/internal/solidity/compiler/downloader.ts index 6d96ec8456..a77c836b32 100644 --- a/packages/hardhat-core/src/internal/solidity/compiler/downloader.ts +++ b/packages/hardhat-core/src/internal/solidity/compiler/downloader.ts @@ -317,7 +317,7 @@ export class CompilerDownloader implements ICompilerDownloader { downloadPath: string ): Promise { const { bytesToHex } = - require("@nomicfoundation/ethereumjs-util") as typeof import("@nomicfoundation/ethereumjs-util"); + require("@ethereumjs/util") as typeof import("@ethereumjs/util"); const { keccak256 } = await import("../../util/keccak"); const expectedKeccak256 = build.keccak256; diff --git a/packages/hardhat-core/test/internal/core/jsonrpc/types/input/validation.ts b/packages/hardhat-core/test/internal/core/jsonrpc/types/input/validation.ts index 67cf2af2e9..a77b0270e3 100644 --- a/packages/hardhat-core/test/internal/core/jsonrpc/types/input/validation.ts +++ b/packages/hardhat-core/test/internal/core/jsonrpc/types/input/validation.ts @@ -1,4 +1,4 @@ -import { toBytes } from "@nomicfoundation/ethereumjs-util"; +import { toBytes } from "@ethereumjs/util"; import { assert } from "chai"; import * as t from "io-ts"; diff --git a/packages/hardhat-core/test/internal/core/providers/accounts.ts b/packages/hardhat-core/test/internal/core/providers/accounts.ts index 3d1661e02f..aceb597381 100644 --- a/packages/hardhat-core/test/internal/core/providers/accounts.ts +++ b/packages/hardhat-core/test/internal/core/providers/accounts.ts @@ -1,11 +1,11 @@ -import { Common } from "@nomicfoundation/ethereumjs-common"; -import { AccessListEIP2930Transaction } from "@nomicfoundation/ethereumjs-tx"; +import { Common } from "@ethereumjs/common"; +import { AccessListEIP2930Transaction } from "@ethereumjs/tx"; import { assert } from "chai"; import { bytesToHex as bufferToHex, privateToAddress, toBytes, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import { ERRORS } from "../../../../src/internal/core/errors-list"; import { numberToRpcQuantity } from "../../../../src/internal/core/jsonrpc/types/base-types"; diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/assertions.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/assertions.ts index 438da46a4f..31f3c3d548 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/assertions.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/assertions.ts @@ -1,5 +1,5 @@ import { assert } from "chai"; -import { bytesToHex as bufferToHex } from "@nomicfoundation/ethereumjs-util"; +import { bytesToHex as bufferToHex } from "@ethereumjs/util"; import { numberToRpcQuantity, diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/blockchain.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/blockchain.ts index 8fb199ba71..c18ec6fc21 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/blockchain.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/blockchain.ts @@ -1,8 +1,8 @@ import { LegacyTransaction as Transaction, LegacyTxData as TxData, -} from "@nomicfoundation/ethereumjs-tx"; -import { bytesToHex, toBytes } from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/tx"; +import { bytesToHex, toBytes } from "@ethereumjs/util"; import { numberToRpcQuantity } from "../../../../src/internal/core/jsonrpc/types/base-types"; import { randomAddress } from "../../../../src/internal/hardhat-network/provider/utils/random"; diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/constants.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/constants.ts index 362d3f46e8..09b4d1314d 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/constants.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/constants.ts @@ -1,5 +1,5 @@ // reused from ethers.js -import { Address, toBytes } from "@nomicfoundation/ethereumjs-util"; +import { Address, toBytes } from "@ethereumjs/util"; import path from "path"; function toBuffer(x: Parameters[0]) { diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/leftPad32.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/leftPad32.ts index 591098b8b2..696d5e4227 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/leftPad32.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/leftPad32.ts @@ -1,4 +1,4 @@ -import { setLengthLeft, toBytes } from "@nomicfoundation/ethereumjs-util"; +import { setLengthLeft, toBytes } from "@ethereumjs/util"; import { assert } from "chai"; function toBuffer(x: Parameters[0]) { diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/providers.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/providers.ts index ffda52c93f..5e48460278 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/providers.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/providers.ts @@ -2,7 +2,7 @@ import { bytesToHex as bufferToHex, privateToAddress, toBytes, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import { HardhatNetworkMempoolConfig, diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/retrieveCommon.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/retrieveCommon.ts index f2c1c52cda..f292299993 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/retrieveCommon.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/retrieveCommon.ts @@ -1,5 +1,5 @@ /* eslint-disable dot-notation,@typescript-eslint/dot-notation */ -import { Common } from "@nomicfoundation/ethereumjs-common"; +import { Common } from "@ethereumjs/common"; export async function retrieveCommon(provider: any): Promise { return provider["_common"]; diff --git a/packages/hardhat-core/test/internal/hardhat-network/helpers/transactions.ts b/packages/hardhat-core/test/internal/hardhat-network/helpers/transactions.ts index ace06af9a9..c81f4ed3a6 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/helpers/transactions.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/helpers/transactions.ts @@ -1,9 +1,9 @@ -import { LegacyTransaction } from "@nomicfoundation/ethereumjs-tx"; +import { LegacyTransaction } from "@ethereumjs/tx"; import { bytesToHex as bufferToHex, toBytes, zeroAddress, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import { numberToRpcQuantity } from "../../../../src/internal/core/jsonrpc/types/base-types"; import { RpcTransactionRequestInput } from "../../../../src/internal/core/jsonrpc/types/input/transactionRequest"; diff --git a/packages/hardhat-core/test/internal/hardhat-network/jsonrpc/client.ts b/packages/hardhat-core/test/internal/hardhat-network/jsonrpc/client.ts index b6da59df99..26e69d0a6a 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/jsonrpc/client.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/jsonrpc/client.ts @@ -1,7 +1,4 @@ -import { - bytesToBigInt as bufferToBigInt, - toBytes, -} from "@nomicfoundation/ethereumjs-util"; +import { bytesToBigInt as bufferToBigInt, toBytes } from "@ethereumjs/util"; import { assert } from "chai"; import fsExtra from "fs-extra"; import sinon from "sinon"; diff --git a/packages/hardhat-core/test/internal/util/hardforks.ts b/packages/hardhat-core/test/internal/util/hardforks.ts index 0d33b8bc56..679fbc0bfa 100644 --- a/packages/hardhat-core/test/internal/util/hardforks.ts +++ b/packages/hardhat-core/test/internal/util/hardforks.ts @@ -1,4 +1,4 @@ -import { Common } from "@nomicfoundation/ethereumjs-common"; +import { Common } from "@ethereumjs/common"; import { assert } from "chai"; import { getHardforkName, diff --git a/packages/hardhat-core/test/internal/util/keys-derivation.ts b/packages/hardhat-core/test/internal/util/keys-derivation.ts index e91301301a..28eb41299f 100644 --- a/packages/hardhat-core/test/internal/util/keys-derivation.ts +++ b/packages/hardhat-core/test/internal/util/keys-derivation.ts @@ -2,7 +2,7 @@ import { bytesToHex as bufferToHex, privateToAddress, toChecksumAddress, -} from "@nomicfoundation/ethereumjs-util"; +} from "@ethereumjs/util"; import { assert } from "chai"; import { deriveKeyFromMnemonicAndPath } from "../../../src/internal/util/keys-derivation"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03218c1790..627ebcfbb0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -194,6 +194,15 @@ importers: packages/hardhat-core: dependencies: + '@ethereumjs/common': + specifier: ^4.4.0 + version: 4.4.0 + '@ethereumjs/tx': + specifier: ^5.4.0 + version: 5.4.0 + '@ethereumjs/util': + specifier: ^9.1.0 + version: 9.1.0 '@ethersproject/abi': specifier: ^5.1.2 version: 5.7.0 @@ -203,15 +212,6 @@ importers: '@nomicfoundation/edr': specifier: ^0.8.0 version: 0.8.0 - '@nomicfoundation/ethereumjs-common': - specifier: 4.0.4 - version: 4.0.4 - '@nomicfoundation/ethereumjs-tx': - specifier: 5.0.4 - version: 5.0.4 - '@nomicfoundation/ethereumjs-util': - specifier: 9.0.4 - version: 9.0.4 '@nomicfoundation/solidity-analyzer': specifier: ^0.1.0 version: 0.1.2 @@ -254,9 +254,6 @@ importers: ethereum-cryptography: specifier: ^1.0.3 version: 1.2.0 - ethereumjs-abi: - specifier: ^0.6.8 - version: 0.6.8 find-up: specifier: ^5.0.0 version: 5.0.0 @@ -333,9 +330,6 @@ importers: '@nomicfoundation/eslint-plugin-slow-imports': specifier: workspace:^ version: link:../eslint-plugin-slow-imports - '@nomicfoundation/ethereumjs-block': - specifier: 5.0.4 - version: 5.0.4 '@types/async-eventemitter': specifier: ^0.2.1 version: 0.2.4 @@ -2777,6 +2771,9 @@ packages: '@ethereumjs/common@2.6.5': resolution: {integrity: sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA==} + '@ethereumjs/common@4.4.0': + resolution: {integrity: sha512-Fy5hMqF6GsE6DpYTyqdDIJPJgUtDn4dL120zKw+Pswuo+iLyBsEYuSyzMw6NVzD2vDzcBG9fE4+qX4X2bPc97w==} + '@ethereumjs/rlp@4.0.1': resolution: {integrity: sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==} engines: {node: '>=14'} @@ -2793,10 +2790,18 @@ packages: '@ethereumjs/tx@3.5.2': resolution: {integrity: sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw==} + '@ethereumjs/tx@5.4.0': + resolution: {integrity: sha512-SCHnK7m/AouZ7nyoR0MEXw1OO/tQojSbp88t8oxhwes5iZkZCtfFdUrJaiIb72qIpH2FVw6s1k1uP7LXuH7PsA==} + engines: {node: '>=18'} + '@ethereumjs/util@8.1.0': resolution: {integrity: sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==} engines: {node: '>=14'} + '@ethereumjs/util@9.1.0': + resolution: {integrity: sha512-XBEKsYqLGXLah9PNJbgdkigthkG7TAGvlD/sH12beMXEyHDyigfcbdvHhmLyDWgDyOJn4QwiQUaF7yeuhnjdog==} + engines: {node: '>=18'} + '@ethersproject/abi@5.7.0': resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} @@ -3118,31 +3123,11 @@ packages: resolution: {integrity: sha512-dwWRrghSVBQDpt0wP+6RXD8BMz2i/9TI34TcmZqeEAZuCLei3U9KZRgGTKVAM1rMRvrpf5ROfPqrWNetKVUTag==} engines: {node: '>= 18'} - '@nomicfoundation/ethereumjs-block@5.0.4': - resolution: {integrity: sha512-AcyacJ9eX/uPEvqsPiB+WO1ymE+kyH48qGGiGV+YTojdtas8itUTW5dehDSOXEEItWGbbzEJ4PRqnQZlWaPvDw==} - engines: {node: '>=18'} - - '@nomicfoundation/ethereumjs-common@4.0.4': - resolution: {integrity: sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg==} - '@nomicfoundation/ethereumjs-rlp@5.0.4': resolution: {integrity: sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw==} engines: {node: '>=18'} hasBin: true - '@nomicfoundation/ethereumjs-trie@6.0.4': - resolution: {integrity: sha512-3nSwQiFMvr2VFe/aZUyinuohYvtytUqZCUCvIWcPJ/BwJH6oQdZRB42aNFBJ/8nAh2s3OcroWpBLskzW01mFKA==} - engines: {node: '>=18'} - - '@nomicfoundation/ethereumjs-tx@5.0.4': - resolution: {integrity: sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw==} - engines: {node: '>=18'} - peerDependencies: - c-kzg: ^2.1.2 - peerDependenciesMeta: - c-kzg: - optional: true - '@nomicfoundation/ethereumjs-util@9.0.4': resolution: {integrity: sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q==} engines: {node: '>=18'} @@ -3661,9 +3646,6 @@ packages: '@types/react@18.3.18': resolution: {integrity: sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==} - '@types/readable-stream@2.3.15': - resolution: {integrity: sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ==} - '@types/resolve@1.20.6': resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} @@ -6368,6 +6350,7 @@ packages: lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} + deprecated: This package is deprecated. Use the optional chaining (?.) operator instead. lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} @@ -6421,9 +6404,6 @@ packages: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - lru-cache@10.4.3: - resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} - lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} @@ -9268,13 +9248,17 @@ snapshots: crc-32: 1.2.2 ethereumjs-util: 7.1.5 + '@ethereumjs/common@4.4.0': + dependencies: + '@ethereumjs/util': 9.1.0 + '@ethereumjs/rlp@4.0.1': {} '@ethereumjs/rlp@5.0.2': {} '@ethereumjs/tx@3.3.2': dependencies: - '@ethereumjs/common': 2.5.0 + '@ethereumjs/common': 2.6.5 ethereumjs-util: 7.1.5 '@ethereumjs/tx@3.5.2': @@ -9282,12 +9266,24 @@ snapshots: '@ethereumjs/common': 2.6.5 ethereumjs-util: 7.1.5 + '@ethereumjs/tx@5.4.0': + dependencies: + '@ethereumjs/common': 4.4.0 + '@ethereumjs/rlp': 5.0.2 + '@ethereumjs/util': 9.1.0 + ethereum-cryptography: 2.2.1 + '@ethereumjs/util@8.1.0': dependencies: '@ethereumjs/rlp': 4.0.1 ethereum-cryptography: 2.2.1 micro-ftch: 0.3.1 + '@ethereumjs/util@9.1.0': + dependencies: + '@ethereumjs/rlp': 5.0.2 + ethereum-cryptography: 2.2.1 + '@ethersproject/abi@5.7.0': dependencies: '@ethersproject/address': 5.7.0 @@ -9866,43 +9862,8 @@ snapshots: '@nomicfoundation/edr-linux-x64-musl': 0.8.0 '@nomicfoundation/edr-win32-x64-msvc': 0.8.0 - '@nomicfoundation/ethereumjs-block@5.0.4': - dependencies: - '@nomicfoundation/ethereumjs-common': 4.0.4 - '@nomicfoundation/ethereumjs-rlp': 5.0.4 - '@nomicfoundation/ethereumjs-trie': 6.0.4 - '@nomicfoundation/ethereumjs-tx': 5.0.4 - '@nomicfoundation/ethereumjs-util': 9.0.4 - ethereum-cryptography: 0.1.3 - transitivePeerDependencies: - - c-kzg - - '@nomicfoundation/ethereumjs-common@4.0.4': - dependencies: - '@nomicfoundation/ethereumjs-util': 9.0.4 - transitivePeerDependencies: - - c-kzg - '@nomicfoundation/ethereumjs-rlp@5.0.4': {} - '@nomicfoundation/ethereumjs-trie@6.0.4': - dependencies: - '@nomicfoundation/ethereumjs-rlp': 5.0.4 - '@nomicfoundation/ethereumjs-util': 9.0.4 - '@types/readable-stream': 2.3.15 - ethereum-cryptography: 0.1.3 - lru-cache: 10.4.3 - readable-stream: 3.6.2 - transitivePeerDependencies: - - c-kzg - - '@nomicfoundation/ethereumjs-tx@5.0.4': - dependencies: - '@nomicfoundation/ethereumjs-common': 4.0.4 - '@nomicfoundation/ethereumjs-rlp': 5.0.4 - '@nomicfoundation/ethereumjs-util': 9.0.4 - ethereum-cryptography: 0.1.3 - '@nomicfoundation/ethereumjs-util@9.0.4': dependencies: '@nomicfoundation/ethereumjs-rlp': 5.0.4 @@ -10499,11 +10460,6 @@ snapshots: '@types/prop-types': 15.7.14 csstype: 3.1.3 - '@types/readable-stream@2.3.15': - dependencies: - '@types/node': 18.19.59 - safe-buffer: 5.1.2 - '@types/resolve@1.20.6': {} '@types/responselike@1.0.3': @@ -13762,8 +13718,6 @@ snapshots: lowercase-keys@3.0.0: {} - lru-cache@10.4.3: {} - lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 From 7bdff8ff5169b639f7c10a25939c97a8716f0fc5 Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Tue, 4 Feb 2025 16:42:04 +0000 Subject: [PATCH 2/9] feat: replace forked ethereumjs packages with originals in hardhat-ledger --- packages/hardhat-ledger/package.json | 2 +- packages/hardhat-ledger/src/provider.ts | 8 +++----- pnpm-lock.yaml | 27 +++---------------------- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/packages/hardhat-ledger/package.json b/packages/hardhat-ledger/package.json index 8ecd840d22..e5a3349e3e 100644 --- a/packages/hardhat-ledger/package.json +++ b/packages/hardhat-ledger/package.json @@ -35,11 +35,11 @@ "README.md" ], "dependencies": { + "@ethereumjs/util": "^9.1.0", "@ledgerhq/errors": "^6.12.6", "@ledgerhq/hw-app-eth": "6.33.6", "@ledgerhq/hw-transport": "^6.28.4", "@ledgerhq/hw-transport-node-hid": "^6.27.13", - "@nomicfoundation/ethereumjs-util": "9.0.4", "chalk": "^2.4.2", "debug": "^4.1.1", "env-paths": "^2.2.0", diff --git a/packages/hardhat-ledger/src/provider.ts b/packages/hardhat-ledger/src/provider.ts index 3313cdc5e1..a315612910 100644 --- a/packages/hardhat-ledger/src/provider.ts +++ b/packages/hardhat-ledger/src/provider.ts @@ -1,7 +1,7 @@ import { ethers } from "ethers"; import * as t from "io-ts"; -import { isValidAddress } from "@nomicfoundation/ethereumjs-util"; +import { isValidAddress } from "@ethereumjs/util"; import { isEIP712Message, ledgerService } from "@ledgerhq/hw-app-eth"; import TransportNodeHid from "@ledgerhq/hw-transport-node-hid"; @@ -407,9 +407,7 @@ export class LedgerProvider extends ProviderWrapperWithChainId { } private async _toRpcSig(signature: Signature): Promise { - const { toRpcSig, toBytes } = await import( - "@nomicfoundation/ethereumjs-util" - ); + const { toRpcSig, toBytes } = await import("@ethereumjs/util"); return toRpcSig( BigInt(signature.v - 27), @@ -419,7 +417,7 @@ export class LedgerProvider extends ProviderWrapperWithChainId { } private async _getNonce(address: Buffer): Promise { - const { bytesToHex } = await import("@nomicfoundation/ethereumjs-util"); + const { bytesToHex } = await import("@ethereumjs/util"); const response = (await this._wrappedProvider.request({ method: "eth_getTransactionCount", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 627ebcfbb0..097faee45d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1111,6 +1111,9 @@ importers: packages/hardhat-ledger: dependencies: + '@ethereumjs/util': + specifier: ^9.1.0 + version: 9.1.0 '@ledgerhq/errors': specifier: ^6.12.6 version: 6.19.1 @@ -1123,9 +1126,6 @@ importers: '@ledgerhq/hw-transport-node-hid': specifier: ^6.27.13 version: 6.29.5 - '@nomicfoundation/ethereumjs-util': - specifier: 9.0.4 - version: 9.0.4 chalk: specifier: ^2.4.2 version: 2.4.2 @@ -3123,20 +3123,6 @@ packages: resolution: {integrity: sha512-dwWRrghSVBQDpt0wP+6RXD8BMz2i/9TI34TcmZqeEAZuCLei3U9KZRgGTKVAM1rMRvrpf5ROfPqrWNetKVUTag==} engines: {node: '>= 18'} - '@nomicfoundation/ethereumjs-rlp@5.0.4': - resolution: {integrity: sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw==} - engines: {node: '>=18'} - hasBin: true - - '@nomicfoundation/ethereumjs-util@9.0.4': - resolution: {integrity: sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q==} - engines: {node: '>=18'} - peerDependencies: - c-kzg: ^2.1.2 - peerDependenciesMeta: - c-kzg: - optional: true - '@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2': resolution: {integrity: sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw==} engines: {node: '>= 12'} @@ -9862,13 +9848,6 @@ snapshots: '@nomicfoundation/edr-linux-x64-musl': 0.8.0 '@nomicfoundation/edr-win32-x64-msvc': 0.8.0 - '@nomicfoundation/ethereumjs-rlp@5.0.4': {} - - '@nomicfoundation/ethereumjs-util@9.0.4': - dependencies: - '@nomicfoundation/ethereumjs-rlp': 5.0.4 - ethereum-cryptography: 0.1.3 - '@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2': optional: true From f84ee43c289914576bb046c3cac57eea3bb88dbe Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Thu, 6 Feb 2025 16:53:14 +0000 Subject: [PATCH 3/9] feat: add prague to supported hardforks --- docs/src/content/hardhat-network/docs/reference/index.md | 3 ++- packages/hardhat-core/src/internal/constants.ts | 1 + packages/hardhat-core/src/internal/util/hardforks.ts | 2 ++ packages/hardhat-core/test/internal/util/hardforks.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/src/content/hardhat-network/docs/reference/index.md b/docs/src/content/hardhat-network/docs/reference/index.md index 2078eef9c2..af3aefa8a7 100644 --- a/docs/src/content/hardhat-network/docs/reference/index.md +++ b/docs/src/content/hardhat-network/docs/reference/index.md @@ -14,6 +14,7 @@ - merge - shanghai - cancun +- prague ## Config @@ -66,7 +67,7 @@ The block gas limit to use in Hardhat Network's blockchain. Default value: `30_0 #### `hardfork` -This setting changes how Hardhat Network works, to mimic Ethereum's mainnet at a given hardfork. It must be one of `"byzantium"`, `"constantinople"`, `"petersburg"`, `"istanbul"`, `"muirGlacier"`, `"berlin"`, `"london"`, `"arrowGlacier"`, `"grayGlacier"`, `"merge"`, `"shanghai"` and `"cancun"`. Default value: `"cancun"` +This setting changes how Hardhat Network works, to mimic Ethereum's mainnet at a given hardfork. It must be one of `"byzantium"`, `"constantinople"`, `"petersburg"`, `"istanbul"`, `"muirGlacier"`, `"berlin"`, `"london"`, `"arrowGlacier"`, `"grayGlacier"`, `"merge"`, `"shanghai"`, `"cancun"` and `"prague"`. Default value: `"cancun"` #### `throwOnTransactionFailures` diff --git a/packages/hardhat-core/src/internal/constants.ts b/packages/hardhat-core/src/internal/constants.ts index f6c39bd997..47b0f1dd81 100644 --- a/packages/hardhat-core/src/internal/constants.ts +++ b/packages/hardhat-core/src/internal/constants.ts @@ -23,6 +23,7 @@ export const HARDHAT_NETWORK_SUPPORTED_HARDFORKS = [ "merge", "shanghai", "cancun", + "prague", ]; export const HARDHAT_MEMPOOL_SUPPORTED_ORDERS = ["fifo", "priority"] as const; diff --git a/packages/hardhat-core/src/internal/util/hardforks.ts b/packages/hardhat-core/src/internal/util/hardforks.ts index a5fb8c932f..14ff4128d3 100644 --- a/packages/hardhat-core/src/internal/util/hardforks.ts +++ b/packages/hardhat-core/src/internal/util/hardforks.ts @@ -23,6 +23,7 @@ export enum HardforkName { MERGE = "merge", SHANGHAI = "shanghai", CANCUN = "cancun", + PRAGUE = "prague", } const HARDFORKS_ORDER: HardforkName[] = [ @@ -43,6 +44,7 @@ const HARDFORKS_ORDER: HardforkName[] = [ HardforkName.MERGE, HardforkName.SHANGHAI, HardforkName.CANCUN, + HardforkName.PRAGUE, ]; export function getHardforkName(name: string): HardforkName { diff --git a/packages/hardhat-core/test/internal/util/hardforks.ts b/packages/hardhat-core/test/internal/util/hardforks.ts index 679fbc0bfa..bf30f7b7c1 100644 --- a/packages/hardhat-core/test/internal/util/hardforks.ts +++ b/packages/hardhat-core/test/internal/util/hardforks.ts @@ -45,6 +45,7 @@ describe("Hardfork utils", function () { assert.equal("merge", HardforkName.MERGE); assert.equal("shanghai", HardforkName.SHANGHAI); assert.equal("cancun", HardforkName.CANCUN); + assert.equal("prague", HardforkName.PRAGUE); }); }); From 0f28475f64f8ddf72da7c0de2dfbc75b2b5cd955 Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Thu, 6 Feb 2025 17:31:16 +0000 Subject: [PATCH 4/9] feat: add prague to chains map --- .../hardhat-core/src/internal/core/config/default-config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hardhat-core/src/internal/core/config/default-config.ts b/packages/hardhat-core/src/internal/core/config/default-config.ts index 986b360821..bed6cd2dd8 100644 --- a/packages/hardhat-core/src/internal/core/config/default-config.ts +++ b/packages/hardhat-core/src/internal/core/config/default-config.ts @@ -56,7 +56,7 @@ export const defaultHardhatNetworkParams: Omit< minGasPrice: 0n, chains: new Map([ [ - // block numbers below were taken from https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common/src/chains + // block numbers below were taken from https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/common/src/chains.ts 1, // mainnet { hardforkHistory: new Map([ @@ -77,6 +77,7 @@ export const defaultHardhatNetworkParams: Omit< [HardforkName.MERGE, 15_537_394], [HardforkName.SHANGHAI, 17_034_870], [HardforkName.CANCUN, 19_426_589], + [HardforkName.PRAGUE, 30_000_000], // TODO: replace with actual block number ]), }, ], @@ -138,6 +139,7 @@ export const defaultHardhatNetworkParams: Omit< [HardforkName.MERGE, 1_450_409], [HardforkName.SHANGHAI, 2_990_908], [HardforkName.CANCUN, 5_187_023], + [HardforkName.PRAGUE, 30_000_000], // TODO: replace with actual block number ]), }, ], From 3e40b71935ac7ae48ed70cfbdcf0bdf0a757fcff Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Thu, 6 Feb 2025 17:32:06 +0000 Subject: [PATCH 5/9] feat: add prague to edr mappings --- .../hardhat-network/provider/utils/convertToEdr.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts index 848357f5d4..586c866968 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts @@ -61,6 +61,9 @@ export function ethereumsjsHardforkToEdrSpecId(hardfork: HardforkName): SpecId { return SpecId.Shanghai; case HardforkName.CANCUN: return SpecId.Cancun; + case HardforkName.PRAGUE: + // TODO: update the value when Prague is added to EDR + return SpecId.Cancun; default: const _exhaustiveCheck: never = hardfork; throw new Error( @@ -107,9 +110,11 @@ export function edrSpecIdToEthereumHardfork(specId: SpecId): HardforkName { return HardforkName.MERGE; case SpecId.Shanghai: return HardforkName.SHANGHAI; - // HACK: EthereumJS doesn't support Cancun, so report Shanghai case SpecId.Cancun: - return HardforkName.SHANGHAI; + return HardforkName.CANCUN; + // TODO: uncomment when Prague is added to EDR + /* case SpecId.Prague: + return HardforkName.PRAGUE; */ default: throw new Error(`Unknown spec id '${specId}', this shouldn't happen`); From 32c54e4e44dd2524474d8f6458d3cb66056f8cef Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Mon, 10 Feb 2025 17:05:20 +0000 Subject: [PATCH 6/9] feat: add authorization list and sign type 4 tx --- .../core/jsonrpc/types/authorization-list.ts | 20 +++++++++ .../internal/core/jsonrpc/types/base-types.ts | 12 ++++++ .../jsonrpc/types/input/transactionRequest.ts | 10 +++++ .../src/internal/core/providers/accounts.ts | 42 +++++++++++++++++-- .../hardhat-network/provider/output.ts | 17 +++++++- .../test/internal/core/providers/accounts.ts | 35 ++++++++++++++++ 6 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 packages/hardhat-core/src/internal/core/jsonrpc/types/authorization-list.ts diff --git a/packages/hardhat-core/src/internal/core/jsonrpc/types/authorization-list.ts b/packages/hardhat-core/src/internal/core/jsonrpc/types/authorization-list.ts new file mode 100644 index 0000000000..194a6e5b80 --- /dev/null +++ b/packages/hardhat-core/src/internal/core/jsonrpc/types/authorization-list.ts @@ -0,0 +1,20 @@ +import * as t from "io-ts"; + +import { rpcAddress, rpcQuantity, rpcHash, rpcParity } from "./base-types"; + +const rpcAuthorizationListTuple = t.type({ + chainId: rpcQuantity, + address: rpcAddress, + nonce: rpcQuantity, + yParity: rpcParity, + r: rpcHash, + s: rpcHash, +}); + +export const rpcAuthorizationList = t.array(rpcAuthorizationListTuple); + +export type RpcAuthorizationListTuple = t.TypeOf< + typeof rpcAuthorizationListTuple +>; + +export type RpcAuthorizationList = t.TypeOf; diff --git a/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts b/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts index 510ff4b8d6..2baaf55c4c 100644 --- a/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts +++ b/packages/hardhat-core/src/internal/core/jsonrpc/types/base-types.ts @@ -27,6 +27,14 @@ export const rpcData = new t.Type( t.identity ); +export const rpcParity = new t.Type( + "PARITY", + Buffer.isBuffer, + (u, c) => + isRpcParityString(u) ? t.success(Buffer.from(toBytes(u))) : t.failure(u, c), + t.identity +); + export const rpcHash = new t.Type( "HASH", (v): v is Buffer => Buffer.isBuffer(v) && v.length === HASH_LENGTH_BYTES, @@ -216,6 +224,10 @@ function isRpcDataString(u: unknown): u is string { return typeof u === "string" && u.match(/^0x(?:[0-9a-fA-F]{2})*$/) !== null; } +function isRpcParityString(u: unknown): u is string { + return typeof u === "string" && u.match(/^0x[0-9a-fA-F]{1,2}$/) !== null; +} + function isRpcHashString(u: unknown): u is string { return typeof u === "string" && u.length === 66 && isRpcDataString(u); } diff --git a/packages/hardhat-core/src/internal/core/jsonrpc/types/input/transactionRequest.ts b/packages/hardhat-core/src/internal/core/jsonrpc/types/input/transactionRequest.ts index 1f13b8a8b1..ebca660059 100644 --- a/packages/hardhat-core/src/internal/core/jsonrpc/types/input/transactionRequest.ts +++ b/packages/hardhat-core/src/internal/core/jsonrpc/types/input/transactionRequest.ts @@ -3,6 +3,7 @@ import * as t from "io-ts"; import { optionalOrNullable } from "../../../../util/io-ts"; import { rpcAccessList } from "../access-list"; import { rpcAddress, rpcData, rpcHash, rpcQuantity } from "../base-types"; +import { rpcAuthorizationList } from "../authorization-list"; // Type used by eth_sendTransaction export const rpcTransactionRequest = t.type( @@ -20,6 +21,7 @@ export const rpcTransactionRequest = t.type( maxPriorityFeePerGas: optionalOrNullable(rpcQuantity), blobs: optionalOrNullable(t.array(rpcData)), blobVersionedHashes: optionalOrNullable(t.array(rpcHash)), + authorizationList: optionalOrNullable(rpcAuthorizationList), }, "RpcTransactionRequest" ); @@ -42,6 +44,14 @@ export interface RpcTransactionRequestInput { maxPriorityFeePerGas?: string; blobs?: string[]; blobVersionedHashes?: string[]; + authorizationList?: Array<{ + chainId: string; + address: string; + nonce: string; + yParity: string; + r: string; + s: string; + }>; } export type RpcTransactionRequest = t.TypeOf; diff --git a/packages/hardhat-core/src/internal/core/providers/accounts.ts b/packages/hardhat-core/src/internal/core/providers/accounts.ts index bdf8075c9b..cd58d69bbf 100644 --- a/packages/hardhat-core/src/internal/core/providers/accounts.ts +++ b/packages/hardhat-core/src/internal/core/providers/accounts.ts @@ -245,12 +245,16 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { chainId: number, privateKey: Buffer ): Promise { - const { AccessListEIP2930Transaction, LegacyTransaction } = await import( - "@ethereumjs/tx" - ); + const { + AccessListEIP2930Transaction, + LegacyTransaction, + EOACodeEIP7702Transaction, + } = await import("@ethereumjs/tx"); const { Common } = await import("@ethereumjs/common"); + const { toBytes } = await import("@ethereumjs/util"); + const txData = { ...transactionRequest, gasLimit: transactionRequest.gas, @@ -268,8 +272,38 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId { ({ address, storageKeys }) => [address, storageKeys] as [Buffer, Buffer[]] ); + // we convert the authorization list to the type + // that EOACodeEIP7702Transaction expects + const authorizationList = txData.authorizationList?.map( + ({ chainId: authChainId, address, nonce, yParity, r, s }) => + // TODO: There is an error in the type definition of rpcAuthorizationList + // in the @ethereumjs/common@4.4.0 package where nonce is defined as an + // array but it should be a string. This is fixed in the alpha version + // of the package but is not yet released. To work around this, we wrap + // nonce in an array here. However, this will not be accepted by the + // node and will throw an error. + [ + Buffer.from(toBytes(authChainId)), + address, + [Buffer.from(toBytes(nonce))], + yParity, + r, + s, + ] as [Buffer, Buffer, Buffer[], Buffer, Buffer, Buffer] + ); + let transaction; - if (txData.maxFeePerGas !== undefined) { + if (authorizationList !== undefined) { + transaction = EOACodeEIP7702Transaction.fromTxData( + { + ...txData, + accessList, + authorizationList, + gasPrice: undefined, + }, + { common } + ); + } else if (txData.maxFeePerGas !== undefined) { transaction = FeeMarketEIP1559Transaction.fromTxData( { ...txData, diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/output.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/output.ts index 66e35744f4..3680d436d4 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/output.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/output.ts @@ -31,7 +31,8 @@ export interface RpcBlockOutput { export type RpcTransactionOutput = | LegacyRpcTransactionOutput | AccessListEIP2930RpcTransactionOutput - | EIP1559RpcTransactionOutput; + | EIP1559RpcTransactionOutput + | EOACodeEIP7702TransactionOutput; interface BaseRpcTransactionOutput { blockHash: string | null; @@ -60,6 +61,15 @@ export type RpcAccessListOutput = Array<{ storageKeys: string[]; }>; +export type RpcAuthorizationListOutput = Array<{ + chainId: string; + address: string; + nonce: string; + yParity: string; + r: string; + s: string; +}>; + export interface AccessListEIP2930RpcTransactionOutput extends BaseRpcTransactionOutput { gasPrice: string; @@ -75,6 +85,11 @@ export interface EIP1559RpcTransactionOutput extends BaseRpcTransactionOutput { chainId: string; } +export interface EOACodeEIP7702TransactionOutput + extends EIP1559RpcTransactionOutput { + authorizationList?: RpcAuthorizationListOutput; +} + export interface RpcReceiptOutput { blockHash: string; blockNumber: string; diff --git a/packages/hardhat-core/test/internal/core/providers/accounts.ts b/packages/hardhat-core/test/internal/core/providers/accounts.ts index aceb597381..89a8880ecb 100644 --- a/packages/hardhat-core/test/internal/core/providers/accounts.ts +++ b/packages/hardhat-core/test/internal/core/providers/accounts.ts @@ -42,6 +42,7 @@ describe("Local accounts provider", () => { "0x6d7229c1db5892730b84b4bc10543733b72cabf4cd3130d910faa8e459bb8eca", "0x6d4ec871d9b5469119bbfc891e958b6220d076a6849006098c370c8af5fc7776", "0xec02c2b7019e75378a05018adc30a0252ba705670acb383a1d332e57b0b792d2", + "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", ]; beforeEach(() => { @@ -307,6 +308,40 @@ describe("Local accounts provider", () => { validateRawEIP2930Transaction(expectedRaw, tx); }); + // TODO: enable this test once prague is supported + it.skip("should send EIP-7702 transactions", async () => { + const tx = { + from: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + to: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + gas: numberToRpcQuantity(100000), + maxFeePerGas: numberToRpcQuantity(10n * 10n ** 9n), + maxPriorityFeePerGas: numberToRpcQuantity(10n ** 9n), + chainId: numberToRpcQuantity(MOCK_PROVIDER_CHAIN_ID), + nonce: numberToRpcQuantity(0), + authorizationList: [ + { + chainId: numberToRpcQuantity(MOCK_PROVIDER_CHAIN_ID), + nonce: numberToRpcQuantity(1), + address: "0x1234567890123456789012345678901234567890", + yParity: "0x1", + r: "0xd4c36a32c935f7abf3950062024b08ee85a707cd725274a5b017865ea6e989ad", + s: "0x6218f33b32f2f26783db21cde75e6b72bcacfedbac4c1a1af438e3e5c755918a", + }, + ], + }; + await wrapper.request({ + method: "eth_sendTransaction", + params: [tx], + }); + + const rawTransaction = mock.getLatestParams("eth_sendRawTransaction")[0]; + + const expectedRaw = + "0x04f8ca7b80843b9aca008502540be400830186a094f39fd6e51aad88f6f4ce6ab8827279cfffb922668080c0f85cf85a7b9412345678901234567890123456789012345678900101a0d4c36a32c935f7abf3950062024b08ee85a707cd725274a5b017865ea6e989ada06218f33b32f2f26783db21cde75e6b72bcacfedbac4c1a1af438e3e5c755918a80a09ae0f9ac575ff45f38805f7101455b397d248166a2a5771122a66e6c279c279ba0234d80d08a6f369a134b0058b74076e608db10da97ec3660ad829c8d4246098f"; + + assert.equal(rawTransaction, expectedRaw); + }); + it("should add the chainId value if it's missing", async () => { const tx = { from: "0xb5bc06d4548a3ac17d72b372ae1e416bf65b8ead", From cc29fc4ff57760b1db2a8bc174cdf79dd9b1b97b Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Wed, 5 Mar 2025 10:00:02 +0100 Subject: [PATCH 7/9] Convert Prague hardfork to EDR's SpecId --- .../internal/hardhat-network/provider/utils/convertToEdr.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts index 586c866968..7f92affee8 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts @@ -62,8 +62,7 @@ export function ethereumsjsHardforkToEdrSpecId(hardfork: HardforkName): SpecId { case HardforkName.CANCUN: return SpecId.Cancun; case HardforkName.PRAGUE: - // TODO: update the value when Prague is added to EDR - return SpecId.Cancun; + return SpecId.Prague; default: const _exhaustiveCheck: never = hardfork; throw new Error( From 5dc5c7b574dc06df1d4740c1a603e05b14ba7e98 Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Wed, 12 Mar 2025 17:13:23 +0000 Subject: [PATCH 8/9] feat: update EDR --- packages/hardhat-core/package.json | 2 +- pnpm-lock.yaml | 67 +++++++++++++++--------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index b6f4face5c..83739c1214 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -102,7 +102,7 @@ "@ethereumjs/util": "^9.1.0", "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/edr": "^0.9.0", + "@nomicfoundation/edr": "^0.10.0", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2430587522..faea30ec38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -210,8 +210,8 @@ importers: specifier: ^4.0.0 version: 4.0.1 '@nomicfoundation/edr': - specifier: ^0.9.0 - version: 0.9.0 + specifier: ^0.10.0 + version: 0.10.0 '@nomicfoundation/solidity-analyzer': specifier: ^0.1.0 version: 0.1.2 @@ -3091,36 +3091,36 @@ packages: resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} engines: {node: '>=12.4.0'} - '@nomicfoundation/edr-darwin-arm64@0.9.0': - resolution: {integrity: sha512-px47bTRzCJ0b5WqVIxr0c9hTkg8Lm+wtjE3mnKWvti/7hM4ZXrZE+DlYUzKZem/tb+C3LV2fuhJ8Yd0v4/n9Ag==} + '@nomicfoundation/edr-darwin-arm64@0.10.0': + resolution: {integrity: sha512-n0N+CVM4LKN9QeGZ5irr94Q4vwSs4u7W6jfuhNLmx1cpUxwE9RpeW+ym93JXDv62iVsbekeI5VsUEBHy0hymtA==} engines: {node: '>= 18'} - '@nomicfoundation/edr-darwin-x64@0.9.0': - resolution: {integrity: sha512-gHCZVsBqtKk2Jrvpis6NhPnOoe1WRoY4aoXbRmThSXqrK1xaZ4d1qfDQSvBB921R0+NdhgKrxd3Hfg9lRTUbdg==} + '@nomicfoundation/edr-darwin-x64@0.10.0': + resolution: {integrity: sha512-nmImWM/3qWopYzOmicMzK/MF3rFKpm2Biuc8GpQYTLjdXhmItpP9JwEPyjbAWv/1HI09C2pRzgNzKfTxoIgJ6w==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-arm64-gnu@0.9.0': - resolution: {integrity: sha512-T5zIar+Agt5uQKvcSPG1xEQZw5SuvQtG980fug9rtz1w+RKs3xSieF9Cl4yIcEz9XxeWI2DBTPlqslsWwlBtTw==} + '@nomicfoundation/edr-linux-arm64-gnu@0.10.0': + resolution: {integrity: sha512-B/N1IyrCU7J6H4QckkQ1cSWAq1jSrJcXpO8GzRaQD1bgOOvg8wrUOrCD+Mfw7MLa6+X9vdZoXtPZOaaOQ9LmhA==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-arm64-musl@0.9.0': - resolution: {integrity: sha512-B5WOTvz36I01E71gy5ldj6MqvldHIujW81+V9Rykc9xg4WpxA+wpwbcT26ou09hK+6NRVET6qk/kc4EoFMD/JQ==} + '@nomicfoundation/edr-linux-arm64-musl@0.10.0': + resolution: {integrity: sha512-NA9DFLB0LzcKy9mTCUzgnRDbmmSfW0CdO22ySwOy+MKt4Cr9eJi+XR5ZH933Rxpi6BWNkSPeS2ECETE25sJT3w==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-x64-gnu@0.9.0': - resolution: {integrity: sha512-DAouwbPvCiqZ+wVsj1vskI3zCZAydbAmoXii3Zxj9XZwwL+CVZdHTGGS+FSArvKnueTn0yN0SJoKJypcEDfCgQ==} + '@nomicfoundation/edr-linux-x64-gnu@0.10.0': + resolution: {integrity: sha512-bDrbRTA9qZ9wSw5mqa8VpLFbf6ue2Z4qmRd08404eKm8RyBEFxjdHflFzCx46gz/Td0e+GLXy6KTVDj5D29r8w==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-x64-musl@0.9.0': - resolution: {integrity: sha512-2aqQc7vuoSDKtGH+fNKiMKBEO7lII+WgVsI3bMMG53xw5YDTVoCyG7efwUsRX6X7zkIN6zUH98UDRbzj3ch3ug==} + '@nomicfoundation/edr-linux-x64-musl@0.10.0': + resolution: {integrity: sha512-wx7yOlC/hx4N1xuIeh5cAebpzCTx8ZH8/z0IyYMf2t4v52KHERz4IyzBz5OLfd+0IqTRg8ZU5EnFBacIoPeP/g==} engines: {node: '>= 18'} - '@nomicfoundation/edr-win32-x64-msvc@0.9.0': - resolution: {integrity: sha512-iHOe8v+sTSneukg5yHRd5S97bvwxUd+XN6X0cQy9lSKi/CtPUEimKTjoONZO1m4e7jWVXlcRfiVxZDCmSwdMSw==} + '@nomicfoundation/edr-win32-x64-msvc@0.10.0': + resolution: {integrity: sha512-DpBdVMimb+BUEs0E+nLGQ5JFHdGHyxQQNA+nh9V1eKtgarsV21S6br/d1vlQBMLQqkIzwmc6n+/O9Zjk2KfB3g==} engines: {node: '>= 18'} - '@nomicfoundation/edr@0.9.0': - resolution: {integrity: sha512-pjZtppf7+sCE2js07qed1vrnUrwUP4VCPuzYm/B+tKac26Xov1bwHefNsn5EUo0x9VaQ4L7iKEQX/u5jj4DHTQ==} + '@nomicfoundation/edr@0.10.0': + resolution: {integrity: sha512-ed9qHSNssgh+0hYUx4ilDoMxxgf/sNT8SjnzgmA5A/LSXHaq2ax68bkdQ8otLYTlxHCO9BS5Nhb8bfajV4FZeA==} engines: {node: '>= 18'} '@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2': @@ -6341,6 +6341,7 @@ packages: lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. lodash.memoize@4.1.2: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} @@ -9825,29 +9826,29 @@ snapshots: '@nolyfill/is-core-module@1.0.39': {} - '@nomicfoundation/edr-darwin-arm64@0.9.0': {} + '@nomicfoundation/edr-darwin-arm64@0.10.0': {} - '@nomicfoundation/edr-darwin-x64@0.9.0': {} + '@nomicfoundation/edr-darwin-x64@0.10.0': {} - '@nomicfoundation/edr-linux-arm64-gnu@0.9.0': {} + '@nomicfoundation/edr-linux-arm64-gnu@0.10.0': {} - '@nomicfoundation/edr-linux-arm64-musl@0.9.0': {} + '@nomicfoundation/edr-linux-arm64-musl@0.10.0': {} - '@nomicfoundation/edr-linux-x64-gnu@0.9.0': {} + '@nomicfoundation/edr-linux-x64-gnu@0.10.0': {} - '@nomicfoundation/edr-linux-x64-musl@0.9.0': {} + '@nomicfoundation/edr-linux-x64-musl@0.10.0': {} - '@nomicfoundation/edr-win32-x64-msvc@0.9.0': {} + '@nomicfoundation/edr-win32-x64-msvc@0.10.0': {} - '@nomicfoundation/edr@0.9.0': + '@nomicfoundation/edr@0.10.0': dependencies: - '@nomicfoundation/edr-darwin-arm64': 0.9.0 - '@nomicfoundation/edr-darwin-x64': 0.9.0 - '@nomicfoundation/edr-linux-arm64-gnu': 0.9.0 - '@nomicfoundation/edr-linux-arm64-musl': 0.9.0 - '@nomicfoundation/edr-linux-x64-gnu': 0.9.0 - '@nomicfoundation/edr-linux-x64-musl': 0.9.0 - '@nomicfoundation/edr-win32-x64-msvc': 0.9.0 + '@nomicfoundation/edr-darwin-arm64': 0.10.0 + '@nomicfoundation/edr-darwin-x64': 0.10.0 + '@nomicfoundation/edr-linux-arm64-gnu': 0.10.0 + '@nomicfoundation/edr-linux-arm64-musl': 0.10.0 + '@nomicfoundation/edr-linux-x64-gnu': 0.10.0 + '@nomicfoundation/edr-linux-x64-musl': 0.10.0 + '@nomicfoundation/edr-win32-x64-msvc': 0.10.0 '@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2': optional: true From 2e79b36d83c31b7afe98e388561cd4e804f5676f Mon Sep 17 00:00:00 2001 From: Luis Schaab Date: Wed, 12 Mar 2025 17:23:58 +0000 Subject: [PATCH 9/9] feat: fix TODOs in convertToEdr --- .../internal/hardhat-network/provider/utils/convertToEdr.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts index 7f92affee8..c5e9bd797f 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts @@ -111,9 +111,8 @@ export function edrSpecIdToEthereumHardfork(specId: SpecId): HardforkName { return HardforkName.SHANGHAI; case SpecId.Cancun: return HardforkName.CANCUN; - // TODO: uncomment when Prague is added to EDR - /* case SpecId.Prague: - return HardforkName.PRAGUE; */ + case SpecId.Prague: + return HardforkName.PRAGUE; default: throw new Error(`Unknown spec id '${specId}', this shouldn't happen`);