59 Commits
Author SHA1 Message Date
zeekayandHanzo Dev 96922d6af8 Build on Go 1.27
Build, vet and tests are clean on the 1.27.1 toolchain.

Co-authored-by: Hanzo Dev <[email protected]>
v1.5.3
2026-09-17 11:54:13 -07:00
zeekayandHanzo Dev 1e3e11b1e2 Typecheck on the native compiler, keep 6 for the tools
typescript 7.0.2 is the native compiler and exports no JavaScript API. next 16.0.1
does not recognize it as installed and runs an unsolicited `pnpm add -D typescript`
mid-build, so a bare 7 pin is out: 7.0.2 comes in aliased as tsgo and does the
typechecking while typescript stays on the 6 line, which next reads cleanly. docs/
reports the same 4 diagnostics under both compilers, once the two side-effect CSS
imports get the ambient declarations TS7 now demands. The lockfile is new; the
package already declared pnpm, and npm cannot resolve fumadocs-mdx against next 16.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 22:43:41 -07:00
zeekay 1a6e3486e4 every Hanzo dependency is the version npm serves
Ranges drift once nothing moves them: a caret that has not been rewritten
since it was written pins whatever was current that day, and an exact pin
cannot even take a patch. Both are updated here.

One line per package, so a surface reads the same components, the same
tokens and the same face as every other one.
2026-09-01 16:00:59 -07:00
zeekayandHanzo Dev 75a440b701 the corporate name is Lux Industries Inc
Lux Partners Limited is not the entity behind this work. Every place the
old name stood — copyright lines, site footers, brand config, legal and
compliance text — now names the company that actually holds it.

lux.fund is the exception and is not renamed to match: that site belongs
to Lux Assets Management LLC, a different company, and it says so.

Two kinds of line were left for a person rather than rewritten. A dated
news item recording that Lux Partners Limited was established in the Isle
of Man is a historical fact, and renaming it would falsify the record. And
a sentence asserting that the company is domiciled in the Isle of Man is a
claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle
of Man company, so swapping the name there would assert something untrue.

Co-authored-by: Hanzo Dev <[email protected]>
v1.5.2
2026-08-28 13:03:17 -07:00
zeekay d51dff984c fix(docs): load Zen through the css entry, which carries types 2026-08-23 15:04:16 -07:00
zeekay 1232d40842 feat(docs): serve Zen from @hanzo/font 2026-08-23 14:56:38 -07:00
zeekay 7c7f671c2f add native CI; refresh go.sum against the declared requirements
go.mod asked for ids v1.3.2 and crypto v1.20.2 while go.sum still carried
v1.2.9 and v1.19.0, so the module did not build. Retidied the root and the
nested bit/ and safe/ modules; bit/ was additionally missing the luxfi/geth
requirement that its compress test imports.

The CI test command covers all four modules — go test ./... stops at a nested
module boundary and would otherwise skip bit/, big/ and safe/ entirely.
2026-08-21 00:11:23 -07:00
zeekay 2f3ad8034d carry the github copy onto the forge
github.com held commits this host lacked, which refuses the mirror push
("fetch first") and stops github receiving anything at all. Merging rather
than overwriting, so the mirror is a fast-forward again and neither side's
work is dropped.
2026-08-20 21:55:47 -07:00
zeekay fb847f88e4 run on the native fleet
Adds .hanzo/workflows/cicd.yml calling the canonical pipeline and drops the
GitHub-hosted workflows it replaces. Lands here because this is where the repo
is written — git.hanzo.ai is upstream and github.com is its push mirror, so the
same change made on github.com never reaches the runner fleet.
2026-08-20 20:12:58 -07:00
zeekay f6b011c10f track the name agents read, so a clone documents itself
LLM.md is the source and stays the source; CLAUDE.md is a symlink to it, so there is
one file and it cannot drift from itself. What changes is that the link is committed
rather than left for each checkout to recreate.

