uhash-prover 0.4.1

UniversalHash solver backends (CPU/GPU) without chain transport
Documentation
//! Unified solver trait for all backends (CPU/GPU).

use anyhow::Result;

/// Result of a successful proof search: (nonce, hash).
pub type ProofResult = Option<(u64, [u8; 32])>;

/// Backend-agnostic solver interface.
pub trait Solver {
    /// Human-readable backend name ("cpu", "cuda", "metal", etc.)
    fn backend_name(&self) -> &'static str;

    /// Recommend optimal lane count for this backend.
    fn recommended_lanes(&mut self, requested: usize) -> usize;

    /// Search for a valid proof in a batch of nonces starting at `start_nonce`.
    fn find_proof_batch(
        &mut self,
        header_without_nonce: &[u8],
        start_nonce: u64,
        lanes: usize,
        difficulty: u32,
    ) -> Result<ProofResult>;

    /// Run benchmark: hash `lanes` nonces starting from `start_nonce`.
    /// Returns number of hashes computed.
    fn benchmark_hashes(
        &mut self,
        header_without_nonce: &[u8],
        start_nonce: u64,
        lanes: usize,
    ) -> Result<usize>;
}