diff --git a/components/equihash/src/tromp.rs b/components/equihash/src/tromp.rs index af53b4a596..37daa6d741 100644 --- a/components/equihash/src/tromp.rs +++ b/components/equihash/src/tromp.rs @@ -44,6 +44,7 @@ extern "C" { /// /// This function uses unsafe code for FFI into the tromp solver. #[allow(unsafe_code)] +#[allow(clippy::print_stdout)] unsafe fn worker(eq: *mut CEqui, p: Params, curr_state: &State) -> Vec> { // SAFETY: caller must supply a valid `eq` instance. // @@ -70,6 +71,7 @@ unsafe fn worker(eq: *mut CEqui, p: Params, curr_state: &State) -> Vec> let nsols = equi_nsols(eq); let sols = equi_sols(eq); let solution_len = 1 << p.k; + //println!("{nsols} solutions of length {solution_len} at {sols:?}"); // SAFETY: // - caller must supply a `p` instance that matches the hard-coded values in the C code. @@ -77,6 +79,13 @@ unsafe fn worker(eq: *mut CEqui, p: Params, curr_state: &State) -> Vec> // - this slice is a shared ref to the memory in a valid `eq` instance supplied by the caller. let solutions: &[u32] = slice::from_raw_parts(sols, nsols * solution_len); + /* + println!( + "{nsols} solutions of length {solution_len} as a slice of length {:?}", + solutions.len() + ); + */ + let mut chunks = solutions.chunks_exact(solution_len); // SAFETY: @@ -98,6 +107,17 @@ unsafe fn worker(eq: *mut CEqui, p: Params, curr_state: &State) -> Vec> solutions }; + /* + println!( + "{} solutions as cloned vectors of length {:?}", + solutions.len(), + solutions + .iter() + .map(|solution| solution.len()) + .collect::>() + ); + */ + solutions } diff --git a/components/equihash/tromp/equi_miner.c b/components/equihash/tromp/equi_miner.c index 17dfb89373..a435e5c513 100644 --- a/components/equihash/tromp/equi_miner.c +++ b/components/equihash/tromp/equi_miner.c @@ -355,8 +355,15 @@ typedef struct equi equi; listindices1(eq, WK, t, prf); // assume WK odd qsort(prf, PROOFSIZE, sizeof(u32), &compu32); for (u32 i=1; i proof[%d], actual: %d <= %d\n", + i, i-1, prf[i], prf[i-1] + ); + */ return; + } #ifdef EQUIHASH_TROMP_ATOMIC u32 soli = std::atomic_fetch_add_explicit(&eq->nsols, 1U, std::memory_order_relaxed); #else @@ -678,7 +685,7 @@ nc++, candidate(eq, tree_from_bid(bucketid, s0, s1)); } } } -//printf(" %d candidates ", nc); +//printf(" %d candidates\n", nc); } size_t equi_nsols(const equi *eq) {