Commit Graph
153 Commits
Author SHA1 Message Date
zeekay 7c525d8a73 chore(deps): bump geth v1.20.1 + luxfi deps — stack unification 2026-07-26 02:47:39 -07:00
hanzo-dev 4dbdcac726 ci: run linux jobs on lux-build-amd64 ARC scale set (no GitHub-hosted builders) 2026-07-11 00:18:29 -07:00
zeekayandHanzo Dev 62bf2166ba fix(deps): repair vanished pins / go.sum drift ( age@latest gosum-refresh) + build green
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
v1.11.0 v1.10.0
2026-06-30 13:56:20 -07:00
zeekay f042702c77 Merge branch 'audit/fchain-tfhe-threshold' 2026-06-30 13:56:02 -07:00
z 869ab50470 docs(brand): add hero banner 2026-06-28 20:37:30 -07:00
z 5309fded0e chore(brand): dynamic hero banner 2026-06-28 20:37:29 -07:00
zeekay 9624abb0d2 docs(threshold): decomplect the threshold-FHE package — one canonical path
Establish exactly one way to do each thing and fence off the legacy primitives:

- doc.go (new): package overview. DealerlessKeyGen is THE production keygen
  (dealerless); PartialDecryptLWE/CombineLWE is THE threshold decrypt
  (no-reconstruct); ShareLWESecretKey is a trusted-dealer test oracle only.
  Documents the F ⊥ M boundary (this package is FHE-only; MPC signing lives in
  luxfi/threshold) and the dealerless-bootstrap-key residual (homomorphic
  compute), stated honestly, not faked.

- keygen.go: re-document GenerateSharedKey. It is a TRUSTED-DEALER key-COMMITMENT
  VSS that shares the SHA-256 hash of the key — useful for verifiable-sharing
  audit, NOT usable for threshold decryption. Marked Deprecated for the keygen
  role; points to DealerlessKeyGen. Removes the misleading 'distributed key
  generation … for now we generate keys and split them' framing.

- partial_decrypt.go: label ShareLWESecretKey as TRUSTED-DEALER (retained as a
  KAT oracle); point to DealerlessKeyGen for production.

No behaviour change; kernel tests green.
2026-06-28 07:20:08 -07:00
zeekay bc34033354 feat(threshold): dealerless trustless threshold-FHE keygen (no trusted dealer)
Closes the one trustless gap in the threshold-FHE stack. partial_decrypt.go
was already NO-RECONSTRUCT (the master secret s only ever appears masked behind
c_1·s), but ShareLWESecretKey assumed a TRUSTED DEALER: one process samples the
whole FHE secret key and Shamir-splits it. That instant of single-party custody
violates the trustless-by-default law (no dealer + no-reconstruct), the same
standard Corona/Pulsar/Magnetar are held to.

