Skip to content

Commit

Permalink
chore: pass build info as buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
agostbiro committed Jan 29, 2025
1 parent 2151bce commit a44f2ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import type {
Response,
SubscriptionEvent,
HttpHeader,
TracingConfigWithBuffers,

Check failure on line 15 in packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts

View workflow job for this annotation

GitHub Actions / Lint

Module '"@nomicfoundation/edr"' has no exported member 'TracingConfigWithBuffers'.
} from "@nomicfoundation/edr";
import { Common } from "@nomicfoundation/ethereumjs-common";
import picocolors from "picocolors";
import debug from "debug";
import { EventEmitter } from "events";
import fsExtra from "fs-extra";
import semver from "semver";

import { requireNapiRsModule } from "../../../common/napi-rs";
import {
Expand All @@ -33,7 +33,6 @@ import {
import { isErrorResponse } from "../../core/providers/http";
import { getHardforkName } from "../../util/hardforks";
import { ConsoleLogger } from "../stack-traces/consoleLogger";
import { FIRST_SOLC_VERSION_SUPPORTED } from "../stack-traces/constants";
import { encodeSolidityStackTrace } from "../stack-traces/solidity-errors";
import { SolidityStackTrace } from "../stack-traces/solidity-stack-trace";

Expand Down Expand Up @@ -165,7 +164,7 @@ export class EdrProviderWrapper
public static async create(
config: HardhatNetworkProviderConfig,
loggerConfig: LoggerConfig,
tracingConfig?: TracingConfig
tracingConfig?: TracingConfigWithBuffers
): Promise<EdrProviderWrapper> {
const { Provider } = requireNapiRsModule(
"@nomicfoundation/edr"
Expand Down Expand Up @@ -506,19 +505,14 @@ export async function createHardhatNetworkProvider(

async function makeTracingConfig(
artifacts: Artifacts | undefined
): Promise<TracingConfig | undefined> {
): Promise<TracingConfigWithBuffers | undefined> {
if (artifacts !== undefined) {
const buildInfos = [];

const buildInfoFiles = await artifacts.getBuildInfoPaths();

try {
for (const buildInfoFile of buildInfoFiles) {
const buildInfo = await fsExtra.readJson(buildInfoFile);
if (semver.gte(buildInfo.solcVersion, FIRST_SOLC_VERSION_SUPPORTED)) {
buildInfos.push(buildInfo);
}
}
const buildInfos = await Promise.all(
buildInfoFiles.map((filePath) => fsExtra.readFile(filePath))
);

return {
buildInfos,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.28";
export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";

0 comments on commit a44f2ab

Please sign in to comment.