mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
18 lines
721 B
TypeScript
18 lines
721 B
TypeScript
|
|
import { readFileSync } from "node:fs";
|
||
|
|
import { generateContractsChecksum } from "./contracts-checksum.ts";
|
||
|
|
|
||
|
|
// Read the previously stored checksum
|
||
|
|
const originalHash = readFileSync("../contracts/deployments/state-diff.checksum", "utf-8").trim();
|
||
|
|
|
||
|
|
// Root directory for the contracts; all files under this tree are included in the checksum
|
||
|
|
const contractsPath = "../contracts/src";
|
||
|
|
|
||
|
|
// Recompute checksum over all files under contractsPath (including nested directories)
|
||
|
|
const currentHash = generateContractsChecksum(contractsPath);
|
||
|
|
|
||
|
|
if (currentHash !== originalHash) {
|
||
|
|
throw new Error(
|
||
|
|
"State generated file is outdated. From the repository root, run `cd test && bun generate:contracts` to regenerate it."
|
||
|
|
);
|
||
|
|
}
|