DealerlessKeyGen removes the dealer. GJKR/Pedersen DKG structure specialised to
the RLWE/LWE secret, composed with the audited Lattigo multiparty CKG:
  - each party samples its OWN contribution s_j; collective secret s = Σ s_j
    is never formed by any party or by this package;
  - collective LWE public key p = Σ(-a·s_j + e_j) = -a·s + e via lattice CKG
    (dealerless, format-identical to the library's pk);
  - t-of-n shares: each party coeff-wise Shamir-splits its OWN s_j; recipients
    sum sub-shares to a degree-(t-1) Shamir share of s — producing exactly the
    LWEShare type the proven PartialDecryptLWE/CombineLWE kernel consumes.

Per-party API (DealerlessParty.DealRound1/Aggregate, SampleDealerlessCRP,
AssembleCollectivePublicKey) for distributed deployment + a one-shot driver.
Wire types (PublicKeyShareMsg/SubShareMsg) carry only public/share data, never
a SecretKey. DRY: ShareLWESecretKey now reuses the shared dealing helpers.

Proven (dealerless_dkg_test.go, all green incl. -race, 3-of-5 PN11QP54):
  - E2E trustless lane: dealerless DKG → public-key encrypt → t-of-n partial
    decrypt → combine → correct plaintext (2-of-3, 3-of-5);
  - below-threshold (t-1) cannot decrypt;
  - no party holds s: two t-subsets reconstruct the same secret, no share == s;
  - CRP deterministic per consensus seed (validators converge), seed-bound;
  - transport carries no secret (reflect gate);
  - no-reconstruct structural gate (go/ast) over the keygen+decrypt surface,
    with a negative control proving the gate has teeth.

Scope: F-Chain confidential-DECRYPT lane (encryption key + t-of-n shares). The
dealerless FHEW bootstrap/eval key (homomorphic COMPUTE) is a separate
multiparty-FHEW protocol, documented as the residual — not faked here.
2026-06-28 07:20:07 -07:00
ea92b5c443 chore: bump luxfi/database v1.19.3 (#8)
Co-authored-by: zeekay <z@zeekay.io>
2026-06-25 15:24:32 -07:00
Hanzo AI 4909871f80 go: 1.26.3 → 1.26.4 (security: crypto/x509, mime, net/textproto) 2026-06-06 22:05:26 -07:00
Hanzo AI e2d43ea5de WIP: session checkpoint 2026-06-05 (codec rip in flight) 2026-06-05 15:36:01 -07:00
Antje WorringandHanzo Dev dd53f8b350 fhe/easycrypt: port TFHE proofs to current EasyCrypt
require import Bool ('^^' xor scope); reproved chained_pbs_correctness and the
PBS-chain noise-budget induction (last_ind/foldl_rcons); fixed threshold-DKG
correctness rewrites.

Verified: all check under easycrypt (z3 + alt-ergo), 0 admits. Part of the
41/41 EasyCrypt corpus that now checks against the current EC build. Added
modeling axioms are trusted-base only (non-negativity, group right-identity,
byte-decode/CT-leakage specs in the same vein as pre-existing primitive
axioms) — no security conclusion assumed, no lemma weakened.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
2026-06-02 11:33:51 -07:00
Hanzo AI 5902317698 merge: feat/threshold-partial-decrypt 2026-06-01 16:34:31 -07:00
Hanzo AI b016300cd9 merge: feat/lp-137-types 2026-06-01 16:34:30 -07:00
Hanzo AI 1b910c381f docs(workshop): point at luxfhe/torus (backend org) instead of luxfi/torus
All FHE backend infrastructure (Torus compiler, ML SDK, TFHE runtime,
KMS, FHEVM) lives under the luxfhe org. luxfi/* repos are reserved for
the Lux-blockchain integrated surfaces (precompiles, coprocessor, core
FHE Go library).
2026-05-29 14:18:22 -07:00
Hanzo AI 5118282483 docs(workshop): drop Zama-derived workshop tooling
Removes:
  docs/workshop/fhevmjs/      (Zama JS package name; reencrypt + ABI demo)
  docs/workshop/pyfhevm/      (Python wrapper around fhevm-tfhe-cli)

Both directories shelled out to upstream tooling that isn't part of
the Lux stack — fhevmjs (Zama's JS SDK) and fhevm-tfhe-cli (Zama's
CLI for TFHE-rs). The clients were also broken on a clean checkout
since neither tool ships with this repo.

Workshop Solidity examples are unchanged (erc20.sol +
eip712-reencrypt.sol — these are stable references). README is
replaced with a placeholder pointing at the Torus compiler /
Lux FHE Coprocessor as the canonical client path; we will re-add
the workshop client when Torus ships.

Naming map followed for replacement copy:
  Lux FHE          — umbrella product
  Lux FHEVM        — canonical EVM product
  Lux FHE Precompiles, Coprocessor, GPU
  Torus            — compiler / framework brand
2026-05-29 13:53:17 -07:00
Hanzo AI 65a43b99fa docs: positive framing — Lux FHE on luxfi/lattice, self-contained
Drops the "Not a wrapper around tfhe-rs, not a binding to Zama, not a port of
OpenFHE" disclaimer in favor of stating what Lux FHE IS: a from-scratch TFHE
implementation in Go on luxfi/lattice, with optional C++ / GPU / FPGA accel
paths. No external library dependency.

Same change applied to the related papers + docs + skills in parallel
commits across lux/papers, lux/docs, lux/skills.
2026-05-29 12:37:06 -07:00
Hanzo DevandGitHub 378b74758c feat(threshold): real Bendlin-Damgård M-of-N partial decrypt for LWE (#5)
Adds the canonical noise-flooding threshold-decryption primitives that
upstream consumers (notably luxfi/threshold/protocols/tfhe) need to
implement true M-of-N FHE decryption without any party holding the
master key.

  - ShareLWESecretKey: Shamir-splits the LWE secret coefficient-by-
    coefficient over Z_q. No party ever sees the master.
  - PartialDecryptLWE: party j computes d_j = c_1 · s_j + e_j with
    fresh smudging noise from a discrete Gaussian.
  - CombineLWE: integer-Lagrange (Bendlin-Damgård denominator clearing)
    + Δ^{-1} mod q to recover the plaintext polynomial.
  - SmudgingSigma: tight noise calibration against the worst-case
    integer Lagrange numerator, so Λ_max · σ · √t · 6 ≤ Q/16.

Decomplecting note: this LSSS-over-Z_q lives next to the existing
LSSS-over-RFC-3526-prime in pkg/threshold. The two are different
primitives — large-prime LSSS shares high-entropy secrets where the
secret space need not equal the FHE modulus; Z_q LSSS composes
directly with lattice arithmetic. Both stay in this package.

Decryption follows Bendlin-Damgård (TCC 2010, §4.2) and Asharov-Jain-
López-Alt-Tromer-Vaikuntanathan-Wichs (EUROCRYPT 2012, §4). Noise
flooding is the simulation-soundness mechanism.

Verified by round-trip tests at (t, n) ∈ {(2, 3), (5, 9), (11, 21)},
below-threshold negative test, share-doesn't-equal-master regression
guard, dedup guard, cross-parameter guard, and combine-determinism
test. All 8 new threshold tests pass.

Also adds public accessors:
  - fhe.Parameters.ParamsLWE/ParamsBR — expose underlying rlwe.Parameters
    so out-of-tree threshold callers can drive lattice primitives
    against the same parameter set the encryptor uses.
  - fhe.BitCiphertext.Bits / NewBitCiphertextFromBits — iterate per-bit
    for threshold decryption without round-tripping MarshalBinary.

References:
  - Bendlin, Damgård. Threshold Decryption and Zero-Knowledge Proofs
    for Lattice-Based Cryptosystems. TCC 2010.
  - Asharov, Jain, López-Alt, Tromer, Vaikuntanathan, Wichs. Multiparty
    Computation with Low Communication, Computation and Interaction
    via Threshold FHE. EUROCRYPT 2012.
  - Mouchet, Troncoso-Pastoriza, Bossuat, Hubaux. Multiparty
    Homomorphic Encryption from Ring-Learning-with-Errors. PETS 2021.
2026-05-29 12:07:05 -07:00
Hanzo AI 695cde3545 feat(threshold): real Bendlin-Damgård M-of-N partial decrypt for LWE
Adds the canonical noise-flooding threshold-decryption primitives that
upstream consumers (notably luxfi/threshold/protocols/tfhe) need to
implement true M-of-N FHE decryption without any party holding the
master key.

  - ShareLWESecretKey: Shamir-splits the LWE secret coefficient-by-
    coefficient over Z_q. No party ever sees the master.
  - PartialDecryptLWE: party j computes d_j = c_1 · s_j + e_j with
    fresh smudging noise from a discrete Gaussian.
  - CombineLWE: integer-Lagrange (Bendlin-Damgård denominator clearing)
    + Δ^{-1} mod q to recover the plaintext polynomial.
  - SmudgingSigma: tight noise calibration against the worst-case
    integer Lagrange numerator, so Λ_max · σ · √t · 6 ≤ Q/16.

Decomplecting note: this LSSS-over-Z_q lives next to the existing
LSSS-over-RFC-3526-prime in pkg/threshold. The two are different
primitives — large-prime LSSS shares high-entropy secrets where the
secret space need not equal the FHE modulus; Z_q LSSS composes
directly with lattice arithmetic. Both stay in this package.

Decryption follows Bendlin-Damgård (TCC 2010, §4.2) and Asharov-Jain-
López-Alt-Tromer-Vaikuntanathan-Wichs (EUROCRYPT 2012, §4). Noise
flooding is the simulation-soundness mechanism.

Verified by round-trip tests at (t, n) ∈ {(2, 3), (5, 9), (11, 21)},
below-threshold negative test, share-doesn't-equal-master regression
guard, dedup guard, cross-parameter guard, and combine-determinism
test. All 8 new threshold tests pass.

Also adds public accessors:
  - fhe.Parameters.ParamsLWE/ParamsBR — expose underlying rlwe.Parameters
    so out-of-tree threshold callers can drive lattice primitives
    against the same parameter set the encryptor uses.
  - fhe.BitCiphertext.Bits / NewBitCiphertextFromBits — iterate per-bit
    for threshold decryption without round-tripping MarshalBinary.

References:
  - Bendlin, Damgård. Threshold Decryption and Zero-Knowledge Proofs
    for Lattice-Based Cryptosystems. TCC 2010.
  - Asharov, Jain, López-Alt, Tromer, Vaikuntanathan, Wichs. Multiparty
    Computation with Low Communication, Computation and Interaction
    via Threshold FHE. EUROCRYPT 2012.
  - Mouchet, Troncoso-Pastoriza, Bossuat, Hubaux. Multiparty
    Homomorphic Encryption from Ring-Learning-with-Errors. PETS 2021.
2026-05-29 11:52:53 -07:00
Hanzo AI 80dba8cb8b fhe: wire batch NTT/INTT to lattice/v7/gpu with byte-equality safety gate
Adds NTTEngine.NTTBatch / INTTBatch that dispatch to luxfi/lattice/v7/gpu
(Metal on darwin, CUDA on linux/NVIDIA) when:

  1. CGo is on and a GPU device is reachable (lattice/gpu.GPUAvailable())
  2. The engine's (N, Q) has passed a deterministic byte-equality probe
     against the CPU subring NTT oracle (cached per (N, Q))

Otherwise falls back to per-polynomial CPU subring NTT. The probe ensures
a GPU context with different convention encoding (Montgomery vs standard,
bit-reversed vs natural) is rejected before it can corrupt ciphertexts.

No `gpu` build tag. CGo is the only compile-time gate.

Tests: ntt_gpu_test.go::TestNTTBatch_ByteEqualToInPlace (probe enforces
byte equality), TestINTTBatch_RoundTrip (INTT(NTT(x)) == x).
2026-05-24 14:17:44 -07:00
Hanzo AI dc279ecced rip(demos): delete cmd/demos/ — kill -tags demos, one way only
The 8 demo mains imported github.com/hanzoai/base (HTTP server scaffold)
which pulled the legacy Google Cloud / temporal / grpc transitive chain.
Demos were the only consumers of that chain in the fhe tree.

One way only: fhe is a cryptographic library, not an app harness. App
authors who want HTTP wiring can vendor hanzoai/base directly in their
own cmd binary — fhe doesn't ship that scaffold.
2026-05-21 18:46:28 -07:00
Hanzo AI 51f818bf56 feat(demos): gate behind -tags demos (grpc opt-in only)
The 8 demo mains import github.com/hanzoai/base which pulls grpc
transitively via the legacy Google Cloud SDK chain. grpc is opt-in
only across the Lux stack, so demos follow the same discipline:
build with -tags demos.

Default fhe build: 0 grpc / 0 google cloud.
2026-05-21 17:44:49 -07:00
Hanzo AI cc90b80451 fix(go.mod): drop ../math relative replace — workspace provides it 2026-05-21 16:37:47 -07:00
Hanzo AI c175462251 fix(go.mod): replace absolute path with relative (../math) — no machine-specific paths 2026-05-21 16:26:56 -07:00
Hanzo AI b5041ca4fd deps: bump accel v1.0.7 → v1.1.2, crypto v1.19.0 → v1.19.10 2026-05-21 14:59:07 -07:00
Hanzo AI 6f72e47ce4 ci: add minimal CI workflow (build + short test + vet + govulncheck)
Adds GitHub Actions CI on push to main/dev + PRs:
- go build ./...
- go test -count=1 -short -timeout 300s ./...
- go vet ./...
- govulncheck (non-blocking, reports advisories)

GOWORK=off per repo convention.
2026-05-21 12:26:27 -07:00
Hanzo AI 56bf4da116 test: document CRDT BlindRotate timing in encrypted_test setup
PN10QP27 (~128-bit security) drives a full BlindRotate inside
lattice/v7@v7.1.0 — ~22s on Apple silicon. Comment added so future
maintainers don't mistake the test wall-clock for a hang.
2026-05-20 16:19:28 -07:00
Lux PatentsandHanzo AI 9d5cac50c5 remove detailed patent-claims docs (relocated to lux-private/patents)
Detailed invention disclosures are sensitive pre-filing material. Moved to
lux-private/patents to preserve international filing rights (EU/JP/KR/CN
absolute-novelty rule). Cross-ref: github.com/lux-private/patents/bundles/
2026-05-19 11:30:28 -07:00
Hanzo AI 5085ca723e patent-claims: novelty triage drafts (attorney-prep, not filed) 2026-05-19 11:30:28 -07:00
Hanzo AI d7e55f7ce6 fhe/sign-off: cryptographer review TFHE Tier A
CRYPTOGRAPHER-SIGN-OFF.md captures the Tier A artifact review:

  - APPROVED WITH GATES for F-Chain TFHE (LP-066/LP-134) and the
    threshold-FHE compliance package (LP-019/LP-076/LP-167)
  - Verified green: build, dudect bridges build, EC theories 0/0
    admits, Lean 0 sorry, bridge map cites each axiom, Jasmin
    algorithm shape correct, CT obligations correctly stated
  - 4 minor findings, 2 informational
  - 4 open gates:
      GATE-1: dudect submission-grade run (10^9 samples)
      GATE-2: jasminc -checkCT pass on production Jasmin
      GATE-3: deployment runbook for F-Chain TFHE
      GATE-4: Lean tactic-script transcription of EC proof

None of the gates require algorithm or code change; they are
about empirical confirmation and operational disclosure.
2026-05-19 11:30:28 -07:00
Hanzo AI a3e4beaecc fhe/ct/dudect: harness for Encrypt + Decrypt + Bootstrap CT
Empirical constant-time analysis harness mirroring the Pulsar
pack at ~/work/lux/pulsar/ct/dudect/:

  encrypt_ct.go   + dudect_encrypt.c    - cgo bridge + C main loop
  decrypt_ct.go   + dudect_decrypt.c    - the CT-critical routine
  bootstrap_ct.go + dudect_bootstrap.c  - PBS composite

CT population (operational framing):
  - Both classes are VALID inputs to the routine under test
  - Class A is a fixed input; class B is uniformly drawn from a
    pre-built pool of K independent valid inputs
  - Any timing difference is a real secret-content signal

All three cgo shared libraries build clean:
  GOWORK=off go build -buildmode=c-shared -tags tfhe_encrypt_ct
  GOWORK=off go build -buildmode=c-shared -tags tfhe_decrypt_ct
  GOWORK=off go build -buildmode=c-shared -tags tfhe_bootstrap_ct

dudect.h fetched on demand via fetch.sh (not committed).
dudect_compat.h supplies _mm_mfence/__rdtsc on AArch64 hosts.

Submission-grade run pending (GATE-1 in CRYPTOGRAPHER-SIGN-OFF.md).
2026-05-19 11:30:28 -07:00
Hanzo AI f5075908e1 fhe/jasmin: bootstrap + external_product + blind_rotate CT sources
Jasmin high-assurance track for the TFHE hot path:

  lib/tfhe_params.jinc       - parameter-set constants (PN10QP27 canonical)
  lib/modq.jinc              - constant-time mod_add/sub/mul/neg over Z_q
  external_product.jazz      - RGSW * RLWE external product (signed gadget)
  blind_rotate.jazz          - CGGI Asiacrypt 2016 blind rotation
  bootstrap.jazz             - PBS composite (BR o sample_extract o KS)

Constant-time by construction:
  - all secret-touching loops are straight-line
  - gadget decomposition uses bottom-up carry-propagation
  - mod_mul via Barrett reduction with no secret-dependent branches
  - monomial rotation via CMOV-shape sign-flip selection

Pending: jasminc -checkCT pass (gate in CRYPTOGRAPHER-SIGN-OFF.md
GATE-2; requires lattice/v7 NTT substitution in external_product).
2026-05-19 11:30:28 -07:00
Hanzo AI b951244d27 fhe/lean: TFHE Lean<->EC bridge map
proofs/lean-easycrypt-bridge.md pins the 1:1 correspondence between
the EasyCrypt theory axioms in fhe/proofs/easycrypt/ and the Lean
theorems in ~/work/lux/proofs/lean/Crypto/FHE/TFHE.lean +
Crypto.Threshold.Lagrange.

Maps 5 axioms:
  pbs_correctness            <-> programmable_bootstrap_correct
  shamir_inverse_eval        <-> threshold_reconstructs_secret
  reshare_preserves_secret   <-> reshare_preserves_constant_term
  pbs_noise_bound            <-> pbs_noise_bound
  decrypt_constant_time      <-> (operational; no Lean counterpart)
2026-05-19 11:30:28 -07:00
Hanzo AI ab4ec8d0e8 fhe/proofs: TFHE EC theories (0/0 admits)
EasyCrypt Tier A theories at fhe/proofs/easycrypt/:

  TFHE_Correctness.ec        - PBS correctness theorem
  TFHE_Threshold_Keygen.ec   - threshold-DKG correctness + privacy + reshare
  TFHE_Noise_Growth.ec       - per-op noise budgets + parameter-set invariant
  lemmas/TFHE_CT.ec          - CT obligations on hot path

Closure strategy: each top-level theorem reduced to small set of named
functional hypotheses imported from the luxfi/lattice/v7 reference
layer. Admit budget 0/0 across the pack.

Bridge map at proofs/lean-easycrypt-bridge.md pins axiom-to-theorem
correspondence 1:1 to Lean Mathlib (Crypto.Threshold.Lagrange).

Cites existing LaTeX at ~/work/lux/proofs/fhe/correctness.tex,
parameter-security.tex, dual-runtime-equivalence.tex.
2026-05-19 11:30:28 -07:00
Hanzo DevandGitHub 6c2e8e19f3 Merge pull request #3 from luxfi/licensing/canonical-pointer
docs: add LICENSING.md pointer to canonical Lux IP strategy
2026-05-15 16:38:06 -07:00
Hanzo Dev 755380a665 docs: add LICENSING.md pointing at canonical Lux IP strategy
Single LICENSING.md file referencing the canonical three-tier IP and
licensing strategy at github.com/luxfi/.github/blob/main/profile/README.md.

LICENSE file is unchanged; this only adds a navigational pointer.
2026-05-15 16:37:59 -07:00
Hanzo AI 5b556a6cb6 deps: luxfi/crypto v1.19.0 2026-05-13 11:59:12 -07:00
Hanzo AI 599ee814d9 fhe: decomplect onto luxfi/pq.Mode gate
Drop local SecurityProfile, ProfileClassical128, ProfileStrictPQ,
ProfileStrictPQHighValue, IsPostQuantum, String,
ProfileFromPQFlag. The strict-PQ Mode vocabulary lives in
github.com/luxfi/pq as the single source of truth across warp,
dex, evm, fhe, zap.

DefaultParamsForProfile (local enum) → DefaultParamsForMode
(pq.Mode): strict-PQ ⇒ PN9QP27_STD128Q (NIST FIPS 203 / 204
LMKCDEY); classical / hybrid ⇒ PN10QP27 (~128-bit classical,
dev-only). The FHE gate is parameter SELECTION, not refusal — no
classical ciphertext to refuse at the parameter layer, so the
ValidateMode call doesn't apply here.

ProfileStrictPQHighValue dropped: it was a no-op tier returning
the same PQ literal as the base strict-PQ profile. Once
STD192Q_LMKCDEY-aligned ParametersLiterals land, callers pick
them explicitly — the mode vocabulary stays single-purpose.
2026-05-12 19:45:14 -07:00
Hanzo AI fd4fa47ed5 fhe: SecurityProfile seam — strict-PQ picks STD128Q_LMKCDEY (PN9QP27_STD128Q)
Single seam every Liquid FHE chain boot routes through to pick a
ParametersLiteral. Direct references to PN10QP27 / PN11QP54 /
PN9QP27_STD128Q in chain-config code are a bug — they bypass the
profile gate and can silently weaken the chain to classical-only
security.

  ProfileClassical128       → PN10QP27       (~128 bit *classical*)
  ProfileStrictPQ           → PN9QP27_STD128Q (128 bit *quantum*,
                              OpenFHE STD128Q_LMKCDEY-aligned)
  ProfileStrictPQHighValue  → PN9QP27_STD128Q today; will return
                              STD192Q_LMKCDEY-aligned params once
                              published, no consumer churn

ProfileFromPQFlag(pq bool) wires this onto the chain-config "pq"
boolean the liquidity/operator writes into
/data/configs/chains/<id>/config.json. The Liquid FHE plugin reads
"pq":true from that file and asks DefaultParamsForProfile — strict-PQ
chains get STD128Q_LMKCDEY parameters at chain boot, with no
direct PN10QP27 reference anywhere on the boot path.

Tests pin the security guarantee byte-for-byte: ProfileStrictPQ
returns PN9QP27_STD128Q (not "some PQ literal" — the exact one), so a
regression that swaps the underlying literal name requires an
explicit test update.
2026-05-11 22:08:20 -07:00
Hanzo AI e5f37e2cfd deps: database v1.18.3 (drops zapdb/v4 transitive); ntt_simd updates; bench/ 2026-05-05 17:11:33 -07:00
Hanzo AI a7cafe5f25 LP-107 Phase 5: fhe consumes luxfi/math/codec
wire/wire.go — fhe's wire-format hardening boundary. FHE wire formats
nest deeper than pulsar's (CKKS ciphertext = Vec<Poly> over RNS chain
of Vec<u64>) so MaxDepth = 5 + larger MaxFrameBytes (32 MiB) reflect
the deeper polynomial structure.

Tests:
* TestValidateCiphertextFrame_RejectsHugeLength — regression for
  lattice issue #4 attack input class. Same substrate, same
  rejection.
* TestValidateCiphertextFrame_OverCap — MaxFHESliceLen+1 rejected.

go.mod adds luxfi/math v1.3.0 dependency.

This completes Phase 5 of LP-107: every Lux Go protocol repo
(pulsar, lens, fhe, lattice) now consumes the math substrate for
bounded wire decoding. The same lattice issue #4 attack input is
rejected identically across all four consumers.
2026-05-04 09:50:34 -07:00
Hanzo AI d5d2f4083d feat(types): FHECiphertextHeader + FHEPrecompileArtifact
LP-137-FHE-TYPING. New package github.com/luxfi/fhe/types wrapping every
FHE buffer with the metadata required for safe dispatch:

- FHEScheme (uint32 enum): TFHE, FHEW, CKKS, BFV, BGV.
- FHECiphertextHeader (144-byte struct): ParamsHash, KeyID, CircuitID,
  Scheme, Level, N, ModulusCount, Domain, Reserved. Digest() returns
  SHA-256 of canonical 144-byte little-endian encoding; deterministic
  across runs. MatchesContext() rejects N + Domain mismatch.
- FHEPrecompileArtifact (232-byte struct): seven 32-byte digest fields
  (ParamsHash, KeyRoot, InputCiphertextRoot, OutputCiphertextRoot,
  CircuitRoot, ThresholdTranscriptRoot, AttestationRoot) + OpCount +
  FailedCount. Digest() is the contribution to fchain_fhe_root.
  IsThreshold / IsAttested flag-helpers on the *Root fields.

Layout byte-stable with the C++ mirror at luxcpp/fhe/include/lux/fhe/types.
Cross-language byte image tests verify both struct types.

14 Go tests pass.
2026-04-27 12:47:39 -07:00
Hanzo AI 5797cae572 fix: rlwe.NewKeyGenerator compat with lattice/v7
lattice/v7 dropped the FromPRNG constructor. Use NewKeyGenerator for
now; deterministic seeding tracked in luxfi/lattice#42.
2026-04-13 02:42:56 -07:00
Hanzo AI 8b8447a0a4 feat(encrypted): FHE CRDT primitives + RFC 3526 safe prime
LWW-Register, ORSet, GCounter merge under TFHE encryption.
EncryptedDocument with structural StateRoot (deterministic across
replicas despite ciphertext non-determinism). AnchorClient interface
for CRDTAnchor.sol checkpoint wiring.

Safe prime swap: 256-bit composite → 2048-bit RFC 3526 Group 14.
Feldman VSS generator now element of order q (was full group).
Reshare uses additive sub-sharing (no secret materialization).

19 encrypted + 10 threshold tests pass. Red-reviewed: 16 findings,
13 fixed, 5 scientist findings addressed.
2026-04-13 01:03:34 -07:00
Hanzo AI e91c21fe2d test: fheCRDT benchmark harness + lattice property checks
Adds bench_crdt_test.go with:
- Lattice property tests (commutativity, associativity, idempotence)
  for LWW-Register, G-Counter, and G-Set over FHE ciphertexts
- Benchmarks for single bootstrap, G-Set merge, G-Counter merge,
  LWW-Register merge throughput
- Ciphertext size measurement
- Simulated 2-node geo-distributed convergence with 50ms RTT
2026-04-12 22:50:17 -07:00
Hanzo AI 4a0944c37f feat: add cli package for lux CLI integration
Exports NewCmd() returning a cobra.Command with keygen, encrypt,
decrypt, and eval subcommands. Wires directly to fhe.KeyGenerator,
fhe.Encryptor, and fhe.Decryptor -- no stubs.
2026-04-12 21:41:49 -07:00
Hanzo AI 4e8b18b5a8 deps: luxfi/zapdb v4 → v1.0.0 (module path reset) 2026-04-11 00:05:17 -07:00
Hanzo AI 5f82c63695 fix: all routes under /v1/fhe/* — canonical path pattern 2026-04-09 17:46:41 -07:00
Hanzo AI 791751c217 chore: final cleanup — all security fixes applied, all tests passing 2026-04-07 22:19:10 -07:00
Hanzo AI 7cf246c498 security: add DEMO WARNING to regulated vault (operator holds full key) 2026-04-07 20:14:48 -07:00