Skip to content

Commit

Permalink
Merge pull request #3015 from autonomys/simpler-dummy-value
Browse files Browse the repository at this point in the history
Simpler dummy value
  • Loading branch information
nazar-pc committed Sep 12, 2024
2 parents c01c8e6 + 7776c92 commit d7b5806
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/subspace-farmer-components/src/plotting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,18 +670,17 @@ fn record_encoding<PosTable>(
if let Some(proof) = pos_table.find_proof(s_bucket.into()) {
(Simd::from(*record_chunk) ^ Simd::from(proof.hash())).to_array()
} else {
// We represent missing proof as invalid set of bits of Scalar (Scalar is 254-bit
// and must have two bits set to 0)
[u8::MAX; Scalar::FULL_BYTES]
// Dummy value indicating no proof
[0; Scalar::FULL_BYTES]
}
})
.collect_into_vec(chunks_scratch);
let num_successfully_encoded_chunks = chunks_scratch
.drain(..)
.zip(encoded_chunks_used.iter_mut())
.filter_map(|(maybe_encoded_chunk, mut encoded_chunk_used)| {
// All bits set means no proof, see above
if maybe_encoded_chunk == [u8::MAX; Scalar::FULL_BYTES] {
// No proof, see above
if maybe_encoded_chunk == [0; Scalar::FULL_BYTES] {
None
} else {
*encoded_chunk_used = true;
Expand Down

0 comments on commit d7b5806

Please sign in to comment.