hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
53 lines • 2.56 kB
TypeScript
import type { SuiteResult } from "@nomicfoundation/edr";
export declare const FUNCTION_GAS_SNAPSHOTS_FILE = ".gas-snapshot";
export interface FunctionGasSnapshot {
contractNameOrFqn: string;
functionSig: string;
gasUsage: StandardTestKindGasUsage | FuzzTestKindGasUsage;
}
export interface FunctionGasSnapshotWithMetadata extends FunctionGasSnapshot {
metadata: {
source: string;
};
}
export interface StandardTestKindGasUsage {
kind: "standard";
gas: bigint;
}
export interface FuzzTestKindGasUsage {
kind: "fuzz";
runs: bigint;
meanGas: bigint;
medianGas: bigint;
}
export interface FunctionGasSnapshotComparison {
added: FunctionGasSnapshot[];
removed: FunctionGasSnapshot[];
changed: FunctionGasSnapshotChange[];
}
export interface FunctionGasSnapshotChange {
source: string;
contractNameOrFqn: string;
functionSig: string;
kind: "standard" | "fuzz";
expected: number;
actual: number;
runs?: number;
}
export interface FunctionGasSnapshotCheckResult {
passed: boolean;
comparison: FunctionGasSnapshotComparison;
written: boolean;
}
export declare function getFunctionGasSnapshotsPath(basePath: string): string;
export declare function extractFunctionGasSnapshots(suiteResults: SuiteResult[]): FunctionGasSnapshotWithMetadata[];
export declare function writeFunctionGasSnapshots(basePath: string, snapshots: FunctionGasSnapshot[]): Promise<void>;
export declare function readFunctionGasSnapshots(basePath: string): Promise<FunctionGasSnapshot[]>;
export declare function stringifyFunctionGasSnapshots(snapshots: FunctionGasSnapshot[]): string;
export declare function parseFunctionGasSnapshots(stringifiedSnapshots: string): FunctionGasSnapshot[];
export declare function compareFunctionGasSnapshots(previousSnapshots: FunctionGasSnapshot[], currentSnapshots: FunctionGasSnapshotWithMetadata[]): FunctionGasSnapshotComparison;
export declare function hasGasUsageChanged(previous: StandardTestKindGasUsage | FuzzTestKindGasUsage, current: StandardTestKindGasUsage | FuzzTestKindGasUsage): boolean;
export declare function checkFunctionGasSnapshots(basePath: string, suiteResults: SuiteResult[]): Promise<FunctionGasSnapshotCheckResult>;
export declare function logFunctionGasSnapshotsSection(result: FunctionGasSnapshotCheckResult, logger?: typeof console.log): void;
export declare function printFunctionGasSnapshotChanges(changes: FunctionGasSnapshotChange[], logger?: typeof console.log): void;
//# sourceMappingURL=function-gas-snapshots.d.ts.map