From a604944ab812fb2ca7f000553c86beac8447240e Mon Sep 17 00:00:00 2001 From: Jack <87960263+ylmin@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:43:05 +0800 Subject: [PATCH] chore: normalise file path (#18) refactor: normalize file path Co-authored-by: Bence Haromi <56651250+benceharomi@users.noreply.github.com> --- scripts/process.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/process.ts b/scripts/process.ts index 261b3005..f7339f99 100644 --- a/scripts/process.ts +++ b/scripts/process.ts @@ -2,6 +2,7 @@ import * as hre from "hardhat"; import { ethers } from "ethers"; import { existsSync, mkdirSync, writeFileSync } from "fs"; +import { join } from "path"; import { renderFile } from "template-file"; import { utils } from "zksync-web3"; import { SYSTEM_CONTRACTS, getRevertSelector, getTransactionUtils } from "./constants"; @@ -14,6 +15,10 @@ const SYSTEM_PARAMS = require("../SystemConfig.json"); const OUTPUT_DIR = "bootloader/build"; +function path(...args: string[]): string { + return join(__dirname, ...args); +} + function getSelector(contractName: string, method: string): string { const artifact = hre.artifacts.readArtifactSync(contractName); const contractInterface = new ethers.utils.Interface(artifact.abi); @@ -239,11 +244,11 @@ async function main() { mkdirSync(OUTPUT_DIR); } - writeFileSync(`${OUTPUT_DIR}/bootloader_test.yul`, provedBootloaderWithTests); - writeFileSync(`${OUTPUT_DIR}/proved_batch.yul`, provedBatchBootloader); - writeFileSync(`${OUTPUT_DIR}/playground_batch.yul`, playgroundBatchBootloader); - writeFileSync(`${OUTPUT_DIR}/gas_test.yul`, gasTestBootloader); - writeFileSync(`${OUTPUT_DIR}/fee_estimate.yul`, feeEstimationBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/bootloader_test.yul`), provedBootloaderWithTests); + writeFileSync(path(`../${OUTPUT_DIR}/proved_batch.yul`), provedBatchBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/playground_batch.yul`), playgroundBatchBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/gas_test.yul`), gasTestBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/fee_estimate.yul`), feeEstimationBootloader); console.log("Preprocessing done!"); }