mirror of
https://github.com/luxfi/pulsar.git
synced 2026-09-24 00:25:52 +00:00
Single repo, one canonical impl + spec + proofs + KAT + cut tool.
Per "ONE and ONLY ONE way to do things" the prior dual-repo split
(luxfi/pulsar = production library, luxfi/pulsar-mptc = NIST MPTC
submission framework) is collapsed into a single canonical home at
github.com/luxfi/pulsar. SINGLE-IMPL-PLAN.md (now marked COMPLETED)
describes the steps; this commit lands the final step.
Files moved (89 new):
16 submission docs (SUBMISSION, NIST-SUBMISSION, SPEC, SUITE,
PATENTS, AXIOM-INVENTORY, PROOF-CLAIMS, FIPS-TRACEABILITY,
TRUSTED-COMPUTING-BASE, HANZO-CRYPTO-SUITE, INFORMATION-
ARCHITECTURE, ROADMAP, CHANGELOG, SYNC-STATUS, STATUS-
SUBMISSION-READINESS, SINGLE-IMPL-PLAN)
10 docs/ supplements (ietf-draft-skeleton, magnetar, evaluation,
patent-claims, x-wing-sig, design-decisions, family-architecture,
threat-model, nist-mptc-category, patent-notes-draft)
19 proofs/ (13 EC theories + 2 EC lemmas + 4 metadata/READMEs +
lean-easycrypt-bridge.md)
14 jasmin/ (lib/* + ml-dsa-65 fetch + threshold/{combine,round1,
round2}.jazz + READMEs)
10 ct/dudect/ (Makefile, combine_ct.go, dudect_combine.c,
dudect_compat.h, dudect_verify.c, fetch.sh, README, run-
submission.sh, verify_ct.go) + ct/jasmin-ct-libjade.md
1 .github/workflows/ci.yml
1 test/interoperability/n1_class_test.go (19/19 N1 subtests)
1 bench/results/REPORT.md
11 scripts/ (cut-submission, check-high-assurance, check-lean-
bridge, nightly, extract-jasmin-ec, checks/{ec-admits, ec-
compile, ec-refinement-scaffold, ec-regressions, extraction,
jasmin}, checks/test/{go-unit, interop, kat, no-secret-logs})
Files merged (16 overlapping, mptc-canonical chosen because newer +
post-rewire-correct; pulsar versions still bore stale "Pulsar-M" /
"pulsarm" branding):
README.md, BLOCKERS.md, CONTRIBUTING.md, LICENSE, LICENSING.md,
SECURITY.md, .gitignore, bench/run_all.sh, vectors/dkg.json (v1.0.7
regen), scripts/{bench,build,gen_vectors,sbom,test}.sh,
spec/{pulsar,parameters,system-model}.tex,
CRYPTOGRAPHER-SIGN-OFF.md (path refs).
Pulsar-only spec supplements preserved:
spec/{blockers,design-decisions,family-architecture,nist-mptc-
category,patent-notes,threat-model}.tex.
Path rewrites applied: 158 occurrences across 26 files
github.com/luxfi/pulsar-mptc -> github.com/luxfi/pulsar
~/work/lux/pulsar-mptc/ -> ~/work/lux/pulsar/
luxfi/pulsar-mptc -> luxfi/pulsar
pulsar-mptc/ -> ./
Narrative collapses (no more two-repo framing):
SUBMISSION.md "At a glance" — single Repository row
SYNC-STATUS.md — rewritten to single-repo state
SINGLE-IMPL-PLAN.md — marked COMPLETED 2026-05-18
HANZO-CRYPTO-SUITE.md — tier 1 row = single canonical home
scripts/cut-submission.sh — replace/vendor dance removed; cuts
directly from in-tree canonical sources
go.mod: dropped mptc's replace directive (no longer needed since this
IS the canonical pulsar repo). Module path is github.com/luxfi/pulsar.
Deps: cloudflare/circl v1.6.3, golang.org/x/crypto v0.32.0.
Verification:
GOWORK=off go build ./... PASS
GOWORK=off go test -count=1 ./... PASS (1.4s)
GOWORK=off go test -race ./ref/... PASS (14.7s)
go test ./test/interoperability/ PASS (19/19 N1 subtests)
scripts/check-high-assurance.sh PASS
scripts/check-lean-bridge.sh PASS (5/5 bridges)
scripts/gen_vectors.sh byte-identical replay
scripts/cut-submission.sh --help PASS
170 lines
6.3 KiB
Bash
Executable File
170 lines
6.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Lean ↔ EasyCrypt Shamir bridge guard.
|
|
#
|
|
# Each of the four EC axioms named in proofs/lean-easycrypt-bridge.md
|
|
# must:
|
|
# 1. Still exist in the EC source as an `axiom` (not `lemma`).
|
|
# 2. Carry an inline citation comment naming the Lean theorem.
|
|
# 3. The Lean theorem named in the citation must EXIST in the
|
|
# named Lean file (hardened guard — post-audit).
|
|
#
|
|
# Plus:
|
|
# 4. The bridge doc must exist.
|
|
# 5. Every EC file path mentioned in the bridge doc text must
|
|
# exist on disk (catches stale refs to decomplected files).
|
|
#
|
|
# If any of these checks fails, this script exits 2 and the
|
|
# high-assurance gate fails. The Lean repo is expected to live at
|
|
# ~/work/lux/proofs (one of several supported standard locations);
|
|
# the script auto-detects it.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$REPO_ROOT"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Lean repo location — autodetect a few standard layouts. Skip the
|
|
# Lean-side existence check if no Lean repo is found (so checkouts
|
|
# without the sibling Lean repo still pass).
|
|
# ---------------------------------------------------------------------------
|
|
LEAN_ROOT=""
|
|
for candidate in \
|
|
"$HOME/work/lux/proofs/lean" \
|
|
"$HOME/work/lux/proofs" \
|
|
"$REPO_ROOT/../proofs/lean" \
|
|
"$REPO_ROOT/../../proofs/lean" \
|
|
; do
|
|
if [[ -d "$candidate/Crypto" ]]; then
|
|
LEAN_ROOT="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
have_lean=0
|
|
if [[ -n "$LEAN_ROOT" ]]; then
|
|
have_lean=1
|
|
fi
|
|
|
|
FAIL=0
|
|
|
|
# (axiom-name, ec-file, lean-citation-substring, lean-theorem-name, lean-file-rel-to-Crypto)
|
|
declare -a BRIDGE=(
|
|
"lagrange_inverse_eval|proofs/easycrypt/Pulsar_N1.ec|shamir_correct_at_target|shamir_correct_at_target|Pulsar/Shamir.lean"
|
|
"add_share_zeroR|proofs/easycrypt/Pulsar_N4.ec|AddCommMonoid||"
|
|
"reconstruct_linear|proofs/easycrypt/Pulsar_N4.ec|combine_distributes_over_sum|combine_distributes_over_sum|Threshold_Lagrange.lean"
|
|
"shamir_correct|proofs/easycrypt/Pulsar_N4.ec|shamir_correct_at_target|shamir_correct_at_target|Pulsar/Shamir.lean"
|
|
"threshold_partial_response_identity|proofs/easycrypt/Pulsar_N1.ec|threshold_partial_response_identity|threshold_partial_response_identity|Threshold_Lagrange.lean"
|
|
)
|
|
|
|
echo "==> Lean ↔ EC Shamir bridge guard"
|
|
if [[ $have_lean -eq 1 ]]; then
|
|
echo " [info] Lean repo: $LEAN_ROOT"
|
|
else
|
|
echo " [info] no Lean repo on disk; skipping Lean-side existence checks"
|
|
fi
|
|
|
|
for entry in "${BRIDGE[@]}"; do
|
|
IFS='|' read -r axiom file lean_ref lean_thm lean_rel <<< "$entry"
|
|
|
|
# 1. EC file present.
|
|
if [[ ! -f "$file" ]]; then
|
|
echo " [FAIL] $axiom: $file not found"
|
|
FAIL=1
|
|
continue
|
|
fi
|
|
|
|
# 2. EC axiom still exists as an `axiom` (not silently demoted
|
|
# to `lemma` — promoting axiom→lemma is good but requires the
|
|
# bridge-doc / guard entry to be retired, which this catches).
|
|
line=$(grep -nE "^axiom[[:space:]]+${axiom}[[:space:]]*" "$file" | head -1 | cut -d: -f1)
|
|
if [[ -z "$line" ]]; then
|
|
echo " [FAIL] $axiom: declaration not found in $file (renamed without bridge update?)"
|
|
FAIL=1
|
|
continue
|
|
fi
|
|
|
|
# 3. Citation comment in the 20 lines preceding the axiom.
|
|
start=$((line > 20 ? line - 20 : 1))
|
|
if ! sed -n "${start},${line}p" "$file" | grep -q "$lean_ref"; then
|
|
echo " [FAIL] $axiom @ $file:$line — bridge comment missing reference to '$lean_ref'"
|
|
echo " (see proofs/lean-easycrypt-bridge.md for the required correspondence)"
|
|
FAIL=1
|
|
continue
|
|
fi
|
|
|
|
# 4. Lean theorem actually exists at the named path. Only
|
|
# checked when a Lean repo is on disk AND the bridge entry
|
|
# names a concrete (theorem, file) pair.
|
|
if [[ $have_lean -eq 1 && -n "$lean_thm" && -n "$lean_rel" ]]; then
|
|
lean_file="$LEAN_ROOT/Crypto/$lean_rel"
|
|
if [[ ! -f "$lean_file" ]]; then
|
|
echo " [FAIL] $axiom: cited Lean file $lean_file not found"
|
|
FAIL=1
|
|
continue
|
|
fi
|
|
if ! grep -qE "^(theorem|lemma)[[:space:]]+${lean_thm}[[:space:]]*\\b" "$lean_file"; then
|
|
echo " [FAIL] $axiom: cited Lean theorem $lean_thm not found in $lean_file"
|
|
echo " (Lean side renamed or removed without EC-side update?)"
|
|
FAIL=1
|
|
continue
|
|
fi
|
|
fi
|
|
|
|
echo " [ok] $axiom @ $file:$line → $lean_ref"
|
|
done
|
|
|
|
# Bridge doc presence.
|
|
BRIDGE_DOC="proofs/lean-easycrypt-bridge.md"
|
|
if [[ ! -f "$BRIDGE_DOC" ]]; then
|
|
echo " [FAIL] $BRIDGE_DOC is missing"
|
|
FAIL=1
|
|
else
|
|
# 5. Every EC file path mentioned in the bridge doc must exist
|
|
# on disk. Catches stale refs (e.g., to a file that was
|
|
# decomplected and renamed).
|
|
#
|
|
# Pattern: `proofs/easycrypt/<name>.ec` (backtick-quoted) is
|
|
# the canonical bridge-doc cross-reference shape. We grep
|
|
# those out and check each.
|
|
missing_refs=()
|
|
while IFS= read -r ref; do
|
|
# Strip backticks if present.
|
|
clean=$(echo "$ref" | tr -d '`')
|
|
if [[ ! -f "$clean" ]]; then
|
|
missing_refs+=("$clean")
|
|
fi
|
|
done < <(grep -oE 'proofs/easycrypt/[A-Za-z0-9_/]+\.(ec|md)' "$BRIDGE_DOC" | sort -u)
|
|
|
|
# Also check ~/work/lux/proofs/lean/Crypto/ refs when a Lean
|
|
# repo is on disk.
|
|
if [[ $have_lean -eq 1 ]]; then
|
|
while IFS= read -r ref; do
|
|
clean=$(echo "$ref" | tr -d '`')
|
|
# Strip a leading ~/work/lux/proofs/ if present.
|
|
rel="${clean#*lean/Crypto/}"
|
|
full="$LEAN_ROOT/Crypto/$rel"
|
|
if [[ ! -f "$full" ]]; then
|
|
missing_refs+=("$clean")
|
|
fi
|
|
done < <(grep -oE 'lean/Crypto/[A-Za-z0-9_/]+\.lean' "$BRIDGE_DOC" | sort -u)
|
|
fi
|
|
|
|
if [[ ${#missing_refs[@]} -gt 0 ]]; then
|
|
echo " [FAIL] bridge doc references files that don't exist on disk:"
|
|
printf " %s\n" "${missing_refs[@]}"
|
|
FAIL=1
|
|
else
|
|
echo " [ok] $BRIDGE_DOC present + every file path in it exists"
|
|
fi
|
|
fi
|
|
|
|
if [[ $FAIL -ne 0 ]]; then
|
|
echo
|
|
echo " Lean ↔ EC bridge guard FAILED — fix the citation comments"
|
|
echo " or update proofs/lean-easycrypt-bridge.md if the axiom"
|
|
echo " correspondence / file layout changed."
|
|
exit 2
|
|
fi
|
|
echo " [ok] all ${#BRIDGE[@]} axiom citations present + Lean-side names verified"
|
|
exit 0
|