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_nodeLogging
Log Levels
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=disabledModel not found → Check
--model-pathGateway 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
Full error message and backtrace
Relevant log output
Steps to reproduce
Configuration (sanitized)
Environment details
Next Steps
Testing - Run tests
Troubleshooting - Common issues
FAQ - Frequently asked questions
Last updated
