Skip to content

Latest commit

 

History

History
127 lines (93 loc) · 4.41 KB

File metadata and controls

127 lines (93 loc) · 4.41 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

ant-node is the core P2P network node binary for the Autonomi ecosystem. It provides the decentralized storage and networking foundation using post-quantum cryptography.

Development Commands

Building and Testing

# Build the project
cargo build --release

# Run all tests
cargo test

# Run with verbose output
cargo test -- --nocapture

# Format and lint
cargo fmt --all
cargo clippy --all-features -- -D clippy::panic -D clippy::unwrap_used -D clippy::expect_used

Running the Node

# Run as bootstrap node (default port)
cargo run --release -- --listen 0.0.0.0:10000 --bootstrap

# Run additional instance (use any port in range 10000-10999)
cargo run --release -- --listen 0.0.0.0:10001

# Run as regular node connecting to bootstrap
cargo run --release -- --listen 0.0.0.0:10000 --connect saorsa-2.saorsalabs.com:10000

# Run with debug logging
RUST_LOG=debug cargo run --release -- --listen 0.0.0.0:10000

Code Standards

NO PANICS IN PRODUCTION CODE

  • No .unwrap() - Use ? operator or .ok_or()
  • No .expect() - Use .context() from anyhow
  • No panic!() - Return Result instead
  • Exception: Test code may use these for assertions

Payment Verification Policy

Payment verification is always on — there is no way to disable it.

  • All new chunk storage requires EVM payment verification on Arbitrum
  • There is no --disable-payment-verification flag or enabled config field
  • rewards_address is required — node startup fails without one
  • Previously-paid chunks are cached and do not require re-verification
  • Test code bypasses EVM by pre-populating the cache via PaymentVerifier::cache_insert() (only available behind #[cfg(test)] or the test-utils feature)

See src/payment/verifier.rs for implementation details.


CRITICAL: Autonomi Network Infrastructure & Port Isolation

Infrastructure Documentation

Full infrastructure documentation is available at: docs/infrastructure/INFRASTRUCTURE.md

This includes:

  • All 9 VPS nodes across 3 cloud providers (DigitalOcean, Hetzner, Vultr)
  • Bootstrap node endpoints and IP addresses
  • Firewall configurations and SSH access
  • Systemd service templates

PORT ISOLATION - MANDATORY

Production ant-node instances use UDP port range 10000-10999 exclusively.

Service UDP Port Range Default Description
ant-quic 9000-9999 9000 QUIC transport layer
ant-node 10000-10999 10000 Core P2P network nodes (THIS PROJECT)
communitas 11000-11999 11000 Collaboration platform nodes
ant-node tests 20000-60000 random E2E test isolation (local only)

Note: The E2E test suite uses ports 20000-60000 with random allocation to prevent conflicts between parallel test runs and local development instances. Production deployments MUST use 10000-10999.

DO NOT DISTURB OTHER NETWORKS

When testing or developing ant-node:

  1. ONLY use ports 10000-10999 for ant-node services
  2. NEVER kill processes on ports 9000-9999 or 11000-11999
  3. NEVER restart services outside our port range
  4. NEVER modify firewall rules for other port ranges
# CORRECT - ant-node operations (within 10000-10999)
cargo run --release -- --listen 0.0.0.0:10000
cargo run --release -- --listen 0.0.0.0:10001  # Second instance OK
ssh root@saorsa-2.saorsalabs.com "systemctl restart ant-node-bootstrap"

# WRONG - Would disrupt other networks
ssh root@saorsa-2.saorsalabs.com "pkill -f ':9'"    # NEVER - matches ant-quic ports
ssh root@saorsa-2.saorsalabs.com "pkill -f ':11'"   # NEVER - matches communitas ports
ssh root@saorsa-2.saorsalabs.com "systemctl restart ant-quic-bootstrap"  # NOT OUR SERVICE

Bootstrap Endpoints (ant-node)

saorsa-2.saorsalabs.com:10000  (NYC - 142.93.199.50)
saorsa-3.saorsalabs.com:10000  (SFO - 147.182.234.192)

Before Any VPS Operations

  1. Verify you're targeting ports 10000-10999 only
  2. Double-check service names contain "ant-node"
  3. Never run broad pkill commands that could affect other services

Deploy New Binary

# Build release binary
cargo build --release

# Deploy to bootstrap node
scp target/release/ant-node root@saorsa-2.saorsalabs.com:/opt/ant-node/
ssh root@saorsa-2.saorsalabs.com "systemctl restart ant-node-bootstrap"