ant-node 0.22.0

Pure quantum-proof network node for the Autonomi decentralized network
Documentation
[package]
name = "ant-node"
version = "0.22.0"
edition = "2021"
authors = ["David Irvine <david.irvine@maidsafe.net>"]
description = "Pure quantum-proof network node for the Autonomi decentralized network"
license = "MIT OR Apache-2.0"
repository = "https://github.com/WithAutonomi/ant-node"
keywords = ["p2p", "decentralized", "quantum-safe", "post-quantum", "dht"]
categories = ["network-programming", "cryptography"]
rust-version = "1.95"

[lib]
name = "ant_node"
path = "src/lib.rs"

[[bin]]
name = "ant-node"
path = "src/bin/ant-node/main.rs"

[[bin]]
name = "ant-devnet"
path = "src/bin/ant-devnet/main.rs"

[dependencies]
# Global allocator. musl's default malloc is significantly slower than
# glibc's under concurrent allocation churn, which matches the node's
# steady-state workload. mimalloc neutralises that regression for the
# musl Linux builds (and tends to beat glibc's allocator too).
mimalloc = "0.1"

# Native application wire protocol shared with ant-client.
# Bumping ant-protocol's `evmlib`/`saorsa-core`/`saorsa-pqc` pins ripples
# through here automatically; we keep a direct saorsa-core dep for
# node-only DHT internals (DHTNode, TrustEvent, DhtNetworkEvent), which
# Cargo unifies with ant-protocol's version constraint.
#
ant-protocol = "4.0.0"

# Core (provides EVERYTHING: networking, DHT, security, trust, storage)
saorsa-core = "0.29.0"
saorsa-pqc = "0.5.2"

# Payment verification - autonomi network lookup + EVM payment
evmlib = "0.10.0"
xor_name = "5"

# Caching - LRU cache for verified XorNames
lru = "0.16.3"
parking_lot = "0.12"  # Efficient mutex for cache

# Storage - LMDB via heed for content-addressed chunk store
heed = "0.22"

blake3 = "1"

# Async runtime
tokio = { version = "1.35", features = ["full", "signal"] }
tokio-util = { version = "0.7", features = ["rt"] }
futures = "0.3"

# CLI
clap = { version = "4.5", features = ["derive", "env"] }

# Configuration
serde = { version = "1", features = ["derive"] }
toml = "0.8"
directories = "5"

# Auto-upgrade
reqwest = { version = "0.13", features = ["json", "rustls"], default-features = false }
semver = "1"

