The ADIC update system provides a fully decentralized, peer-to-peer software update distribution mechanism that enables the network to self-update without relying on centralized servers or CDNs. This system is designed to be resilient, secure, and efficient, leveraging the existing P2P network infrastructure.
The central coordinator for update operations on each node:
- Schedules periodic update checks
- Manages update windows for controlled rollouts
- Coordinates download, verification, and application phases
- Handles both automatic and manual update modes
P2P protocol for distributing updates across the network:
- Message types: VersionAnnounce, VersionQuery, BinaryRequest, ChunkResponse
- Rate limiting and concurrent transfer management
- Retry mechanisms with exponential backoff
- Peer reputation tracking for reliable sources
Efficient storage and management of binary chunks:
- 1MB chunk size for optimal network transfer
- In-memory caching for frequently accessed chunks
- SHA256 verification for each chunk
- Assembly of complete binaries from chunks
Network-wide performance monitoring:
- Aggregates download/upload speeds from all peers
- Tracks peer states (downloading, seeding, idle)
- Monitors version distribution across the network
- Provides real-time swarm statistics
Version announcement via DNS TXT records:
- Domain:
_version.adic.network.adicl1.com - Format:
v=0.1.7;sha256=<hash>;sig=<signature>;date=<timestamp> - Fallback to P2P discovery if DNS unavailable
- Scheduled Check: Update manager triggers periodic checks (default: hourly)
- DNS Query: Check TXT record for latest version
- P2P Fallback: Query connected peers if DNS fails
- Version Comparison: Determine if update needed
- Peer Selection: Find peers with the new version
- Chunk Request: Request specific chunks from multiple peers
- Parallel Download: Download chunks concurrently (max 5 by default)
- Hash Verification: Verify SHA256 for each chunk
- Progress Tracking: Update progress display and swarm metrics
- Binary Assembly: Combine chunks into complete binary
- Full Hash Check: Verify complete binary SHA256
- Signature Verification: Validate Ed25519 signature
- Version Record Check: Ensure version metadata matches
- Copyover Preparation: Prepare for graceful restart
- Socket Preservation: Maintain active connections
- Binary Replacement: Replace executable using execv()
- State Recovery: Resume operations with new version
# Update checking interval (seconds)
ADIC_UPDATE_CHECK_INTERVAL=3600
# Update window (HH:MM-HH:MM format)
ADIC_UPDATE_WINDOW="02:00-04:00"
# Auto-update mode
ADIC_AUTO_UPDATE=false
# DNS domain for version discovery
ADIC_VERSION_DNS_DOMAIN="_version.adic.network.adicl1.com"
# Cloudflare API for DNS updates (publishers only)
CLOUDFLARE_API_KEY="your-api-key"[update]
check_interval = 3600
auto_update = false
update_window_start = "02:00"
update_window_end = "04:00"
max_concurrent_chunks = 5
chunk_timeout = 30
retry_limit = 3
[update.dns]
domain = "_version.adic.network.adicl1.com"
timeout = 5- SHA256 Hashing: Every chunk and complete binary verified
- Ed25519 Signatures: Binary signed by official release key
- DNS Security: DNSSEC validation when available
- Peer Trust: Reputation-based peer selection
- Sybil Resistance: Multiple peer verification required
- Version Pinning: Nodes can pin specific versions
- Rollback Protection: Version downgrade prevention
- Chunk Poisoning: Hash verification prevents bad chunks
adic update checkOutput:
π Checking for updates...
Current version: 0.1.6
Latest version: 0.1.7
Update available: Yes
SHA256: 3a4f5b6c7d8e9f0a1b2c3d4e5f6g7h8i...
adic update downloadShows progress:
Downloading ADIC v0.1.7...
ββββββββββββββββββββββ 45.2%
2.3 MB / 5.1 MB β’ 1.2 MB/s β’ 3s remaining
Swarm: β 45.2 MB/s / β 127.8 MB/s (42 peers distributing)
adic update applyPerforms graceful restart with new binary.
adic update statusOutput:
Update Status:
Current version: 0.1.6
Update system: Ready
Last check: 2024-12-28 12:00:00
Auto-update: Disabled
Returns real-time swarm statistics including collective download/upload speeds, peer distribution, and version adoption.
Returns current node update status, available versions, and configuration.
Manually triggers an update check.
Returns detailed download progress including chunk status and ETA.
Peers broadcast their metrics every 5 seconds:
SwarmMetrics {
download_speed: u64,
upload_speed: u64,
active_transfers: u32,
seeding_versions: Vec<String>,
downloading_version: Option<String>,
download_progress: Option<f32>,
peer_count: usize,
timestamp: u64,
}- Total network bandwidth usage
- Version adoption rate
- Average download completion time
- Peer contribution ratios
- LRU cache for recently accessed chunks
- Configurable cache size (default: 100MB)
- Automatic cache cleanup
- Concurrent chunk downloads from multiple peers
- Load balancing across available seeders
- Automatic peer switching on failure
- Upload bandwidth limiting to prevent saturation
- Fair queuing for multiple requesters
- Priority given to rare chunks
Structured logging with performance metrics:
INFO peer_id=12D3KooW... version=0.1.7 chunks=51 "π¦ Version announced"
DEBUG chunk_index=23 size_bytes=1048576 "Chunk received"
INFO download_speed_mbps=2.3 upload_speed_mbps=5.1 "Swarm statistics updated"
Prometheus-compatible metrics:
adic_update_chunks_downloaded_totaladic_update_bytes_transferred_totaladic_update_swarm_speed_bytes_per_secondadic_update_peers_by_version
- Check DNS connectivity:
dig TXT _version.adic.network.adicl1.com - Verify network connectivity to peers
- Check logs for DNS timeout errors
- Check peer count: need seeders with new version
- Verify network bandwidth availability
- Check swarm statistics for overall network speed
- Ensure system time is synchronized
- Check for corrupted chunks in storage
- Verify DNS record integrity
- Check file permissions on binary
- Ensure sufficient disk space
- Verify no security software blocking execv()
Enable detailed update logging:
RUST_LOG=adic_node::update_manager=debug,adic_network::protocol::update_protocol=debug adic start- Delta updates for bandwidth efficiency
- Torrent-like piece selection algorithms
- Geographic peer prioritization
- Update staging and testing phases
- Rollback mechanisms with state preservation
- Multi-signature requirement for critical updates
- Merkle tree verification for chunks
- Zero-knowledge proofs for version authenticity
- Homomorphic encryption for private networks
- IPFS integration for persistent storage
The update system is a critical component of ADIC's infrastructure. When contributing:
- Test Thoroughly: Updates affect the entire network
- Maintain Compatibility: Ensure backward compatibility
- Document Changes: Update this documentation
- Security First: All changes must maintain security guarantees
- Performance: Monitor impact on network performance
For implementation details, see:
/crates/adic-node/src/update_manager.rs/crates/adic-network/src/protocol/update_protocol.rs/crates/adic-network/src/protocol/binary_store.rs/crates/adic-network/src/protocol/swarm_tracker.rs