- ✅ Added
nvml-wrapper = "0.10"to Cargo.toml - ✅ Created
gpu-metricsfeature flag (enabled by default) - ✅ Feature integrates with CUDA feature for full GPU support
- ✅ Created
src/gpu/mod.rswith GPU tier classification - ✅ Created
src/gpu/nvml_monitor.rswith full NVML integration - ✅ Supports automatic fallback to mock data when NVML unavailable
- ✅ Detects TEE support (NVIDIA Confidential Computing on H100)
- ✅ Real-time metrics: utilization, temperature, VRAM, power draw
- ✅ Auto-classifies GPU tiers: Consumer, Professional, Enterprise, DataCenter
- ✅ Created
src/api/metrics_aggregator.rs - ✅ Aggregates data from 3 sources:
- Blockchain: Stake, reputation, rewards (placeholders for contract calls)
- Database: Job counts, earnings history, heartbeats
- System: Real GPU metrics via NVML
- ✅ Database queries implemented with sqlx
- ✅ APY calculation framework
- ✅ Uptime tracking based on heartbeats
- ✅ Updated
src/api/dashboard.rsto import MetricsAggregator - ✅ Added
metrics_aggregatorfield to DashboardApiState - 🔄 IN PROGRESS: Updating handlers to use real data
Need to replace mock data with MetricsAggregator calls:
File: src/api/dashboard.rs
Handlers to Update:
-
get_validator_status()- Lines 258-288- Replace hardcoded values with
metrics_aggregator.get_validator_metrics(address)
- Replace hardcoded values with
-
get_gpu_metrics()- Lines 291-319- Replace mock H100 data with
metrics_aggregator.get_gpu_metrics()
- Replace mock H100 data with
-
get_rewards_info()- Lines 318-332- Replace hardcoded rewards with
metrics_aggregator.get_rewards(address)
- Replace hardcoded rewards with
Challenge: Need wallet address from request context
- SDK passes address via headers:
X-Wallet-Address - Need to extract address in handlers
Once handlers are updated, need to implement real Starknet contract calls:
File: src/api/metrics_aggregator.rs
-
query_stake_info()- Line 312- Call
ProverStaking.get_stake(address) - Parse stake amount and tier from contract
- Call
-
query_reputation()- Line 322- Call
ReputationManager.get_reputation(address) - Return reputation score (0-1000)
- Call
-
query_onchain_rewards()- Line 330- Call
ProverStaking.get_pending_rewards(address) - Call
MiningRewards.get_claimable(address)if deployed
- Call
Implementation Notes:
- Use existing
StarknetClientfromself.starknet - Contract ABIs needed for these calls
- Error handling: Fall back to 0 values if contracts not deployed
- ✅ GPU metrics with NVML (real hardware detection)
- ✅ Database queries for jobs and earnings
- ✅ Mock data graceful fallback
- ✅ Type-safe Rust implementation
- 🔴 Stake amount (returns "0")
- 🔴 Reputation score (returns 0)
- 🔴 On-chain rewards (returns "0")
- Database heartbeats table
- Database reward_claims table
- GPU detection on systems without NVIDIA GPUs
- Contract addresses configuration
- Update dashboard.rs handlers to call MetricsAggregator
- Add address extraction from request headers
- Test endpoints return real GPU data
- Test database queries work
- Implement Starknet contract calls in MetricsAggregator
- Deploy or verify contract addresses
- Test full E2E flow: UI → API → Blockchain
- Update UI_BACKEND_INTEGRATION_GAPS.md with progress
- Need DATABASE_URL for sqlx compile-time checks (non-blocking)
- Need deployed contract addresses on Sepolia
- Need contract ABIs for Starknet calls
✅ All new modules compile successfully
⚠️ sqlx macros need DATABASE_URL (runtime OK)
⚠️ Some unused import warnings (pre-existing)
- ✅ Unit tests for GPU tier classification
- ✅ Unit tests for mock GPU creation
- ❌ Integration tests pending
- ❌ E2E tests pending
- ✅ Full rustdoc comments in all new modules
- ✅ Progress tracking in this file
- ✅ Integration gaps documented in UI_BACKEND_INTEGRATION_GAPS.md
- Phase 1a (GPU + Database): 80% complete
- Phase 1b (Blockchain): 0% complete
- Overall Phase 1: ~50% complete
ETA for Phase 1 completion: 4-6 hours remaining