Debugging

Complete guide for debugging NCN Network services and issues.


Quick Reference

# Enable debug logging
export RUST_LOG=debug
export RUST_BACKTRACE=1

# Run with debug output
cargo run --bin gateway_node

Logging

Log Levels

Level
Use For

error

Critical failures

warn

Warnings, non-critical issues

info

General operational info (default)

debug

Detailed debugging info

trace

Very detailed tracing

Configure Logging

Logging in Code


Backtraces

Enable Backtraces

Example Backtrace


Debugging Tools

GDB/LLDB

VS Code Debugging

.vscode/launch.json:

rust-analyzer

Enable in VS Code for inline error checking:


Network Debugging

gRPC Debugging

HTTP Debugging

WebSocket Debugging

Network Capture


Component-Specific Debugging

Gateway Debugging

Common Issues:

  • Registry connection failed → Check registry is running

  • No compute nodes → Check compute node registration

  • Payment failed → Check blockchain RPC connectivity

Compute Node Debugging

Common Issues:

  • Sandbox failed → Use SANDBOX_MODE=disabled

  • Model not found → Check --model-path

  • Gateway connection → Verify gateway is running

Registry Debugging

Common Issues:

  • No validators → Check validator registration

  • P2P bootstrap → Verify bootstrap node addresses

  • Consensus failed → Check minimum validators


Memory Debugging

Detect Memory Issues

Heap Profiling


Performance Debugging

CPU Profiling

Timing Analysis


Contract Debugging

Foundry Debugging

Trace Transactions


Log Analysis

Search Logs

Structured Logging

Enable JSON logging for analysis:


Common Debug Scenarios

Connection Issues

Request Not Processing

Signature Verification Failures

Blockchain Issues


Debug Checklist

Before Reporting Issues

Information to Collect

  1. Full error message and backtrace

  2. Relevant log output

  3. Steps to reproduce

  4. Configuration (sanitized)

  5. Environment details


Next Steps

Last updated