Skip to content

Commit

Permalink
Merge pull request #2928 from asamuj/chore/remove-best-solution-distance
Browse files Browse the repository at this point in the history
Remove useless code
  • Loading branch information
nazar-pc authored Jul 17, 2024
2 parents 8048752 + 900b808 commit cc50899
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions crates/subspace-farmer-components/src/auditing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ pub struct AuditResult<'a, Sector> {
pub sector_index: SectorIndex,
/// Solution candidates
pub solution_candidates: SolutionCandidates<'a, Sector>,
/// Best solution distance found
pub best_solution_distance: SolutionRange,
}

/// Chunk candidate, contains one or more potentially winning audit chunks (in case chunk itself was
Expand Down Expand Up @@ -83,7 +81,7 @@ where
error,
})?;

let Some((winning_chunks, best_solution_distance)) = map_winning_chunks(
let Some(winning_chunks) = map_winning_chunks(
&s_bucket,
global_challenge,
&sector_slot_challenge,
Expand All @@ -102,7 +100,6 @@ where
sector_metadata,
winning_chunks.into(),
),
best_solution_distance,
}))
}

Expand Down Expand Up @@ -166,7 +163,7 @@ where
}));
}

let (winning_chunks, best_solution_distance) = map_winning_chunks(
let winning_chunks = map_winning_chunks(
&s_bucket,
global_challenge,
&sector_auditing_info.sector_slot_challenge,
Expand All @@ -183,7 +180,6 @@ where
sector_metadata,
winning_chunks.into(),
),
best_solution_distance,
}))
})
.collect()
Expand Down Expand Up @@ -239,7 +235,7 @@ fn map_winning_chunks(
global_challenge: &Blake3Hash,
sector_slot_challenge: &SectorSlotChallenge,
solution_range: SolutionRange,
) -> Option<(Vec<ChunkCandidate>, SolutionRange)> {
) -> Option<Vec<ChunkCandidate>> {
// Map all winning chunks
let mut chunk_candidates = s_bucket
.array_chunks::<{ Scalar::FULL_BYTES }>()
Expand All @@ -265,10 +261,5 @@ fn map_winning_chunks(

chunk_candidates.sort_by_key(|chunk_candidate| chunk_candidate.solution_distance);

let best_solution_distance = chunk_candidates
.first()
.expect("Not empty, checked above; qed")
.solution_distance;

Some((chunk_candidates, best_solution_distance))
Some(chunk_candidates)
}

0 comments on commit cc50899

Please sign in to comment.