Aere Network public source. Everything here can be checked against the live chain (chain id 2800, https://rpc.aere.network). Scope note, stated up front rather than buried: consensus on chain 2800 is classical secp256k1 ECDSA QBFT. The post-quantum work in this repository is at the signature, precompile, account and transport layers. Nothing here makes the consensus post-quantum, and no document in it should be read as claiming so.
3.9 KiB
3.9 KiB
Spec 12: Aere VSM (Verifiable Semantic Memory) — DONE
On-chain attestation for an AI agent's vector-store memory: clear owner, verifiable append-only history, PQC-authenticated commits, and paid attested retrieval on the AERE402 rail.
Deliverables (all real, tested)
- Contract:
aerenew/contracts/contracts/agentic/AereVectorStore.sol(solc 0.8.23, new file, no deployed contract modified) - Test:
aerenew/contracts/test/aere-vector-store.test.js— 8 passing - Doc:
aerenew/docs/AERE-VSM.md
Contract surface
createStore(storeId, falconPubKey?, settlementToken?, queryPrice?, paymentRecipient?)Config FIXED at creation (no setters). Classical store (empty key, owner-signed) or post-quantum store (897-byte Falcon-512 key, header 0x09). Fail-closed on malformed key / inconsistent price config.commit(storeId, vectorRoot, vectorCount, uri, falconSig)-> version Append-only versioned root. PQC store: falconSig verified in full via 0x0AE1 over a per-version challenge (COMMIT_DOMAIN|chainid|this|storeId|version|root|count|keccak(uri)); invalid sig reverts PQCVerificationFailed (fail-closed). Classical store: msg.sender==owner. Empty/zero precompile return (pre-fork) treated as INVALID. Reuses the exact Falcon-512 input construction from AerePQCAttestation.sol.attestRetrieval(storeId, version, queryHash, resultRoot, receiptId)-> retrievalId Version must exist (1..current) or revert UnknownVersion (fail-closed). Priced store: must cite a matching unconsumed AERE402 receipt (PaymentRequired / ReceiptConsumed / ReceiptMismatch).paidQuery(storeId, queryHash, agentId, amount, nonce, deadline, authSig)-> receiptId References existing AERE402Facilitator (NOT redeployed). Vector store is the payee, calls facilitator.settle, forwards received tokens (balance delta) to paymentRecipient in-tx; no cross-call custody. Mints a receipt bound to (store, query, agent, nonce).- Inclusion views:
verifyVectorInclusion(storeId, version, leaf, proof)(membership in the committed vectorRoot) andverifyResultInclusion(retrievalId, leaf, proof)(membership in the attested resultRoot). OpenZeppelin MerkleProof (sorted-pair keccak256). - No admin, no owner override, no upgrade hook, no path rewrites a committed version.
Real test result
npx hardhat test test/aere-vector-store.test.js from aerenew/contracts: 8 passing.
- PQC commit v1 then v2, append-only history preserved
- tampered Falcon sig rejected fail-closed (also wrong-version + wrong-key rejected)
- empty precompile return (pre-fork) treated as invalid
- retrieval attestation records vs valid version; missing/zero version reverts
- inclusion proof: member verifies, non-member fails (vectorRoot + resultRoot)
- AERE402 paid-query: real facilitator settle, fee to sink, remainder to recipient, receipt gates attestRetrieval; unpaid reverts PaymentRequired, reuse ReceiptConsumed, wrong-query ReceiptMismatch; store holds 0 across the call
- classical store: only owner may commit (non-owner NotOwner)
- createStore fail-closed on bad key / inconsistent config / duplicate storeId Falcon MOCKED in test (MockPQCPrecompile at 0x0AE1 via hardhat_setCode); real encoding proven separately vs LIVE mainnet precompile by AerePQCAttestation path.
Honesty flags
- [VERIFY]: on-chain commit registry, PQC-authenticated commits (0x0AE1), retrieval attestation, inclusion proofs, AERE402 paid-query gate — built + tested.
- [MEASURE]: embedding model, vector similarity search / index, raw vector data, and semantic quality/relevance — all OFF-CHAIN. On-chain attestation proves PROVENANCE + OWNERSHIP + that a retrieval named a committed version, NOT semantic quality/relevance.
- Scope boundary preserved: PQC-authenticated memory commits do NOT make consensus post-quantum (blocks still Besu QBFT + classical ECDSA). No new token (AERE402 uses existing rails).
- No em-dashes / "--" in prose. Brand "Aere Network"/"Aere", ticker AERE uppercase.