diff --git a/package-lock.json b/package-lock.json index deb0453..9a31661 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solarity/hardhat-zkit", - "version": "0.4.2", + "version": "0.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solarity/hardhat-zkit", - "version": "0.4.2", + "version": "0.4.3", "license": "MIT", "workspaces": [ "test/fixture-projects/*" diff --git a/package.json b/package.json index 6343276..36dc964 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/hardhat-zkit", - "version": "0.4.2", + "version": "0.4.3", "description": "The ultimate TypeScript environment for Circom development", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", diff --git a/src/cache/BaseCache.ts b/src/cache/BaseCache.ts new file mode 100644 index 0000000..28bd95a --- /dev/null +++ b/src/cache/BaseCache.ts @@ -0,0 +1,167 @@ +import fsExtra from "fs-extra"; + +import { Reporter } from "@src/reporter"; +import { BaseCacheSchema, BaseCacheType } from "@src/types/cache/base-cache"; + +/** + * Generic class that manages a cache of file-related entries. + * + * This class is designed to manage a collection of cache entries for files, where each entry + * holds metadata or other relevant data associated with a file. It offers functionality to add, retrieve, + * and remove entries from the cache, as well as utilities to write the cache state to a file and clean + * up stale entries for files that no longer exist on the filesystem. + * + * The cache operates on a single generic type: + * - `T`: Represents the individual cache entry for each file, storing metadata or other details. + * + * Usage: + * Extend this class and specify the appropriate cache entry type to implement specific caching logic. + */ +export class BaseCache { + private _cache!: BaseCacheType; + + constructor( + private _cacheVersion: string, + private _cacheSchema: BaseCacheSchema, + cachePath?: string, + ) { + if (cachePath) { + this.readFromFile(cachePath); + } else { + this._cache = { + _format: this._cacheVersion, + files: {}, + }; + } + } + + /** + * Clears the current cache data, resetting it to an empty state. + * + * This method initializes the cache with the version format and an empty file collection. + */ + public clearCache() { + this._cache = { + _format: this._cacheVersion, + files: {}, + }; + } + + /** + * Reads cache data from the specified file and populates the cache with the loaded data. + * + * This method attempts to read the cache file from the given `cachePath`. If the file exists, it parses + * the content and validates it against the defined cache schema. If the data is valid, the cache is updated. + * If the data is invalid, an error is logged using the Reporter. + * + * @param cachePath The full path to the cache file from which to read the data. + */ + public readFromFile(cachePath: string) { + let cacheRaw: BaseCacheType = { + _format: this._cacheVersion, + files: {}, + }; + + if (fsExtra.pathExistsSync(cachePath)) { + cacheRaw = fsExtra.readJsonSync(cachePath, { + reviver: (_key: string, value: any): any => { + if (value != null && typeof value === "object" && "__bigintval__" in value) { + return BigInt(value["__bigintval__"]); + } + + return value; + }, + }); + } + + // Validate the correctness of the data read from the file using the Zod schema + const result = this._cacheSchema.safeParse(cacheRaw); + + if (result.success) { + this._cache = result.data; + this.removeNonExistingFiles(); + + return; + } + + this._cache = { + _format: this._cacheVersion, + files: {}, + }; + + Reporter!.verboseLog("cache", "Errors during ZOD schema parsing: %o", [result.error]); + } + + /** + * Removes cache entries for files that no longer exist. + * + * This method helps keep the cache up-to-date by deleting references + * to non-existent files, ensuring that the cache remains valid. + */ + public removeNonExistingFiles() { + Object.keys(this._cache.files).map((absolutePath) => { + if (!fsExtra.pathExistsSync(absolutePath)) { + this.removeEntry(absolutePath); + } + }); + } + + /** + * Writes the current cache state to the specified file. + * + * @param cacheFilePath The full path to the cache file where the state will be written. + */ + public async writeToFile(cacheFilePath: string) { + const jsonContent = JSON.stringify( + this._cache, + (_key, value) => { + if (typeof value === "bigint") { + return { __bigintval__: value.toString() }; + } + + return value; + }, + 2, + ); + + await fsExtra.outputFile(cacheFilePath, jsonContent); + } + + /** + * Adds a file cache entry to the cache data using the specified absolute path + * + * @param absolutePath The absolute path to the circuit file + * @param entry The cache entry to be added for the specified file path + */ + public addFile(absolutePath: string, entry: T) { + this._cache.files[absolutePath] = entry; + } + + /** + * Returns all stored cache entries + * + * @returns An array of all stored cache entries + */ + public getEntries(): T[] { + return Object.values(this._cache.files); + } + + /** + * Returns the cache entry for the specified file path, or undefined if no entry exists + * + * @param file The absolute path to the circuit file + * @returns The stored cache entry or undefined if no entry is found + */ + public getEntry(file: string): T | undefined { + return this._cache.files[file]; + } + + /** + * Removes the cache entry for the specified file path from the cache + * + * @param file The absolute path to the circuit file + */ + public removeEntry(file: string) { + delete this._cache.files[file]; + } +} diff --git a/src/cache/CircuitsCompileCache.ts b/src/cache/CircuitsCompileCache.ts index 4d31adb..3aa572c 100644 --- a/src/cache/CircuitsCompileCache.ts +++ b/src/cache/CircuitsCompileCache.ts @@ -1,12 +1,11 @@ -import fsExtra from "fs-extra"; import { isEqual } from "lodash"; import { CompileCacheSchema } from "./schemas"; import { CIRCUIT_COMPILE_CACHE_VERSION } from "../constants"; -import { CompileCache, CompileCacheEntry } from "../types/cache"; +import { BaseCache } from "@src/cache/BaseCache"; +import { CompileCacheEntry } from "../types/cache"; import { CompileFlags } from "../types/core"; -import { Reporter } from "../reporter"; /** * Class that implements the caching logic for compiling circuits. @@ -22,135 +21,7 @@ import { Reporter } from "../reporter"; * The caching mechanism enhances performance and efficiency, especially when dealing * with large and complex circuit designs by minimizing redundant compilation efforts. */ -class BaseCircuitsCompileCache { - /** - * Creates an instance of {@link BaseCircuitsCompileCache} with empty cache data - * - * @returns An instance of {@link BaseCircuitsCompileCache} initialized with empty cache data - */ - public static createEmpty(): BaseCircuitsCompileCache { - return new BaseCircuitsCompileCache({ - _format: CIRCUIT_COMPILE_CACHE_VERSION, - files: {}, - }); - } - - /** - * Creates an instance of {@link BaseCircuitsCompileCache} using the data read from the specified cache file - * - * @param circuitsCompileCachePath The full path to the compile cache file from which to read the data - * @returns A promise that resolves to an instance of {@link BaseCircuitsCompileCache} populated with the read data - */ - public static async readFromFile(circuitsCompileCachePath: string): Promise { - let cacheRaw: CompileCache = { - _format: CIRCUIT_COMPILE_CACHE_VERSION, - files: {}, - }; - - if (await fsExtra.pathExists(circuitsCompileCachePath)) { - cacheRaw = await fsExtra.readJson(circuitsCompileCachePath, { - reviver: (_key: string, value: any): any => { - if (value != null && typeof value === "object" && "__bigintval__" in value) { - return BigInt(value["__bigintval__"]); - } - - return value; - }, - }); - } - - // Validate the correctness of the data read from the file using the Zod schema - const result = CompileCacheSchema.safeParse(cacheRaw); - - if (result.success) { - const circuitsCompileCache = new BaseCircuitsCompileCache(result.data); - await circuitsCompileCache.removeNonExistingFiles(); - - return circuitsCompileCache; - } else { - Reporter!.verboseLog("circuits-compile-cache", "Errors during ZOD schema parsing: %o", [result.error]); - } - - return new BaseCircuitsCompileCache({ - _format: CIRCUIT_COMPILE_CACHE_VERSION, - files: {}, - }); - } - - constructor(private _compileCache: CompileCache) {} - - /** - * Removes cache entries for files that no longer exist. - * - * This method helps keep the cache up-to-date by deleting references - * to non-existent files, ensuring that the cache remains valid. - */ - public async removeNonExistingFiles() { - await Promise.all( - Object.keys(this._compileCache.files).map(async (absolutePath) => { - if (!(await fsExtra.pathExists(absolutePath))) { - this.removeEntry(absolutePath); - } - }), - ); - } - - /** - * Writes the current cache state to the specified file - * - * @param circuitsCompileCachePath The full path to the compile cache file where the cache will be saved - */ - public async writeToFile(circuitsCompileCachePath: string) { - fsExtra.outputFileSync( - circuitsCompileCachePath, - JSON.stringify(this._compileCache, (_key, value) => { - if (typeof value === "bigint") { - return { __bigintval__: value.toString() }; - } - - return value; - }), - ); - } - - /** - * Adds a file cache entry to the cache data using the specified absolute path - * - * @param absolutePath The absolute path to the circuit file - * @param entry The cache entry to be added for the specified file path - */ - public addFile(absolutePath: string, entry: CompileCacheEntry) { - this._compileCache.files[absolutePath] = entry; - } - - /** - * Returns all stored cache entries - * - * @returns An array of all stored cache entries - */ - public getEntries(): CompileCacheEntry[] { - return Object.values(this._compileCache.files); - } - - /** - * Returns the cache entry for the specified file path, or undefined if no entry exists - * - * @param file The absolute path to the circuit file - * @returns The stored cache entry or undefined if no entry is found - */ - public getEntry(file: string): CompileCacheEntry | undefined { - return this._compileCache.files[file]; - } - - /** - * Removes the cache entry for the specified file path from the cache - * - * @param file The absolute path to the circuit file - */ - public removeEntry(file: string) { - delete this._compileCache.files[file]; - } - +class BaseCircuitsCompileCache extends BaseCache { /** * Checks if the specified file has changed since the last check based on its content hash and compile flags. * @@ -205,11 +76,11 @@ export async function createCircuitsCompileCache(circuitsCompileCachePath?: stri return; } - if (circuitsCompileCachePath) { - CircuitsCompileCache = await BaseCircuitsCompileCache.readFromFile(circuitsCompileCachePath); - } else { - CircuitsCompileCache = BaseCircuitsCompileCache.createEmpty(); - } + CircuitsCompileCache = new BaseCircuitsCompileCache( + CIRCUIT_COMPILE_CACHE_VERSION, + CompileCacheSchema, + circuitsCompileCachePath, + ); } /** diff --git a/src/cache/CircuitsSetupCache.ts b/src/cache/CircuitsSetupCache.ts index c529ebe..345d762 100644 --- a/src/cache/CircuitsSetupCache.ts +++ b/src/cache/CircuitsSetupCache.ts @@ -1,124 +1,26 @@ -import fsExtra from "fs-extra"; import { isEqual } from "lodash"; import { SetupCacheSchema } from "./schemas"; import { CIRCUIT_SETUP_CACHE_VERSION } from "../constants"; -import { SetupCache, SetupCacheEntry } from "../types/cache"; +import { BaseCache } from "@src/cache/BaseCache"; +import { SetupCacheEntry } from "../types/cache"; import { ContributionSettings } from "../types/core"; -class BaseCircuitsSetupCache { - /** - * Creates an empty instance of the {@link BaseCircuitsSetupCache} class - * - * @returns A new instance of the {@link BaseCircuitsSetupCache} with empty cache data - */ - public static createEmpty(): BaseCircuitsSetupCache { - return new BaseCircuitsSetupCache({ - _format: CIRCUIT_SETUP_CACHE_VERSION, - files: {}, - }); - } - - /** - * Creates an instance of {@link BaseCircuitsSetupCache} using the data read from the specified cache file - * - * @param circuitsSetupCachePath The full path to the setup cache file from which to read the data - * @returns A promise that resolves to an instance of {@link BaseCircuitsSetupCache} populated with the read data - */ - public static async readFromFile(circuitsSetupCachePath: string): Promise { - let cacheRaw: SetupCache = { - _format: CIRCUIT_SETUP_CACHE_VERSION, - files: {}, - }; - - if (await fsExtra.pathExists(circuitsSetupCachePath)) { - cacheRaw = await fsExtra.readJson(circuitsSetupCachePath); - } - - // Validate the correctness of the data read from the file using the Zod schema - const result = SetupCacheSchema.safeParse(cacheRaw); - - if (result.success) { - const circuitsSetupCache = new BaseCircuitsSetupCache(result.data); - await circuitsSetupCache.removeNonExistingFiles(); - - return circuitsSetupCache; - } - - return new BaseCircuitsSetupCache({ - _format: CIRCUIT_SETUP_CACHE_VERSION, - files: {}, - }); - } - - constructor(private _setupCache: SetupCache) {} - - /** - * Removes cache entries for files that no longer exist. - * - * This method helps keep the cache up-to-date by deleting references - * to non-existent files, ensuring that the cache remains valid. - */ - public async removeNonExistingFiles() { - await Promise.all( - Object.keys(this._setupCache.files).map(async (absolutePath) => { - if (!(await fsExtra.pathExists(absolutePath))) { - this.removeEntry(absolutePath); - } - }), - ); - } - - /** - * Writes the current cache state to a specified file - * - * @param circuitsCompileCachePath The full path to the cache file where the state will be written - */ - public async writeToFile(circuitsCompileCachePath: string) { - await fsExtra.outputJson(circuitsCompileCachePath, this._setupCache, { - spaces: 2, - }); - } - - /** - * Adds a file cache entry to the cache data using the specified absolute path - * - * @param absolutePath The absolute path to the circuit file - * @param entry The cache entry to be added for the specified file path - */ - public addFile(absolutePath: string, entry: SetupCacheEntry) { - this._setupCache.files[absolutePath] = entry; - } - - /** - * Returns all stored cache entries - * - * @returns An array of all stored cache entries - */ - public getEntries(): SetupCacheEntry[] { - return Object.values(this._setupCache.files); - } - - /** - * Returns the cache entry for the specified file path, or undefined if no entry exists - * - * @param file The absolute path to the circuit file - * @returns The stored cache entry or undefined if no entry is found - */ - public getEntry(file: string): SetupCacheEntry | undefined { - return this._setupCache.files[file]; - } - - /** - * Removes the cache entry for the specified file path from the cache - * - * @param file The absolute path to the circuit file - */ - public removeEntry(file: string) { - delete this._setupCache.files[file]; - } - +/** + * Class that implements the caching logic for setting up circuits. + * + * This class is responsible for managing the cache of circuit setup information, ensuring + * efficient reuse of previously stored setup data. By storing the setup details, the class + * helps prevent unnecessary reconfiguration of circuits that have not changed since the last setup. + * + * The class provides methods to clear, disable, and retrieve cached setup data, which can + * significantly reduce the overhead of repeated setups for large and complex circuit configurations. + * + * The caching mechanism enhances performance and resource management during the setup process, + * especially when dealing with multiple iterations of circuit configurations or contributions. + */ +class BaseCircuitsSetupCache extends BaseCache { /** * Checks if the specified file has changed since the last check. * @@ -176,11 +78,11 @@ export async function createCircuitsSetupCache(circuitsSetupCachePath?: string) return; } - if (circuitsSetupCachePath) { - CircuitsSetupCache = await BaseCircuitsSetupCache.readFromFile(circuitsSetupCachePath); - } else { - CircuitsSetupCache = BaseCircuitsSetupCache.createEmpty(); - } + CircuitsSetupCache = new BaseCircuitsSetupCache( + CIRCUIT_SETUP_CACHE_VERSION, + SetupCacheSchema, + circuitsSetupCachePath, + ); } /** diff --git a/src/constants.ts b/src/constants.ts index 6e3a0a2..919c557 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -27,12 +27,10 @@ export const COMPILER_AMD_REPOSITORY_URL = "https://github.com/iden3/circom/rele export const COMPILER_ARM_REPOSITORY_URL = "https://github.com/distributed-lab/circom/releases/download"; export const COMPILER_WASM_REPOSITORY_URL = "https://github.com/distributed-lab/circom-wasm/releases/download"; -export const LATEST_CIRCOM_COMPILER_URL = "https://github.com/iden3/circom/releases/latest/"; +export const LATEST_SUPPORTED_CIRCOM_VERSION = "2.1.9"; +export const OLDEST_SUPPORTED_ARM_CIRCOM_VERSION = "2.1.8"; export const WASM_COMPILER_VERSIONING: { [key: string]: string } = { "2.1.8": "0.2.18-rc.3", "2.1.9": "0.2.19-rc.0", }; - -export const LATEST_SUPPORTED_CIRCOM_VERSION = "2.1.9"; -export const OLDEST_SUPPORTED_ARM_CIRCOM_VERSION = "2.1.8"; diff --git a/src/core/compiler/CircomCompilerDownloader.ts b/src/core/compiler/CircomCompilerDownloader.ts index 9869136..bf818b8 100644 --- a/src/core/compiler/CircomCompilerDownloader.ts +++ b/src/core/compiler/CircomCompilerDownloader.ts @@ -1,7 +1,6 @@ import os from "os"; import path from "path"; import fsExtra from "fs-extra"; -import https from "https"; import semver from "semver"; import { promisify } from "util"; import { execFile } from "child_process"; @@ -10,7 +9,7 @@ import { COMPILER_AMD_REPOSITORY_URL, COMPILER_ARM_REPOSITORY_URL, COMPILER_WASM_REPOSITORY_URL, - LATEST_CIRCOM_COMPILER_URL, + LATEST_SUPPORTED_CIRCOM_VERSION, WASM_COMPILER_VERSIONING, } from "../../constants"; import { Reporter } from "../../reporter"; @@ -187,7 +186,7 @@ export class CircomCompilerDownloader { */ public async downloadCompiler(version: string, isVersionStrict: boolean, verifyCompiler: boolean): Promise { await this._mutex.use(async () => { - const versionToDownload = isVersionStrict ? version : await this._getLatestCircomVersion(); + const versionToDownload = isVersionStrict ? version : LATEST_SUPPORTED_CIRCOM_VERSION; if (await this.isCompilerDownloaded(versionToDownload, isVersionStrict)) { return; @@ -236,27 +235,6 @@ export class CircomCompilerDownloader { } } - private async _getLatestCircomVersion(): Promise { - return new Promise((resolve) => { - https - .get(LATEST_CIRCOM_COMPILER_URL, (res) => { - if (res.statusCode === 302 && res.headers.location) { - const location = res.headers.location; - const parts = location.split("/"); - const versionTag = parts[parts.length - 1]; - const version = versionTag.startsWith("v") ? versionTag.substring(1) : versionTag; - - resolve(version); - } else { - throw new HardhatZKitError("Unable to resolve the latest available circom version"); - } - }) - .on("error", (error) => { - throw new HardhatZKitError(`Unable to resolve the latest available circom version: ${error}`); - }); - }); - } - private async _downloadCompiler(version: string): Promise { const downloadPath = this._getCompilerDownloadPath(version); diff --git a/src/types/cache/base-cache.ts b/src/types/cache/base-cache.ts new file mode 100644 index 0000000..bcdf4dc --- /dev/null +++ b/src/types/cache/base-cache.ts @@ -0,0 +1,11 @@ +import { z } from "zod"; + +export type BaseCacheType = { + _format: string; + files: Record; +}; + +export type BaseCacheSchema = z.ZodObject<{ + _format: z.ZodString; + files: z.ZodRecord; +}>; diff --git a/src/types/cache/circuits-compile-cache.ts b/src/types/cache/circuits-compile-cache.ts index 6c1b6bc..2f76622 100644 --- a/src/types/cache/circuits-compile-cache.ts +++ b/src/types/cache/circuits-compile-cache.ts @@ -7,8 +7,3 @@ export type CompileCacheEntry = { compileFlags: CompileFlags; fileData: ResolvedFileData; }; - -export type CompileCache = { - _format: string; - files: Record; -}; diff --git a/src/types/cache/circuits-setup-cache.ts b/src/types/cache/circuits-setup-cache.ts index 2e16824..7ac8e19 100644 --- a/src/types/cache/circuits-setup-cache.ts +++ b/src/types/cache/circuits-setup-cache.ts @@ -6,8 +6,3 @@ export type SetupCacheEntry = { r1csSourcePath: string; contributionSettings: ContributionSettings; }; - -export type SetupCache = { - _format: string; - files: Record; -}; diff --git a/test/integration/tasks.test.ts b/test/integration/tasks.test.ts index 4a98142..ea7b185 100644 --- a/test/integration/tasks.test.ts +++ b/test/integration/tasks.test.ts @@ -168,6 +168,7 @@ describe("ZKit tasks", async function () { ]); const compilerPath = path.join(os.homedir(), ".zkit", "compilers", this.hre.config.zkit.compilerVersion); + expect(fsExtra.readdirSync(compilerPath)).to.be.deep.equal([ CircomCompilerDownloader.getCompilerPlatformBinary(), ]); diff --git a/test/unit/cache/circuits-compile-cache.test.ts b/test/unit/cache/circuits-compile-cache.test.ts index 72b1066..c299241 100644 --- a/test/unit/cache/circuits-compile-cache.test.ts +++ b/test/unit/cache/circuits-compile-cache.test.ts @@ -22,7 +22,7 @@ describe("CircuitsCompileCache", () => { await createCircuitsCompileCache(undefined); expect(CircuitsCompileCache!.constructor.name).to.be.eq("BaseCircuitsCompileCache"); - expect(Object.values(CircuitsCompileCache!)[0]._format).to.be.eq(CIRCUIT_COMPILE_CACHE_VERSION); + expect(Object.values(CircuitsCompileCache!)[2]._format).to.be.eq(CIRCUIT_COMPILE_CACHE_VERSION); }); }); diff --git a/test/unit/cache/circuits-setup-cache.test.ts b/test/unit/cache/circuits-setup-cache.test.ts index bfba70a..e05bf1a 100644 --- a/test/unit/cache/circuits-setup-cache.test.ts +++ b/test/unit/cache/circuits-setup-cache.test.ts @@ -23,7 +23,7 @@ describe("CircuitsSetupCache", () => { await createCircuitsSetupCache(undefined); expect(CircuitsSetupCache!.constructor.name).to.be.eq("BaseCircuitsSetupCache"); - expect(Object.values(CircuitsSetupCache!)[0]._format).to.be.eq(CIRCUIT_SETUP_CACHE_VERSION); + expect(Object.values(CircuitsSetupCache!)[2]._format).to.be.eq(CIRCUIT_SETUP_CACHE_VERSION); }); }); diff --git a/test/unit/core/compile/core/circom-compiler-downloader.test.ts b/test/unit/core/compile/circom-compiler-downloader.test.ts similarity index 100% rename from test/unit/core/compile/core/circom-compiler-downloader.test.ts rename to test/unit/core/compile/circom-compiler-downloader.test.ts diff --git a/test/unit/core/compile/core/circom-compiler-factory.test.ts b/test/unit/core/compile/circom-compiler-factory.test.ts similarity index 99% rename from test/unit/core/compile/core/circom-compiler-factory.test.ts rename to test/unit/core/compile/circom-compiler-factory.test.ts index a130376..c0cc518 100644 --- a/test/unit/core/compile/core/circom-compiler-factory.test.ts +++ b/test/unit/core/compile/circom-compiler-factory.test.ts @@ -19,7 +19,7 @@ import { import { CircomCompilerDownloader } from "@src/core/compiler/CircomCompilerDownloader"; -import { defaultCompileFlags } from "../../../../constants"; +import { defaultCompileFlags } from "../../../constants"; import { LATEST_SUPPORTED_CIRCOM_VERSION } from "@src/constants"; describe("CircomCompilerFactory", () => { diff --git a/test/unit/core/compile/core/circom-compiler.test.ts b/test/unit/core/compile/circom-compiler.test.ts similarity index 100% rename from test/unit/core/compile/core/circom-compiler.test.ts rename to test/unit/core/compile/circom-compiler.test.ts diff --git a/test/unit/core/compile/core/compilation-files-resolver.test.ts b/test/unit/core/compile/compilation-files-resolver.test.ts similarity index 98% rename from test/unit/core/compile/core/compilation-files-resolver.test.ts rename to test/unit/core/compile/compilation-files-resolver.test.ts index ea18424..a9be9b5 100644 --- a/test/unit/core/compile/core/compilation-files-resolver.test.ts +++ b/test/unit/core/compile/compilation-files-resolver.test.ts @@ -6,7 +6,7 @@ import { TASK_COMPILE_SOLIDITY_READ_FILE as TASK_READ_FILE } from "hardhat/built import { HardhatRuntimeEnvironment } from "hardhat/types"; import { getAllFilesMatching } from "hardhat/internal/util/fs-utils"; -import { CompilationFilesResolverMock } from "./CompilationFilesResolverMock"; +import { CompilationFilesResolverMock } from "./mock/CompilationFilesResolverMock"; import { useEnvironment } from "@test-helpers"; import { CircuitsCompileCache } from "@src/cache"; import { TASK_CIRCUITS_COMPILE, ZKIT_SCOPE_NAME } from "@src/task-names"; diff --git a/test/unit/core/compile/core/CompilationFilesResolverMock.ts b/test/unit/core/compile/mock/CompilationFilesResolverMock.ts similarity index 100% rename from test/unit/core/compile/core/CompilationFilesResolverMock.ts rename to test/unit/core/compile/mock/CompilationFilesResolverMock.ts diff --git a/test/unit/core/compile/dependencies/parser.test.ts b/test/unit/core/dependencies/parser.test.ts similarity index 100% rename from test/unit/core/compile/dependencies/parser.test.ts rename to test/unit/core/dependencies/parser.test.ts diff --git a/test/unit/core/compile/utils/ptau-downloader.test.ts b/test/unit/core/utils/ptau-downloader.test.ts similarity index 100% rename from test/unit/core/compile/utils/ptau-downloader.test.ts rename to test/unit/core/utils/ptau-downloader.test.ts diff --git a/test/unit/core/compile/utils/versioning.test.ts b/test/unit/core/utils/versioning.test.ts similarity index 100% rename from test/unit/core/compile/utils/versioning.test.ts rename to test/unit/core/utils/versioning.test.ts