diff --git a/xcom-ultra/xcu-labyrinth/src/lib.rs b/xcom-ultra/xcu-labyrinth/src/lib.rs index 7131153..64b4856 100644 --- a/xcom-ultra/xcu-labyrinth/src/lib.rs +++ b/xcom-ultra/xcu-labyrinth/src/lib.rs @@ -75,6 +75,13 @@ impl Labyrinth { /// Select route through the labyrinth pub fn build_route(&mut self, source: &str, destination: &str) -> Result, LabyrinthError> { + // Pre-compute random values before borrowing self.nodes + let hop_rand = self.next_random(); + let node_count = self.nodes.len(); + let rand_scores: Vec = (0..node_count) + .map(|_| (self.next_random() % 100) as f64 * 0.3) + .collect(); + let eligible: Vec<&LabyrinthNode> = self.nodes.values() .filter(|n| n.is_alive) .filter(|n| !self.avoid_countries.contains(&n.country)) @@ -85,15 +92,16 @@ impl Labyrinth { return Err(LabyrinthError::NoRoute(format!("Need {} hops, only {} nodes", self.min_hops, eligible.len()))); } - let hop_count = self.min_hops + (self.next_random() as usize % (self.max_hops - self.min_hops + 1)); + let hop_count = self.min_hops + (hop_rand as usize % (self.max_hops - self.min_hops + 1)); let hop_count = hop_count.min(eligible.len()); // Score nodes: prefer high trust, low latency, diverse countries - let mut scored: Vec<(&LabyrinthNode, f64)> = eligible.iter().map(|n| { + let mut scored: Vec<(&LabyrinthNode, f64)> = eligible.iter().enumerate().map(|(i, n)| { + let rand_component = rand_scores.get(i).copied().unwrap_or(0.0); let score = n.trust_score * 50.0 + (1000.0 / (n.latency_ms as f64 + 1.0)) + n.bandwidth_mbps as f64 * 0.1 - + (self.next_random() % 100) as f64 * 0.3; // randomness + + rand_component; (*n, score) }).collect(); diff --git a/xcom-ultra/xcu-ouroboros/src/lib.rs b/xcom-ultra/xcu-ouroboros/src/lib.rs index 19e08bf..4c43d5f 100644 --- a/xcom-ultra/xcu-ouroboros/src/lib.rs +++ b/xcom-ultra/xcu-ouroboros/src/lib.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] //! [TSM.ID].[11031972] -- Platform X Ecosystem //! xcu-ouroboros -- Self-updating Binary Manager with OTA & Integrity -use std::collections::HashMap; #[derive(Debug)] pub enum OuroborosError { VersionConflict(String), IntegrityFailed(String), RollbackFailed(String) } diff --git a/xcom-ultra/xcu-qcg-wasm/src/lib.rs b/xcom-ultra/xcu-qcg-wasm/src/lib.rs index 0f5596b..ea12639 100644 --- a/xcom-ultra/xcu-qcg-wasm/src/lib.rs +++ b/xcom-ultra/xcu-qcg-wasm/src/lib.rs @@ -5,7 +5,6 @@ //! JIT-compile & execute WASM bytecode with sandboxed memory use std::collections::HashMap; -use std::sync::{Arc, Mutex}; #[derive(Debug)] pub enum WasmError { CompileFailed(String), RuntimeError(String), MemoryError(String), LinkError(String) } diff --git a/xcom-ultra/xcu-rpc/src/lib.rs b/xcom-ultra/xcu-rpc/src/lib.rs index 9bff6a1..7fca271 100644 --- a/xcom-ultra/xcu-rpc/src/lib.rs +++ b/xcom-ultra/xcu-rpc/src/lib.rs @@ -27,7 +27,7 @@ pub struct RpcFrame { pub error: Option, } -const MAGIC: [u8; 2] = [0xXC, 0xU1]; // XCU magic +const MAGIC: [u8; 2] = [0xC0, 0x01]; // XCU magic bytes impl RpcFrame { pub fn request(id: u32, method: &str, params: Vec) -> Self { diff --git a/xcom-ultra/xcu-thread-weaver/src/lib.rs b/xcom-ultra/xcu-thread-weaver/src/lib.rs index db3af5c..40f28f2 100644 --- a/xcom-ultra/xcu-thread-weaver/src/lib.rs +++ b/xcom-ultra/xcu-thread-weaver/src/lib.rs @@ -76,7 +76,7 @@ impl ThreadWeaver { /// Get queue stats pub fn stats(&self) -> Vec<(usize, u64, u64)> { - self.queues.iter().enumerate().map(|(i, q)| { + self.queues.iter().enumerate().map(|(_i, q)| { if let Ok(q) = q.lock() { (q.len(), q.processed, q.stolen_from) } else { (0, 0, 0) } }).collect() diff --git a/xcom-ultra/xcu-tui/src/lib.rs b/xcom-ultra/xcu-tui/src/lib.rs index fb72f02..6de09b7 100644 --- a/xcom-ultra/xcu-tui/src/lib.rs +++ b/xcom-ultra/xcu-tui/src/lib.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] //! [TSM.ID].[11031972] -- Platform X Ecosystem //! xcu-tui -- Terminal Dashboard for System Monitoring -use std::collections::HashMap; use std::fmt::Write; #[derive(Debug)] diff --git a/xcom-ultra/xcu-watermark/src/lib.rs b/xcom-ultra/xcu-watermark/src/lib.rs index 37c7ef7..3e5443a 100644 --- a/xcom-ultra/xcu-watermark/src/lib.rs +++ b/xcom-ultra/xcu-watermark/src/lib.rs @@ -38,7 +38,7 @@ impl WatermarkEncoder { } Ok(result) } - pub fn verify(original: &[u8], watermarked: &[u8], data: &[u8], strength: EmbedStrength) -> bool { + pub fn verify(_original: &[u8], watermarked: &[u8], data: &[u8], strength: EmbedStrength) -> bool { let extracted = Self::extract(watermarked, data.len(), strength); match extracted { Ok(ext) => ext == data, Err(_) => false } }