# Logging (optional — behind `logging` feature flag)
tracing = { version = "0.1", optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"], optional = true }
tracing-appender = { version = "0.2", optional = true }

# Error handling
thiserror = "2"
color-eyre = "0.6"

# Serialization
rmp-serde = "1"
hex = "0.4"

# Utilities
# 1.10.1: `Bytes::from_owner` (1.9) without its `to_vec` leak (fixed in 1.10.1).
bytes = "1.10.1"
chrono = { version = "0.4", features = ["serde"] }
tempfile = "3"
rand = "0.8"
serde_json = "1"

# Archive extraction for auto-upgrade
flate2 = "1"
tar = "0.4"
zip = "2"

# SHA-256 hashing for binary cache integrity
sha2 = "0.10"

# Cross-platform file locking for upgrade caches
fs2 = "0.4"

# System page size (for LMDB map alignment during resize)
page_size = "0.6"

# Protocol serialization
postcard = { version = "1.1.3", features = ["use-std"] }
# Byte-string encoding for chunk payloads in replication messages (same postcard
# wire layout as a u8 sequence, but serialized and sized in one memcpy pass).
serde_bytes = "0.11"
bao = "0.13.1"

# Shared portable browser profile. The native listener is enabled separately
# by the `webrtc-direct` feature.
saorsa-transport = { version = "0.38.0", default-features = false, features = ["webrtc"] }
# Only the test-utils devnet helper that seeds public files for browser tests
# uses it, so release builds do not link it.
self_encryption = { version = "0.36", optional = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
self-replace = "1"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-foundation = { version = "0.3", features = ["NSProcessInfo", "NSString"] }

[dev-dependencies]
tokio-test = "0.4"
proptest = "1"
alloy = { version = "1", features = ["node-bindings"] }
serial_test = "3"
# Exercise connected peers that never announce a DataChannel to the listener.
webrtc-stack = { package = "webrtc", version = "0.14" }

# Proves the migration returns disk to the filesystem, which is the claim the whole
# change exists to make good. Needs the test-only migration-state accessor.
[[test]]
name = "migration_reclaims_disk"
path = "tests/migration_reclaims_disk.rs"
required-features = ["test-utils"]

# Kills a real child process part-way through writing and migrating, then checks what
# survived. The automatable half of the power-loss gate.
[[test]]
name = "migration_crash_safety"
path = "tests/migration_crash_safety.rs"
required-features = ["test-utils"]

# Startup scan time, index memory and inode cost at scale. Regression gates, not
# benchmarks; ANT_SCALE_KEYS raises the count for a deliberate larger run.
[[test]]
name = "storage_scale"
path = "tests/storage_scale.rs"
required-features = ["test-utils"]

# Several nodes migrating on one disk: the volume lock, and that each finishes with its
# own chunks and only its own.
[[test]]
name = "migration_shared_volume"
path = "tests/migration_shared_volume.rs"
required-features = ["test-utils"]

# E2E test infrastructure (run with --features test-utils)
[[test]]
name = "e2e"
path = "tests/e2e/mod.rs"
required-features = ["test-utils"]

# v12 storage-bound audit attack PoCs. Uses the test-only one-shot
# commitment builder/verifier helpers, so it requires the test-utils
# feature. CI runs it via `cargo test --test poc_commitment_audit_attacks
# --features test-utils`.
[[test]]
name = "poc_commitment_audit_attacks"
path = "tests/poc_commitment_audit_attacks.rs"
required-features = ["test-utils"]

# Live responder-handler tests for the v12 audit. Use
# LmdbStorageConfig::test_default(), gated on test-utils.
[[test]]
name = "poc_audit_handler_live"
path = "tests/poc_audit_handler_live.rs"
required-features = ["test-utils"]

# Bootstrap-stall regression coverage for source cleanup after peer removal.
# Declared like the other PoC suites so CI invokes it explicitly.
[[test]]
name = "poc_bootstrap_stall"
path = "tests/poc_bootstrap_stall.rs"
required-features = ["test-utils"]

# Live-Anvil verification of the ADR-0006 price floor against a real deployed
# vault + real on-chain settlement. Needs the test-utils fail-open for the
# issuer K-closest check so the floor is the isolated load-bearing check.
[[test]]
name = "poc_price_floor_live"
path = "tests/poc_price_floor_live.rs"
required-features = ["test-utils"]

# Shutdown/LMDB-drain regression: `ReplicationEngine::shutdown()` must not
# return while a detached LMDB blocking op is still running. Uses the
# test-only storage put gate, so it requires the test-utils feature.
[[test]]
name = "poc_shutdown_lmdb_drain"
path = "tests/poc_shutdown_lmdb_drain.rs"
required-features = ["test-utils"]

[[test]]
name = "webrtc_direct_devnet"
path = "tests/webrtc_direct_devnet.rs"
required-features = ["webrtc-direct"]

[features]
default = ["logging", "webrtc-direct"]
# Enable tracing/logging infrastructure.
# Included in `default`, so every build we ship — dev, release candidate and
# release alike — has logging. Opt out only for a bespoke build that needs it
# gone: `cargo build --release --no-default-features`.
logging = ["tracing", "tracing-subscriber", "tracing-appender"]
# Expose test helpers (cache_insert, payment_verifier accessor) for
# integration tests and downstream test harnesses.
test-utils = ["dep:self_encryption"]
# Direct browser transport from ADR-0015. Enabled by default; minimal
# native-only builds can omit it with `--no-default-features`.
webrtc-direct = [
    "saorsa-transport/default",
    "saorsa-transport/webrtc-direct",
]

[profile.release]
lto = true
codegen-units = 1
panic = "abort"
strip = true

[profile.dev]
# Faster builds for development
opt-level = 1

[lints.rust]
unsafe_code = "deny"
missing_docs = "warn"

[lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
# Allow async functions that will have await statements added later
unused_async = "allow"
# Allow slightly complex functions during initial development
cognitive_complexity = "allow"
# Allow non-const functions during initial development (may need runtime features later)
missing_const_for_fn = "allow"