[TSM.ID].[11031972] 3Z SWEEP: Fix 7 modules — xcu-tui(unused HashMap), xcu-rpc(invalid hex 0xXC), xcu-ouroboros(unused HashMap), xcu-labyrinth(borrow checker), xcu-qcg-wasm(unused Arc/Mutex), xcu-watermark(unused var), xcu-thread-weaver(unused var). VERVAL 2x ALL CLEAN.
This commit is contained in:
@@ -75,6 +75,13 @@ impl Labyrinth {
|
|||||||
|
|
||||||
/// Select route through the labyrinth
|
/// Select route through the labyrinth
|
||||||
pub fn build_route(&mut self, source: &str, destination: &str) -> Result<Vec<String>, LabyrinthError> {
|
pub fn build_route(&mut self, source: &str, destination: &str) -> Result<Vec<String>, 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<f64> = (0..node_count)
|
||||||
|
.map(|_| (self.next_random() % 100) as f64 * 0.3)
|
||||||
|
.collect();
|
||||||
|
|
||||||
let eligible: Vec<&LabyrinthNode> = self.nodes.values()
|
let eligible: Vec<&LabyrinthNode> = self.nodes.values()
|
||||||
.filter(|n| n.is_alive)
|
.filter(|n| n.is_alive)
|
||||||
.filter(|n| !self.avoid_countries.contains(&n.country))
|
.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())));
|
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());
|
let hop_count = hop_count.min(eligible.len());
|
||||||
|
|
||||||
// Score nodes: prefer high trust, low latency, diverse countries
|
// 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
|
let score = n.trust_score * 50.0
|
||||||
+ (1000.0 / (n.latency_ms as f64 + 1.0))
|
+ (1000.0 / (n.latency_ms as f64 + 1.0))
|
||||||
+ n.bandwidth_mbps as f64 * 0.1
|
+ n.bandwidth_mbps as f64 * 0.1
|
||||||
+ (self.next_random() % 100) as f64 * 0.3; // randomness
|
+ rand_component;
|
||||||
(*n, score)
|
(*n, score)
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
//! [TSM.ID].[11031972] -- Platform X Ecosystem
|
//! [TSM.ID].[11031972] -- Platform X Ecosystem
|
||||||
//! xcu-ouroboros -- Self-updating Binary Manager with OTA & Integrity
|
//! xcu-ouroboros -- Self-updating Binary Manager with OTA & Integrity
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum OuroborosError { VersionConflict(String), IntegrityFailed(String), RollbackFailed(String) }
|
pub enum OuroborosError { VersionConflict(String), IntegrityFailed(String), RollbackFailed(String) }
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
//! JIT-compile & execute WASM bytecode with sandboxed memory
|
//! JIT-compile & execute WASM bytecode with sandboxed memory
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum WasmError { CompileFailed(String), RuntimeError(String), MemoryError(String), LinkError(String) }
|
pub enum WasmError { CompileFailed(String), RuntimeError(String), MemoryError(String), LinkError(String) }
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub struct RpcFrame {
|
|||||||
pub error: Option<String>,
|
pub error: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAGIC: [u8; 2] = [0xXC, 0xU1]; // XCU magic
|
const MAGIC: [u8; 2] = [0xC0, 0x01]; // XCU magic bytes
|
||||||
|
|
||||||
impl RpcFrame {
|
impl RpcFrame {
|
||||||
pub fn request(id: u32, method: &str, params: Vec<RpcValue>) -> Self {
|
pub fn request(id: u32, method: &str, params: Vec<RpcValue>) -> Self {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ impl ThreadWeaver {
|
|||||||
|
|
||||||
/// Get queue stats
|
/// Get queue stats
|
||||||
pub fn stats(&self) -> Vec<(usize, u64, u64)> {
|
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) }
|
if let Ok(q) = q.lock() { (q.len(), q.processed, q.stolen_from) }
|
||||||
else { (0, 0, 0) }
|
else { (0, 0, 0) }
|
||||||
}).collect()
|
}).collect()
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
//! [TSM.ID].[11031972] -- Platform X Ecosystem
|
//! [TSM.ID].[11031972] -- Platform X Ecosystem
|
||||||
//! xcu-tui -- Terminal Dashboard for System Monitoring
|
//! xcu-tui -- Terminal Dashboard for System Monitoring
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ impl WatermarkEncoder {
|
|||||||
}
|
}
|
||||||
Ok(result)
|
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);
|
let extracted = Self::extract(watermarked, data.len(), strength);
|
||||||
match extracted { Ok(ext) => ext == data, Err(_) => false }
|
match extracted { Ok(ext) => ext == data, Err(_) => false }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user