mirror of
https://github.com/zap-proto/spec.git
synced 2026-10-30 15:04:03 +00:00
Initial release of ZAP (Zero-copy Agent Protocol) for high-performance AI agent communication with post-quantum security. ## Features ### Core Protocol - Cap'n Proto RPC for zero-copy serialization - Client/Server/Gateway architecture - Multi-transport support (TCP, Unix sockets, WebSocket) ### Post-Quantum Cryptography - ML-KEM-768 key encapsulation (NIST FIPS 203) - ML-DSA-65 digital signatures (NIST FIPS 204) - Hybrid X25519 + ML-KEM handshake ### W3C DID Identity - did:lux - Blockchain-anchored DIDs for Lux network - did:key - Self-certifying DIDs from ML-DSA-65 keys - did:web - DNS-based DIDs - DID Document generation with verification methods ### Agentic Consensus - Query/Response/Vote model for agent decisions - Configurable consensus threshold (default 50% majority) - Stake-weighted voting support - Finality proofs with post-quantum signatures ### Lux Integration - LuxConsensusBridge for Quasar finality - Ringtail threshold signature support - BLS + Ringtail hybrid signatures ## SDKs - Rust: Full native implementation with async support - Python: hanzo-zap package with asyncio - TypeScript: @hanzo/zap package with full type safety ## Testing - Rust: 38 tests - Python: 48 tests - TypeScript: 60 tests - CI: GitHub Actions with 80%+ coverage gates
33 lines
964 B
Python
33 lines
964 B
Python
"""Tests for hanzo_zap.error module."""
|
|
|
|
import pytest
|
|
from hanzo_zap.error import ZapError
|
|
|
|
|
|
class TestZapError:
|
|
"""Tests for ZapError class."""
|
|
|
|
def test_zap_error_creation(self):
|
|
"""Test creating a ZapError."""
|
|
error = ZapError("Something went wrong")
|
|
assert str(error) == "Something went wrong"
|
|
|
|
def test_zap_error_is_exception(self):
|
|
"""Test ZapError is an Exception."""
|
|
error = ZapError("test")
|
|
assert isinstance(error, Exception)
|
|
|
|
def test_zap_error_raise_and_catch(self):
|
|
"""Test raising and catching ZapError."""
|
|
with pytest.raises(ZapError) as exc_info:
|
|
raise ZapError("test error")
|
|
|
|
assert "test error" in str(exc_info.value)
|
|
|
|
def test_zap_error_subclass_behavior(self):
|
|
"""Test ZapError can be caught as Exception."""
|
|
try:
|
|
raise ZapError("test")
|
|
except Exception as e:
|
|
assert isinstance(e, ZapError)
|