Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: pre-commit hook to warn of constant.nr change (#11507)
Edit: A git hook might not be the best approach to this, so maybe there's a better CI solution that can be built? I just lost 6 hours of my life hunting a bug, because a few days ago I'd changed a single number in constants.nr. I'd forgotten to update the downstream constants files, or perhaps I'd wrongly assumed that bootstrap.sh or CI or something would update the associated constants `.ts` and `.sol` etc. files. Anyway, I have channelled my furious anger into trying to prevent someone else wasting countless hours over something so easily avoidable and automatable. Out of interest, why isn't this automatically caught already? ## About the PR: - It identifies whether the `constants.nr` file has been changed _and_ staged. (No point doing anything if it's not been staged). - It just warns the dev about this, to make them aware that they might need to run some scripts. - ~It runs the remake-constants script.~ - *It does not re-stage the resulting, re-generated constant files*, because I noticed (by chance I had a `build:dev` watch window open) that there are other typescript files that need to be generated, which aren't covered by the `remake-constants` script. Ideally, if someone knows where the scripts are to regenerate all of those lingering constants files as well, we would run those scripts too within this script. But of course, the auto-generated files themselves don't necessarily tell you how to generate them (sigh). E.g. /mnt/user-data/mike/aztec-packages/yarn-project/noir-protocol-circuits-types/src/types/index.ts --------- Co-authored-by: ludamad <[email protected]>
- Loading branch information