Skip to content

Commit cec7090

Browse files
committed
feat: send genesis state to EDR
1 parent 2f7b638 commit cec7090

File tree

1 file changed

+13
-6
lines changed
  • packages/hardhat-core/src/internal/hardhat-network/provider

1 file changed

+13
-6
lines changed

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

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
SubscriptionEvent,
1414
HttpHeader,
1515
} from "@nomicfoundation/edr";
16+
import { l1GenesisState, l1HardforkFromString } from "@nomicfoundation/edr";
1617
import { Common } from "@nomicfoundation/ethereumjs-common";
1718
import picocolors from "picocolors";
1819
import debug from "debug";
@@ -218,6 +219,11 @@ export class EdrProviderWrapper
218219

219220
const hardforkName = getHardforkName(config.hardfork);
220221

222+
const genesisState =
223+
fork !== undefined
224+
? []
225+
: l1GenesisState(l1HardforkFromString(config.hardfork));
226+
221227
const context = await getGlobalEdrContext();
222228
const provider = await context.createProvider(
223229
GENERIC_CHAIN_TYPE,
@@ -249,13 +255,8 @@ export class EdrProviderWrapper
249255
coinbase: Buffer.from(coinbase.slice(2), "hex"),
250256
enableRip7212: config.enableRip7212,
251257
fork,
258+
genesisState,
252259
hardfork: ethereumsjsHardforkToEdrSpecId(hardforkName),
253-
genesisAccounts: config.genesisAccounts.map((account) => {
254-
return {
255-
secretKey: account.privateKey,
256-
balance: BigInt(account.balance),
257-
};
258-
}),
259260
initialDate,
260261
initialBaseFeePerGas:
261262
config.initialBaseFeePerGas !== undefined
@@ -270,6 +271,12 @@ export class EdrProviderWrapper
270271
},
271272
},
272273
networkId: BigInt(config.networkId),
274+
ownedAccounts: config.genesisAccounts.map((account) => {
275+
return {
276+
secretKey: account.privateKey,
277+
balance: BigInt(account.balance),
278+
};
279+
}),
273280
},
274281
{
275282
enable: loggerConfig.enabled,

0 commit comments

Comments
 (0)