Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
chore: importing and typo
Browse files Browse the repository at this point in the history
  • Loading branch information
benceharomi committed Oct 9, 2023
1 parent b4c7cd9 commit adfd15e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"deploy-preimages": "ts-node scripts/deploy-preimages.ts",
"compile-yul": "ts-node scripts/compile-yul.ts",
"build-yul": "yarn preprocess-yul && yarn compile-yul",
"calculate-hashes" : "ts-node scripts/calculate-hashes.ts"
"calculate-hashes": "ts-node scripts/calculate-hashes.ts"
}
}
10 changes: 5 additions & 5 deletions scripts/calculate-hashes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "ethers";
import fs from "fs";
import { readFileSync, writeFileSync } from "fs";
import { hashBytecode } from "zksync-web3/build/src/utils";

type Hashes = {
Expand All @@ -22,15 +22,15 @@ const OUTPUT_FILE_PATH = "./SystemContractsHashes.json";

const readFileAsHexString = (path: string, errorMessage: string): string => {
try {
return "0x" + fs.readFileSync(path, "hex");
return "0x" + readFileSync(path, "hex");
} catch {
throw new Error(errorMessage);
}
};

const loadBytecodeFromJson = (path: string, errorMessage: string): string => {
try {
const jsonFile = fs.readFileSync(path, "utf8");
const jsonFile = readFileSync(path, "utf8");
return JSON.parse(jsonFile).bytecode;
} catch {
throw new Error(errorMessage);
Expand Down Expand Up @@ -91,7 +91,7 @@ const main = async () => {
2
);

const oldSystemContractsHashes = fs.readFileSync(OUTPUT_FILE_PATH, "utf8");
const oldSystemContractsHashes = readFileSync(OUTPUT_FILE_PATH, "utf8");

if (oldSystemContractsHashes === newSystemContractsHashes) {
console.log(
Expand All @@ -108,7 +108,7 @@ const main = async () => {
"Calculated hashes differ from the hashes in the SystemContractsHashes.json file. Updating..."
);

fs.writeFileSync(OUTPUT_FILE_PATH, newSystemContractsHashes);
writeFileSync(OUTPUT_FILE_PATH, newSystemContractsHashes);
console.log("Update finished. New hashes:");
console.log(newSystemContractsHashes);
}
Expand Down

0 comments on commit adfd15e

Please sign in to comment.