cmd/*_oracle: use luxcppDir() everywhere — kill all hardcoded /Users/z paths

5 oracle tools were writing KATs to hardcoded /Users/z/work/luxcpp/...
paths. All now go through the luxcppDir() helper (LUXCPP_DIR env override,
$HOME/work/luxcpp default), consistent with the lux/CLAUDE.md convention.

Also .gitignore stray oracle binaries from `go build ./cmd/<oracle>`.
This commit is contained in:
Hanzo AI
2026-05-21 14:57:03 -07:00
parent 0378901ec6
commit cee6cdb707
5 changed files with 54 additions and 7 deletions
+10
View File
@@ -56,3 +56,13 @@ CLAUDE.md
GEMINI.md
GROK.md
QWEN.md
# Stray oracle dev-tool binaries (built ad-hoc)
/m4_*_oracle
/cross_runtime_oracle
/cross_runtime_verify
/dkg_oracle
/dkg2_oracle
/activation_oracle
/corona_oracle_v2
/shamir_general_oracle
+11 -2
View File
@@ -77,8 +77,8 @@ func main() {
// hardcoded locations in luxcpp/crypto. For the cross-runtime gate
// we hash the canonical paths.
signPath := filepath.Join(*out, "sign_kat.json")
resharePath := "/Users/z/work/luxcpp/crypto/corona/test/kat/reshare_kat.json"
dkg2Path := "/Users/z/work/luxcpp/crypto/corona/dkg2/test/kat/dkg2_kat.json"
resharePath := filepath.Join(luxcppDir(), "crypto/corona/test/kat/reshare_kat.json")
dkg2Path := filepath.Join(luxcppDir(), "crypto/corona/dkg2/test/kat/dkg2_kat.json")
files := []struct {
name string
@@ -120,3 +120,12 @@ func main() {
fmt.Printf("wrote %s (%d entries)\n", mPath, len(m.Files))
}
// luxcppDir returns the luxcpp source root. LUXCPP_DIR overrides the default
// of $HOME/work/luxcpp.
func luxcppDir() string {
if d := os.Getenv("LUXCPP_DIR"); d != "" {
return d
}
return os.ExpandEnv("$HOME/work/luxcpp")
}
+13 -3
View File
@@ -14,8 +14,9 @@
// Bsquare = 184960669042442604975662780477 (~98-bit, fits in __uint128_t).
//
// Output:
// <luxcpp/crypto>/corona/test/kat/l2_norm.json
// <luxcpp/crypto>/corona/test/kat/full_rank_check.json
// $LUXCPP_DIR/crypto/corona/test/kat/l2_norm.json
// $LUXCPP_DIR/crypto/corona/test/kat/full_rank_check.json
// (LUXCPP_DIR defaults to $HOME/work/luxcpp)
package main
@@ -318,7 +319,7 @@ func writeJSON(path string, v any) error {
}
func main() {
outDir := "/Users/z/work/luxcpp/crypto/corona/test/kat"
outDir := filepath.Join(luxcppDir(), "crypto/corona/test/kat")
if err := emitL2Norm(outDir); err != nil {
fmt.Fprintln(os.Stderr, "l2:", err)
os.Exit(1)
@@ -330,3 +331,12 @@ func main() {
}
fmt.Fprintln(os.Stderr, "wrote full_rank_check.json")
}
// luxcppDir returns the luxcpp source root. LUXCPP_DIR overrides the default
// of $HOME/work/luxcpp.
func luxcppDir() string {
if d := os.Getenv("LUXCPP_DIR"); d != "" {
return d
}
return os.ExpandEnv("$HOME/work/luxcpp")
}
+10 -1
View File
@@ -153,7 +153,7 @@ func main() {
})
}
outPath := filepath.Join("/Users/z/work/luxcpp/crypto/corona/test/kat", "ternary_sampler.json")
outPath := filepath.Join(luxcppDir(), "crypto/corona/test/kat", "ternary_sampler.json")
f, err := os.Create(outPath)
if err != nil {
fmt.Fprintln(os.Stderr, err)
@@ -168,3 +168,12 @@ func main() {
}
fmt.Fprintf(os.Stderr, "wrote ternary_sampler.json (%d entries)\n", len(out.Entries))
}
// luxcppDir returns the luxcpp source root. LUXCPP_DIR overrides the default
// of $HOME/work/luxcpp.
func luxcppDir() string {
if d := os.Getenv("LUXCPP_DIR"); d != "" {
return d
}
return os.ExpandEnv("$HOME/work/luxcpp")
}
+10 -1
View File
@@ -305,7 +305,7 @@ func main() {
}
outPath := filepath.Join(
"/Users/z/work/luxcpp/crypto/corona/test/kat",
luxcppDir(), "crypto/corona/test/kat",
"shamir_general_kat.json",
)
if err := os.MkdirAll(filepath.Dir(outPath), 0o755); err != nil {
@@ -326,3 +326,12 @@ func main() {
}
fmt.Fprintf(os.Stderr, "wrote shamir_general_kat.json (%d entries)\n", len(out.Entries))
}
// luxcppDir returns the luxcpp source root. LUXCPP_DIR overrides the default
// of $HOME/work/luxcpp.
func luxcppDir() string {
if d := os.Getenv("LUXCPP_DIR"); d != "" {
return d
}
return os.ExpandEnv("$HOME/work/luxcpp")
}