@@ -378,6 +378,43 @@ jobs:
378378 echo "found=false" >> $GITHUB_OUTPUT
379379 fi
380380
381+ # Guard against shipping stale or wrong-layout artifacts. The `circuit-artifacts`
382+ # branch is populated out-of-band (`pnpm build:circuits --committee all --preset
383+ # insecure-512` followed by `scripts/circuit-artifacts.ts push`). If it lags the
384+ # circuit source, its SOURCE_HASH won't match the source we're releasing and its
385+ # on-disk layout may predate the `{preset}/{committee}/{variant}` scheme that
386+ # consumers (e3-zk-prover) resolve against. Fail loudly here rather than publishing
387+ # a tarball that downstreams can't use — regenerate and re-push the branch.
388+ - name : Verify circuit artifacts match source
389+ if : steps.pull.outputs.found == 'true'
390+ run : |
391+ PULLED_HASH=$(cat dist/circuits/SOURCE_HASH 2>/dev/null || true)
392+ EXPECTED_HASH="${{ steps.pull.outputs.source_hash }}"
393+ if [[ -z "$PULLED_HASH" ]]; then
394+ echo "::error::circuit-artifacts branch is missing SOURCE_HASH; cannot verify it matches the released source."
395+ exit 1
396+ fi
397+ if [[ "$PULLED_HASH" != "$EXPECTED_HASH" ]]; then
398+ echo "::error::circuit-artifacts is stale (SOURCE_HASH=$PULLED_HASH, expected $EXPECTED_HASH)."
399+ echo "::error::Rebuild and re-push: pnpm build:circuits --committee all --preset insecure-512 && pnpm tsx scripts/circuit-artifacts.ts push"
400+ exit 1
401+ fi
402+ # Assert the per-committee layout that `--committee all` produces is present, so an
403+ # old flat (committee-less) build can never slip through even if the hash lined up.
404+ missing=0
405+ for committee in minimum micro small; do
406+ marker="dist/circuits/insecure-512/${committee}/default/dkg/pk/pk.json"
407+ if [[ ! -f "$marker" ]]; then
408+ echo "::error::Expected circuit artifact missing: ${marker#dist/circuits/}"
409+ missing=1
410+ fi
411+ done
412+ if [[ "$missing" != "0" ]]; then
413+ echo "::error::circuit-artifacts was not built with --committee all; regenerate as above."
414+ exit 1
415+ fi
416+ echo "✅ circuit-artifacts verified (SOURCE_HASH=$PULLED_HASH, per-committee layout present)"
417+
381418 - name : Create release archive
382419 if : steps.pull.outputs.found == 'true'
383420 run : |
0 commit comments