hanzo-brain: pure-CPU algorithm primitives + BLAKE3 byte-equivalent across all 5 runtimes#7
Closed
hanzo-dev wants to merge 10 commits into
Closed
hanzo-brain: pure-CPU algorithm primitives + BLAKE3 byte-equivalent across all 5 runtimes#7hanzo-dev wants to merge 10 commits into
hanzo-dev wants to merge 10 commits into
Conversation
Lists the 3-VM triumvirate (cevm GPU EVM, dexvm CLOB, thresholdvm FHE) plus all 8 other optional VMs that hanzod inherits via github.com/luxfi/node/app.New. The actual registration happens in luxfi/node/node/vms.go (registerOptionalVMs). Useful for smoke-testing that the daemon links the luxcpp 3-VM bindings correctly without needing to start the full network.
Add `lux-crypto-sys` (FFI to luxcpp/crypto C-ABI) as a workspace path dep alongside existing `oqs` / `k256` / `ed25519-dalek` so a future PR can migrate ML-KEM / ML-DSA / SLH-DSA call sites in hanzo-pqc to the canonical C-ABI without touching this manifest. No call sites are migrated in this commit -- the crate continues to use `oqs` and friends. This is forward groundwork only.
…rgo features Adds a `lux-crypto-impl` cargo feature that routes ML-DSA, ML-KEM, SLH-DSA and Ed25519 through the canonical luxcpp/crypto FFI (`lux_crypto::*`). The legacy backends are gated behind `legacy-oqs` and `legacy-ed25519-dalek` and remain bundled in `default` because the canonical luxcpp ML-DSA/ML-KEM/SLH-DSA C-ABI symbols presently return CRYPTO_ERR_NOTIMPL. Default build keeps existing behaviour; once the canonical impls land, flip default to ["lux-crypto-impl", ...] and drop the legacy features. Adds tests/lux_crypto_parity.rs with byte-equal RFC 8032 Ed25519 test vectors against both backends, plus ML-DSA/ML-KEM functional roundtrip checks that honestly skip when the canonical impl returns NotImpl. hanzo-mining and hanzo-kbs need no migration: hanzo-mining has no oqs/k256/ed25519-dalek/secp256k1 call sites; hanzo-kbs is excluded from the workspace per its own Cargo.toml note. Test: cargo test -p hanzo-pqc → 47 lib + 10 integration + 1 parity = 58 pass Test: cargo test -p hanzo-mining --lib → 31 pass
Cargo.lock catches up to lux-crypto sub-crate split (keccak/ripemd160/ secp256k1/sha256). docs/vms/ adds reference for hanzod's D-Chain/C-Chain/ T-Chain split per recent VM subcommand work.
Required for hanzoai/.github/.github/workflows/docker-build.yml@main — without it the workflow_call dies as startup_failure with no jobs dispatched. Caller permissions are a CEILING.
Adds hanzo-libs/hanzo-brain — the canonical Rust port of the Hanzo
Brain algorithm surface inside the node workspace. Mirrors the TS
canonical (@hanzo/bot-memory), Python (hanzo-memory), Go (bot-go/pkg/
brain), and C++ (bot-cpp) ports. 38 unit tests passing.
Lives alongside the rest of the brain's wire-up inside hanzoai/node:
hanzo-consensus Quasar metastable consensus (storage quorum)
hanzo-zap ZAP transport
hanzo-pqc post-quantum signatures (recipient blocks)
hanzo-machine threshold-crypto primitives (MMPKE01 wraps)
hanzo-db-sqlite SQLite + FTS5 default storage
This makes brain.recall / brain.search / brain.ingest first-class node
RPC methods — any agent talking to a Hanzo Node gets the brain without
a sidecar.
Algorithm surface (mirrored across all five runtimes):
- Retrieval: RRF, RSF, adaptive k + weights, MMR, dedup, two-stage MRL
- Text: Unicode script detection, CJK bigrams, emoji trigrams,
websearch_to_tsquery, FTS5 MATCH renderer
- Embed: model registry, asymmetric E5 prefixes, MRL truncation
- Eval: MRR, recall@k, precision@k, NDCG@k
- Temporal: UUIDv7 floor/ceiling
- Captions: WebVTT / SRT / RTTM
- Crypto: wallet-style content-addressable ids
- Graph: normalize → SNN → PFNET → Louvain
- Inference: provider slug, runtime config (db_override → env →
default), link-type classifier
- algorithms.rs: drop redundant `mut` from the `flush` closure binding in estimate_tokens (the closure is `FnMut` via the captures it needs, not via the binding). Clears the only cargo-build warning the crate emits. - lib.rs: describe siblings as "workspace crates" without org-style links; spell out that this crate lives at hanzo-libs/hanzo-brain/ inside the hanzoai/node Cargo workspace; add hanzo-runtime as a sibling integration. Build clean. cargo test -p hanzo-brain --lib: 38 passed; 0 failed. Algorithm surface unchanged (byte-equivalent with hanzoai/mcp mirror).
Swapped sha2 stand-in for the workspace blake3 crate so wallet addresses match the TS canonical (@noble/hashes/blake3), Python (blake3 pip), Go (lukechampine.com/blake3), and C++ (vendored reference impl) byte- for-byte: encode_address([0u8;32], None) → hanzo:UFC8qCW8LRUmpfyRq2qnAvYi11cqftY3b (all five runtimes) 38 brain tests still pass.
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 32161365 | Triggered | Generic High Entropy Secret | 003d708 | hanzo-libs/hanzo-pqc/tests/lux_crypto_parity.rs | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Member
Author
|
Superseded by clean cherry-pick branch — see new PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
hanzo-libs/hanzo-brain— the canonical Rust port of the Hanzo Brain algorithm surface inside the node workspace. Brain'srecall/search/ingestare now first-class node calls; no sidecar needed.Five runtimes ship the same algorithm surface, byte-equivalent on the wire:
hanzoai/brain—@hanzo/bot-memory@noble/hashes/blake3hanzoai/python-sdk—hanzo-memoryblake3pip (mirror:hanzoai/blake3-py)hanzoai/bot-go—pkg/brainlukechampine.com/blake3(mirror:hanzoai/blake3-go)hanzo-libs/hanzo-brainblake3crate (hanzoai/blake3fork)hanzoai/mcpblake3cratehanzoai/bot-cpphanzoai/blake3)Wallet address for
[0u8; 32]→hanzo:UFC8qCW8LRUmpfyRq2qnAvYi11cqftY3bon every runtime.Commits
c0e3bf30ehanzo-brain crate (38 unit tests passing)d3a2e64e6silenceunused_mutwarning + tighten lib doce74a64405swapsha2stand-in for the workspaceblake3crate75adceda7(ci: add id-token: write to caller permissions) is a pre-existing CI fix that was already on this branch — included as-is.Test plan
cargo build -p hanzo-brain— cleancargo test -p hanzo-brain --lib— 38 / 38 passedSister crates already inside the node workspace that the brain wires into:
hanzo-libs/hanzo-consensus(Quasar metastable consensus)hanzo-libs/hanzo-zap(ZAP transport)hanzo-libs/hanzo-pqc(post-quantum signatures)hanzo-libs/hanzo-machine(threshold crypto)hanzo-libs/hanzo-db-sqlite(SQLite + FTS5 default storage)Chain layer (validators, bridge, DEX, faucet, explorer, wallet) lives in the
hanzonetorg and is inherited by the node.