Left untracked, the doc was conditional on a step outside the repo: a fresh clone had
no CLAUDE.md, nothing loaded LLM.md, and an agent worked here having never read what
this repo already explains. Most of the estate already tracks theirs; this is the rest
agreeing with them.
2026-08-20 16:37:53 -07:00
zeekay c50f6086c6 chore: sync working tree
Commits 2 outstanding change(s) that were sitting uncommitted.
No build artifacts and no secrets in the changeset (both checked).
2026-07-26 10:14:04 -07:00
zeekay d155b8b953 chore(deps): bump geth v1.20.1 + luxfi deps — stack unification v1.5.1 2026-07-15 11:12:34 -07:00
zeekay 0348dbec62 docs(brand): add hero banner v1.5.0 2026-06-28 20:55:57 -07:00
zeekay adfa1ecc8b chore(brand): dynamic hero banner 2026-06-28 20:55:56 -07:00
zeekay d7e4bee290 go: 1.26.3 → 1.26.4 (security: crypto/x509, mime, net/textproto) 2026-06-06 22:06:12 -07:00
zeekay 150dcc2735 deps: bump luxfi/vm v1.2.0, sampler v1.1.0, staking v1.5.0 (relicense)
Picks up the 2026-06-06 relicensing:
- luxfi/vm v1.2.0 → Lux Ecosystem License v1.2 (was Lux Research v1.0).
  License-only retag of the extracted runtime; patent reservation
  preserved for runtime optimization surfaces, royalty-free for
  Descending Chains.
- luxfi/sampler v1.1.0 → BSD-3-Clause (was Lux Research v1.0).
  License restored to match the luxfi/node provenance (originally
  extracted from node/utils/sampler).
- luxfi/staking v1.5.0 → BSD-3-Clause (was Lux Research v1.0).
  License restored to match the luxfi/node provenance.

