Files
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
..