Run preflight and upgrade regression inside Hardhat and GitHub Actions.

Hardhat and CI

Hardhat plugin

// hardhat.config.js
require("hardhat-shadowfork");   // packages/hardhat-shadowfork in this repository
module.exports = {
  solidity: { version: "0.8.24", settings: { evmVersion: "shanghai" } },
  shadowfork: { rpc: "http://127.0.0.1:8545" },
};
npx shadowfork rpc &
npx hardhat shadowfork:preflight
npx hardhat shadowfork:regress --contract QUSDCv2 --address 0x3f43da82ec9a4f5285f10faf1f26eca7319e5da5 --limit 20

shadowfork:preflight compiles, then checks every contract against QIE's opcode rules and dry-runs each deployment without constructor arguments. shadowfork:regress builds the named contract and replays the deployed address's history against it. Both throw on failure, so the command exits non-zero. The repository's own contracts/ project uses both.

GitHub Action

- uses: mikemoulder/shadowfork@main   # this repository, published
  with:
    artifacts: artifacts/contracts/Vault.sol/Vault.json
    scan: "0xYourDeployedContract"
    fail-on: high
    regress-address: "0xYourDeployedContract"
    regress-artifact: artifacts/contracts/Vault.sol/Vault.json