Skip to content

Commit 4130bc7

Browse files
committed
Re-add _common in EDR provider
1 parent 45b81dd commit 4130bc7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
TracingMessage,
2020
TracingStep,
2121
} from "@ignored/edr";
22+
import { Common } from "@nomicfoundation/ethereumjs-common";
2223
import chalk from "chalk";
2324
import debug from "debug";
2425
import { EventEmitter } from "events";
@@ -70,6 +71,7 @@ import {
7071
ethereumjsMempoolOrderToEdrMineOrdering,
7172
ethereumsjsHardforkToEdrSpecId,
7273
} from "./utils/convertToEdr";
74+
import { makeCommon } from "./utils/makeCommon";
7375
import { LoggerConfig, printLine, replaceLastLine } from "./modules/logger";
7476

7577
const log = debug("hardhat:core:hardhat-network:provider");
@@ -160,6 +162,8 @@ export class EdrProviderWrapper
160162
private readonly _eventAdapter: EdrProviderEventAdapter,
161163
private readonly _vmTraceDecoder: VmTraceDecoder,
162164
private readonly _rawTraceCallbacks: RawTraceCallbacks,
165+
// The common configuration for EthereumJS VM is not used by EDR, but tests expect it as part of the provider.
166+
private readonly _common: Common,
163167
tracingConfig?: TracingConfig
164168
) {
165169
super();
@@ -287,11 +291,13 @@ export class EdrProviderWrapper
287291
}
288292
);
289293

294+
const common = makeCommon(getNodeConfig(config));
290295
const wrapper = new EdrProviderWrapper(
291296
provider,
292297
eventAdapter,
293298
vmTraceDecoder,
294299
rawTraceCallbacks,
300+
common,
295301
tracingConfig
296302
);
297303

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Common } from "@nomicfoundation/ethereumjs-common";
2+
3+
import { LocalNodeConfig } from "../node-types";
4+
5+
export function makeCommon({
6+
chainId,
7+
networkId,
8+
hardfork,
9+
enableTransientStorage,
10+
}: LocalNodeConfig) {
11+
const otherSettings = enableTransientStorage ? { eips: [1153] } : {};
12+
13+
const common = Common.custom(
14+
{
15+
chainId,
16+
networkId,
17+
},
18+
{
19+
hardfork,
20+
...otherSettings,
21+
}
22+
);
23+
24+
return common;
25+
}

0 commit comments

Comments
 (0)