NXP smart contract monorepo.
- Node.js >= 18
npm install
npm run build| Command | Description |
|---|---|
npm run build |
Build all |
npm run test |
Run tests |
npm run lint |
Lint |
npm run coverage |
Coverage |
npm run format |
Format code |
This project uses many compiler versions and per-file settings overrides, so Hardhat runs multiple compile jobs (currently 9) in parallel. However, the @openzeppelin/hardhat-upgrades plugin locks cache/validations.json with proper-lockfile using retries=0, so when the jobs finish almost simultaneously a lock race raises ELOCKED and breaks the compilation midway. If tests then run in this state, some contract artifacts are missing and hundreds of tests can fail (❌ N test(s) failed under coverage).
To prevent this race, scripts/config-exclude-contracts.ts intercepts the TASK_COMPILE_SOLIDITY_COMPILE_JOBS subtask and forces the default concurrency to 1. It is applied automatically to every Hardhat task (compile / test / coverage / run / console, etc.), so it behaves the same whether you use npm run or invoke npx hardhat directly.
# All equally safe (concurrency=1 applied automatically)
npm run build
npm run coverage
npx hardhat compile
npx hardhat coverage
npx hardhat run scripts/foo.tsThe tradeoff is that build time roughly doubles (1 min → 2 min).