No code changes in this commit — go.mod/go.sum only.
2026-06-06 19:01:30 -07:00
zeekay 9445ee3b2b fix: gofmt -s across repo (CI format check) 2026-06-02 11:38:55 -07:00
zeekay e1738e43ba chore(deps): go get -u ./...
Updated dependencies to latest minor versions via go get -u + go mod tidy.
2026-06-02 11:12:35 -07:00
zeekayandGitHub 095291b991 docs: add LICENSING.md pointer to canonical IP/licensing strategy (#1) 2026-05-15 17:35:55 -07:00
zeekay 1cd36c1e0b deps: luxfi/crypto v1.19.0 2026-05-13 11:59:42 -07:00
zeekay 947d783122 go.mod: bump go directive to 1.26.3 (security advisory) 2026-05-12 20:55:00 -07:00
zeekay 8212121173 ntt: rename canonical/ to subring/ - clearer naming for ring quotient 2026-05-05 10:17:55 -07:00
zeekay 33d95498d6 merge LP-107 Phase 3: NTT canonical body migration 2026-05-04 10:28:04 -07:00
zeekay b2cf5ce5b4 LP-107 Phase 3: NTT canonical body migration to luxfi/math/ntt
Migrates the canonical Lattigo-derived Montgomery NTT body from
luxfi/lattice/v7/ring into luxfi/math/ntt/canonical. This is the
ownership inversion LP-107 Phase 3 calls for: the math substrate
now OWNS the canonical body, and luxfi/lattice/ring becomes a thin
shim over it.

ntt/canonical/ — new public package with the canonical body:
* subring.go         — SubRing struct + constructors (269 LoC)
* ntt.go             — NTT/INTT body, loop-unrolled-by-16 (1320 LoC)
* ntt_simd.go        — SIMD AVX2 dispatcher (405 LoC, build-tagged)
* ntt_simd_stub.go   — purego dispatcher stub for non-SIMD builds
* modular_reduction.go — Barrett + Montgomery scalars
* factorization.go   — prime factorization helpers
* utils.go           — primitive root finders, parameter helpers
* vec_ops.go         — vectorized polynomial helpers
* weierstrass.go     — companion algebraic helpers

ntt/purego.go — REWORK: the pureGoBackend now holds *canonical.SubRing
instead of *lattice/v7/ring.SubRing; the lattice/v7/ring import is
GONE. Cycle-free: GOWORK=off go list -deps github.com/luxfi/math/ntt
shows zero github.com/luxfi/lattice imports.

Total: ~3.7K LoC of canonical body migrated. Public API unchanged
for downstream callers — luxfi/lattice/ring re-exports the same
SubRing.NTT/INTT surface from the new owner location.

Tests: GOWORK=off go test ./... in luxfi/math/.claude/worktrees/lp-107-phase3
  ok  github.com/luxfi/math/ntt              (cached)
  ok  github.com/luxfi/math/ntt/canonical    0.276s
  + every other package green.
2026-05-04 10:26:46 -07:00
zeekay e01fd2e209 LP-107 Phase 6.3-6.5: KAT extension — modarith / ntt / sample
Replicates the codec cross-runtime KAT pattern across the rest of the
math substrate. Each package now ships:

* kat.go — KATEntry/KATBundle aliases pointing at codec.KATEntry/
  codec.KATBundle (one schema for the whole substrate).
* cmd/emit_*_kat/main.go — Go-side emitter that produces the
  canonical bundle.
* kat_test.go — Go replay test (TestKATBundle_RoundTrip*).
* testdata/*_kat.json — emitted bundle, byte-stable across runs.

modarith/cmd/emit_modarith_kat: ~300 entries
  - 100 MontMulMod cross-checked against MulMod
  - 100 AddMod across deterministic random pairs
  - 100 MontgomeryRoundTrip (ToMontgomery -> FromMontgomery)
  - Multiple moduli (PulsarQ, NTT998).

ntt/cmd/emit_ntt_kat: ~50 entries
  - input: 256 random uint64 mod PulsarQ
  - output: NTT(input) byte-stream + SHA-256 commitment
  - Pulsar N=256 ring.

sample/cmd/emit_sample_kat: ~30 entries
  - Uniform / Ternary / CenteredBinomial across param sweeps
  - Each entry records the seed + first 64 sampled values.

Tests: GOWORK=off go test ./modarith/ ./ntt/ ./sample/ -> all PASS.

C++ replay tests follow in luxcpp/crypto commit on this same branch.
2026-05-04 10:20:32 -07:00
zeekay 946b9f6fd2 LP-107 Phase 7: cross-runtime KAT release gate
codec/kat.go: KATEntry + KATBundle types with canonical JSON
serialization. Header field embeds params.KATHeader so every entry
carries (parameter_set, modulus_id, backend_id, hash_suite_id,
implementation, version) — required by LP-107 §"Parameter registry"
for cross-runtime equality.

codec/cmd/emit_codec_kat/main.go: emits 5 canonical entries:
  1. ReadUint64Slice/happy-path/3-elements
  2. ReadUint64Slice/empty
  3. ReadUint64Slice/reject/lattice-issue-4-70T  (regression: huge
     length must be rejected by both runtimes)
  4. ReadUint16Slice/happy-path/5-elements
  5. ReadUint32Slice/happy-path/4-elements

Each entry records:
  - InputHex: the wire-format bytes the Reader consumes
  - OutputHex: the canonical output byte stream (or "REJECTED")
  - OutputSHA256: commitment for fast cross-runtime equality

codec/kat_test.go: TestKATBundle_RoundTrip replays every bundle
entry through the Go Reader and asserts byte-equality + SHA-256
commitment match. PASS in 0.29s.

codec/testdata/codec_kat.json: the Go-emitted bundle. The C++ side
at luxcpp/crypto/math/test/codec_cross_runtime_test.cpp loads the
same file and replays every entry; in this commit, all 5 entries
PASS byte-equal between runtimes.

This closes LP-107 Phase 7 for codec/. Subsequent commits extend the
gate to modarith/, ntt/, poly/, sample/ KATs.
2026-05-04 09:43:59 -07:00
zeekay c9bc60da0e LP-107 Phase 2: math substrate — params, backend, codec, modarith,
ntt, poly, rns, sample

Eight pure-Go reference packages that own the canonical semantics of
every cryptographic-math primitive Lux protocols share. Backends
(AVX2 / NEON / cgo+C++ / CUDA / Metal / WGSL) plug in behind the
substrate; KATs gate byte-equality across them.

Packages added:

* params/    — ModulusID, NTTParamID, FHEParamID, PulsarParamID,
               HashSuiteID, BackendID; KATHeader required-fields
               schema. Stable string IDs; renaming is a breaking
               change.

* backend/   — Policy enum (PureGo / NativeCPU / GPUPreferred /
               GPURequired); Resolve(policy, registered) returns the
               BackendID per LP-107's fallback chain. GPURequired
               returns ErrUnavailable when no GPU backend is
               registered.

* codec/     — Bounded readers (closes lattice issues #2 + #4 DoS
               class permanently). Limits + LimitError + Reader.
               ReadUint{16,32,64}Slice all reject the 70T-element
               attack input before allocating; depth + frame-bytes
               caps; iterative (no recursion). Regression test
               TestReadUint64Slice_RejectsHugeLength encodes the
               original lattice issue #4 input.

* modarith/  — Modulus type with QInv, R2, Barrett constants
               (computed via math/big once per modulus). AddMod /
               SubMod / MulMod (Div64 reference path). MontMulMod /
               ToMontgomery / FromMontgomery cross-checked against
               MulMod across 100 random Pulsar-Q pairs.
               ReductionMode enum byte-equal to lattice/types.

* ntt/       — Service + Backend interface; pure-Go backend
               delegates to lattice/v7/ring.SubRing.NTT/INTT (the
               canonical Lattigo-derived Montgomery NTT body — no
               re-implementation, just dispatch). Round-trip +
               batch + determinism tests on Pulsar N=256.

* poly/      — Add / Sub / ScalarMul / PointwiseMul (NTT-domain) /
               negacyclic Mul (NTT round-trip). Composes modarith +
               ntt; no lower-level reach.

* rns/       — Basis(Moduli, Name) for FHE RNS chains. Single +
               two-prime construction validated; rejects even moduli.
               Phase 3 will add basis-extension and modulus-switching.

* sample/    — Uniform (rejection sampling, mask-and-retry); Ternary
               (density + sign byte); CenteredBinomial (popcount
               difference); DiscreteGaussianRejection (6-sigma cutoff).
               All take an io.Reader so callers can KAT-replay.

Architecture invariants enforced in package docs:

  - Go is the canonical semantic reference.
  - Backend selection MUST NOT alter transcript bytes (consensus
    paths default to PolicyPureGo / PolicyNativeCPU).
  - No unbounded codec readers anywhere near wire formats.
  - No re-implementation: where lattice/v7/ring already owns the
    canonical body, we delegate, not fork.
  - One ID space; renaming is a breaking change.

Test posture: 8/8 packages green via `GOWORK=off go test ./...`.

Phases 3-7 (queued):
  3. lattice consumes math
  4. pulsar consumes lattice + math
  5. fhe consumes math
  6. luxcpp/crypto/math native backend mirror
  7. cross-runtime KAT release gate

See SUBSTRATE.md for the full posture and migration plan; full LP at
~/work/lux/lps/LP-107-lux-math-substrate.md.
2026-05-04 09:28:23 -07:00
zeekay 90dc46f057 deps: update go.mod/go.sum 2026-04-19 17:04:50 -07:00
zeekay a7f09a8de8 chore: update dependencies 2026-04-01 14:03:38 -07:00
zeekay d99b646920 chore: sync local changes 2026-03-26 22:47:13 -07:00
zeekay d5fafe12e3 chore: bump Go 1.26.0 → 1.26.1
Fixes 5 stdlib CVEs (html/template, os, net/url, crypto/x509 x2).
2026-03-12 01:09:17 -07:00
zeekay 11962a0791 chore: update Go module dependencies 2026-03-03 22:39:12 -08:00
zeekay 1b7d7ca94d chore: add BSD-3-Clause LICENSE 2026-02-14 05:26:21 -08:00
zeekay 573df46084 chore: sync dependencies and format code v1.2.4 2026-02-04 15:43:42 -08:00
zeekay 8165bc28b2 chore: remove local replace directives v1.2.3 2026-01-08 23:44:14 -08:00
zeekay 19a069cf4a refactor: remove local replace, use published big v0.1.0 v1.2.2 v1.2.1 safe/v0.0.1 2026-01-05 01:38:02 -08:00
zeekay 588df268c4 chore: update go.mod/sum big/v0.1.0 2026-01-04 19:29:50 -08:00
zeekay c1c86cad08 safe: add DEX math functions for DRY consolidation
Added functions from node/vms/dexvm/math:
- Div64: safe division with error on zero
- MulBig: multiply uint64s returning big.Int
- MulDiv64: (a * b) / c without overflow
- MulDivRoundUp64: ceiling division variant
- BigMulDiv: big.Int multiplication+division
- BigMulDivRoundUp: big.Int ceiling variant
- Clamp: generic ordered type clamping

Also added common big.Int values (bigZero, bigOne, maxUint64Big)
for performance in division operations.
2026-01-03 18:53:26 -08:00
zeekay 0060c0251e Reorganize math package into subpackages
- Create math/big for big.Int utilities (HexOrDecimal256, U256, parsing)
- Create math/safe for overflow-safe arithmetic (SafeAdd, SafeMul, etc.)
- Move averager files to root package level
- Add re-exports in root package for backwards compatibility
- Update README with new package structure documentation
- Remove old math/meter directory (consolidated elsewhere)
- Remove redundant math/ subdirectory structure
2026-01-03 18:22:33 -08:00
zeekay b9c21dcd22 Remove units/ - use luxfi/const for denominations 2026-01-03 17:39:26 -08:00
zeekay 8dba20ab63 Add big.Int and integer utilities from geth/common/math
- big.go: BigPow, ParseBig256, U256, U256Bytes, PaddedBigBytes, etc.
- integer.go: HexOrDecimal64, ParseUint64, SafeAdd/Sub/Mul

Consolidating math utilities into luxfi/math to eliminate
geth/common/math dependency.
2026-01-03 17:36:34 -08:00
zeekay ef2368da52 Add bit and units subpackages, remove safemath wrapper
- Add math/bit: XOR, AND, compress operations (from bitutil)
- Add math/units: Lux denomination constants (NanoLux, MicroLux, etc.)
- Remove safemath/: was just re-exporting geth/common/math
- Use github.com/luxfi/geth/common/math directly for safe math ops
2026-01-03 15:52:15 -08:00
zeekay 4044cf7eaf chore: update go.mod 2025-12-31 22:21:37 -08:00
zeekay 7aa527e883 feat: add heap, linked, sorting, zero - remove utils dependency
- Add Zero[T any]() generic function for zero values
- Add IsSortedBytes for byte slice sorting checks
- Add heap/queue.go with priority Queue[T] implementation
- Add heap/map.go with indexed Map[K,V] for heap operations
- Add linked/list.go with doubly-linked List[T]
- Add linked/hashmap.go with ordered HashMap[K,V]
- Update sampleable_set.go to use local luxmath.Zero[T]()
- Update averager_heap.go to use github.com/luxfi/math/heap
- Update safe_math.go to use luxmath.Zero[T]()
- Remove github.com/luxfi/utils dependency entirely
v1.2.0
2025-12-24 15:06:41 -08:00
zeekay f68e2e7ec9 refactor: remove node dependency, use extracted packages
- Replace github.com/luxfi/node/utils with github.com/luxfi/utils
- Replace github.com/luxfi/node/utils/sampler with github.com/luxfi/sampler
- Replace github.com/luxfi/node/utils/wrappers with github.com/luxfi/utils/wrappers
- Replace github.com/luxfi/node/utils/json with github.com/luxfi/utils/json
v1.0.5
2025-12-24 14:12:00 -08:00
zeekay 9f1a663519 deps: upgrade crypto to v1.17.25 v1.1.1 2025-12-21 11:11:46 -08:00
zeekay e6468fe6da Add generic safe math operations
Provides overflow/underflow protected Add, Sub, Mul operations
with generic constraints for all unsigned integer types.
v1.1.0
2025-12-19 08:45:58 -08:00
zeekay 412f691d17 Update dependencies to latest versions v1.0.2 2025-12-13 10:42:20 +00:00
zeekay aea7bc31f9 Remove local replace, update to latest luxfi versions
- Remove local replace directive for luxfi/utils
- Use published github.com/luxfi/utils v1.0.0
- Update github.com/luxfi/geth: v1.16.34 -> v1.16.43
- Update github.com/luxfi/ids: v1.0.2 -> v1.1.4
- Update github.com/luxfi/crypto: v1.2.9 -> v1.17.15
- Update Go version to 1.25.5
- All tests pass
v1.0.1
2025-12-11 05:44:25 +00:00
zeekay 078a174346 Release v1.0.0 v1.0.0 2025-12-04 08:38:47 -08:00