mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 01:38:32 +00:00
## Summary This PR improve the generating state workflow. It will also check for outdated state-diff.json and add a practical script to easily generate a new one. The way we generate state has also been changed to make it work with macOS M1 system. We don't run the tool in the container anymore but instead directly on the machine. ## What changes * A check-generated-state.js script was added to quickly look for outdated test * The check was added in the CI * A generate-contracts.ts script was added to easily generate the new state with the new instructions to run on MacOS --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
17 lines
721 B
TypeScript
17 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."
|
|
);
|
|
}
|