Skip to content

Commit f944cd5

Browse files
Wodannfvictorio
andauthored
Upgrade to EDR v0.5 and add enableRip7212 option (#5512)
Co-authored-by: Franco Victorio <[email protected]>
1 parent 739d593 commit f944cd5

File tree

11 files changed

+56
-34
lines changed

11 files changed

+56
-34
lines changed

.changeset/great-crabs-hug.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Added an `enableRip7212` optional flag to the Hardhat Network config that enables [RIP-7212 (Precompile for secp256r1 Curve Support)](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md).

.changeset/modern-points-cover.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Bumped EDR to [v0.5.0](https://github.com/NomicFoundation/edr/releases/tag/%40nomicfoundation%2Fedr%400.5.0).

docs/src/content/hardhat-network/docs/reference/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ The `baseFeePerGas` of the first block. Note that when forking a remote network,
122122

123123
The address used as coinbase in new blocks. Default value: `"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e"`.
124124

125+
#### `enableRip7212`
126+
127+
A flag indicating whether to enable [RIP-7212 (Precompile for secp256r1 Curve Support)](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md). Default value: `false`.
128+
125129
### Mining modes
126130

127131
You can configure the mining behavior under your Hardhat Network settings:

packages/hardhat-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"dependencies": {
103103
"@ethersproject/abi": "^5.1.2",
104104
"@metamask/eth-sig-util": "^4.0.0",
105-
"@nomicfoundation/edr": "^0.4.2",
105+
"@nomicfoundation/edr": "^0.5.0",
106106
"@nomicfoundation/ethereumjs-common": "4.0.4",
107107
"@nomicfoundation/ethereumjs-tx": "5.0.4",
108108
"@nomicfoundation/ethereumjs-util": "9.0.4",

packages/hardhat-core/src/internal/core/providers/construction.ts

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export async function createProvider(
114114
paths !== undefined ? getForkCacheDirPath(paths) : undefined,
115115
enableTransientStorage:
116116
hardhatNetConfig.enableTransientStorage ?? false,
117+
enableRip7212: hardhatNetConfig.enableRip7212 ?? false,
117118
},
118119
{
119120
enabled: hardhatNetConfig.loggingEnabled,

packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ interface HardhatNetworkProviderConfig {
120120
forkConfig?: ForkConfig;
121121
forkCachePath?: string;
122122
enableTransientStorage: boolean;
123+
enableRip7212: boolean;
123124
}
124125

125126
export function getNodeConfig(
@@ -255,6 +256,7 @@ export class EdrProviderWrapper
255256
}),
256257
cacheDir: config.forkCachePath,
257258
coinbase: Buffer.from(coinbase.slice(2), "hex"),
259+
enableRip7212: config.enableRip7212,
258260
fork,
259261
hardfork: ethereumsjsHardforkToEdrSpecId(hardforkName),
260262
genesisAccounts: config.genesisAccounts.map((account) => {

packages/hardhat-core/src/internal/hardhat-network/provider/vm/exit.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class Exit {
2424
case SuccessReason.Stop:
2525
case SuccessReason.Return:
2626
case SuccessReason.SelfDestruct:
27+
case SuccessReason.EofReturnContract:
2728
return new Exit(ExitCode.SUCCESS);
2829
}
2930

packages/hardhat-core/src/types/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface HardhatNetworkUserConfig {
5858
coinbase?: string;
5959
chains?: HardhatNetworkChainsUserConfig;
6060
enableTransientStorage?: boolean;
61+
enableRip7212?: boolean;
6162
}
6263

6364
export type HardhatNetworkAccountsUserConfig =
@@ -155,6 +156,7 @@ export interface HardhatNetworkConfig {
155156
chains: HardhatNetworkChainsConfig;
156157
allowBlocksWithSameTimestamp?: boolean;
157158
enableTransientStorage?: boolean;
159+
enableRip7212?: boolean;
158160
}
159161

160162
export type HardhatNetworkAccountsConfig =

packages/hardhat-core/test/internal/hardhat-network/helpers/useProvider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export function useProvider({
101101
coinbase,
102102
allowBlocksWithSameTimestamp,
103103
enableTransientStorage: false,
104+
enableRip7212: false,
104105
},
105106
{
106107
enabled: loggerEnabled,

packages/hardhat-core/test/internal/hardhat-network/stack-traces/execution.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export async function instantiateProvider(
5353
coinbase: "0x0000000000000000000000000000000000000000",
5454
initialBaseFeePerGas: 0,
5555
enableTransientStorage: false,
56+
enableRip7212: false,
5657
};
5758

5859
const provider = await EdrProviderWrapper.create(

pnpm-lock.yaml

+33-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)