Skip to content

Prague support #6223

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

Merged
merged 17 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fuzzy-paws-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@nomicfoundation/hardhat-ledger": minor
"hardhat": minor
---

Add support for the Prague hardfork
3 changes: 2 additions & 1 deletion docs/src/content/hardhat-network/docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- merge
- shanghai
- cancun
- prague

## Config

Expand Down Expand Up @@ -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`

Expand Down
8 changes: 2 additions & 6 deletions packages/hardhat-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -98,12 +97,9 @@
"typescript": "~5.0.0"
},
"dependencies": {
"@ethereumjs/util": "^9.1.0",
"@ethersproject/abi": "^5.1.2",
"@metamask/eth-sig-util": "^4.0.0",
"@nomicfoundation/edr": "^0.10.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",
Expand All @@ -118,7 +114,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",
Expand All @@ -127,6 +122,7 @@
"json-stream-stringify": "^3.1.4",
"keccak": "^3.0.2",
"lodash": "^4.17.11",
"micro-eth-signer": "^0.14.0",
"mnemonist": "^0.38.0",
"mocha": "^10.0.0",
"p-map": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat-core/src/builtin-tasks/node.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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("========");
Expand Down
1 change: 1 addition & 0 deletions packages/hardhat-core/src/internal/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const HARDHAT_NETWORK_SUPPORTED_HARDFORKS = [
"merge",
"shanghai",
"cancun",
"prague",
];

export const HARDHAT_MEMPOOL_SUPPORTED_ORDERS = ["fifo", "priority"] as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
]),
},
],
Expand Down Expand Up @@ -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
]),
},
],
Expand Down
18 changes: 18 additions & 0 deletions packages/hardhat-core/src/internal/core/errors-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,24 @@ Please check that you are sending an \`address\` parameter.`,
Please check that you are sending a non-empty string for network or forking \`URL\` parameter.`,
shouldBeReported: false,
},
INCOMPATIBLE_EIP7702_FIELDS: {
number: 118,
message: "An incompatible transaction with gasPrice and EIP-7702 fields.",
title: "Incompatible EIP-7702 parameters",
description: `You are trying to send a transaction with a locally managed
account, and its parameters are incompatible. You sent both gasPrice and authorizationList.

Please double check your transactions' parameters.`,
shouldBeReported: false,
},
DATA_FIELD_CANNOT_BE_NULL_WITH_NULL_ADDRESS: {
number: 119,
message: `The "to" field is undefined, and the "data" field is also undefined; however, a transaction to the null address cannot have an undefined "data" field.`,
title: "Transaction to null address cannot have undefined data",
description:
"The transaction to the null address cannot have undefined data",
shouldBeReported: false,
},
},
TASK_DEFINITIONS: {
PARAM_AFTER_VARIADIC: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<typeof rpcAuthorizationList>;
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -27,6 +27,14 @@ export const rpcData = new t.Type<Buffer>(
t.identity
);

export const rpcParity = new t.Type<Buffer>(
"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<Buffer>(
"HASH",
(v): v is Buffer => Buffer.isBuffer(v) && v.length === HASH_LENGTH_BYTES,
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"
);
Expand All @@ -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<typeof rpcTransactionRequest>;
Loading
Loading