From 4718753a398f77f40bc60e48e1b8f4a76995418f Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Mon, 28 Oct 2024 21:22:48 +0000 Subject: [PATCH] Resolve the EDR cache path config --- .../network-manager/hook-handlers/config.ts | 10 ++++++++++ .../network-manager/type-extensions/config.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts index a66a1cd704..7c9f5a64c9 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts @@ -17,8 +17,11 @@ import type { } from "../../../../types/config.js"; import type { ConfigHooks } from "../../../../types/hooks.js"; +import path from "node:path"; + import { HardhatError } from "@ignored/hardhat-vnext-errors"; import { normalizeHexString } from "@ignored/hardhat-vnext-utils/hex"; +import { resolveFromRoot } from "@ignored/hardhat-vnext-utils/path"; import { validateUserConfig } from "../type-validation.js"; @@ -228,6 +231,13 @@ export async function resolveUserConfig( gasPrice: resolveGasConfig(networkConfig.gasPrice), // TODO: This isn't how it's called in v2 forkConfig: networkConfig.forkConfig, + forkCachePath: + networkConfig.forkCachePath !== undefined + ? resolveFromRoot( + resolvedConfig.paths.root, + networkConfig.forkCachePath, + ) + : path.join(resolvedConfig.paths.cache, "edr-cache"), hardfork: networkConfig.hardfork ?? "cancun", networkId: networkConfig.networkId ?? networkConfig.chainId ?? 31337, blockGasLimit: networkConfig.blockGasLimit ?? 12_500_000, diff --git a/v-next/hardhat/src/internal/builtin-plugins/network-manager/type-extensions/config.ts b/v-next/hardhat/src/internal/builtin-plugins/network-manager/type-extensions/config.ts index 310eb510ee..e232a792a5 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/network-manager/type-extensions/config.ts @@ -196,7 +196,7 @@ declare module "../../../../types/config.js" { initialDate?: Date; coinbase?: string; forkConfig?: ForkConfig; - forkCachePath?: string; + forkCachePath: string; } export type EdrNetworkAccountsConfig =