Skip to content

Commit

Permalink
Deploying to gh-pages from @ d31fe47 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Oct 20, 2023
1 parent c94ad18 commit 8aa1c16
Show file tree
Hide file tree
Showing 22 changed files with 106 additions and 98 deletions.
16 changes: 5 additions & 11 deletions src/subspace_core_primitives/lib.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1150,9 +1150,6 @@
<a href="#1150" id="1150">1150</a>
<a href="#1151" id="1151">1151</a>
<a href="#1152" id="1152">1152</a>
<a href="#1153" id="1153">1153</a>
<a href="#1154" id="1154">1154</a>
<a href="#1155" id="1155">1155</a>
</pre></div><pre class="rust"><code><span class="comment">// Copyright (C) 2021 Subspace Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -1218,7 +1215,7 @@
<span class="kw">pub use </span>segments::{
ArchivedHistorySegment, HistorySize, RecordedHistorySegment, SegmentCommitment, SegmentIndex,
};
<span class="kw">use </span>uint::static_assertions::const_assert;
<span class="kw">use </span>static_assertions::{const_assert, const_assert_eq};

<span class="comment">// Refuse to compile on lower than 32-bit platforms
</span><span class="macro">const_assert!</span>(core::mem::size_of::&lt;usize&gt;() &gt;= core::mem::size_of::&lt;u32&gt;());
Expand Down Expand Up @@ -2099,13 +2096,10 @@
<span class="doccomment">/// Index of s-bucket within sector to be audited
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>s_bucket_audit_index(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; SBucket {
SBucket::from(
u16::try_from(U256::from_le_bytes(<span class="self">self</span>.<span class="number">0</span>) % U256::from(Record::NUM_S_BUCKETS <span class="kw">as </span>u32))
.expect(
<span class="string">&quot;Remainder of division by Record::NUM_S_BUCKETS is statically guaranteed \
to fit into SBucket; qed&quot;</span>,
),
)
<span class="comment">// As long as number of s-buckets is 2^16, we can pick first two bytes instead of actually
// calculating `U256::from_le_bytes(self.0) % Record::NUM_S_BUCKETS)`
</span><span class="macro">const_assert_eq!</span>(Record::NUM_S_BUCKETS, <span class="number">1 </span>&lt;&lt; u16::BITS <span class="kw">as </span>usize);
SBucket::from(u16::from_le_bytes([<span class="self">self</span>.<span class="number">0</span>[<span class="number">0</span>], <span class="self">self</span>.<span class="number">0</span>[<span class="number">1</span>]]))
}
}

Expand Down
18 changes: 13 additions & 5 deletions src/subspace_farmer_components/auditing.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@
<a href="#425" id="425">425</a>
<a href="#426" id="426">426</a>
<a href="#427" id="427">427</a>
<a href="#428" id="428">428</a>
<a href="#429" id="429">429</a>
<a href="#430" id="430">430</a>
<a href="#431" id="431">431</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::proving::SolutionCandidates;
<span class="kw">use </span><span class="kw">crate</span>::sector::{sector_size, SectorContentsMap, SectorMetadataChecksummed};
<span class="kw">use crate</span>::{ReadAt, ReadAtAsync, ReadAtOffset, ReadAtSync};
Expand Down Expand Up @@ -493,7 +497,7 @@
s_bucket_audit_index,
s_bucket_audit_size,
s_bucket_audit_offset_in_sector,
} = collect_sector_auditing_details(public_key, global_challenge, sector_metadata);
} = collect_sector_auditing_details(public_key.hash(), global_challenge, sector_metadata);

<span class="kw">let </span><span class="kw-2">mut </span>s_bucket = <span class="macro">vec!</span>[<span class="number">0</span>; s_bucket_audit_size];
<span class="kw">let </span>read_s_bucket_result = sector.read_at(<span class="kw-2">&amp;mut </span>s_bucket, s_bucket_audit_offset_in_sector);
Expand Down Expand Up @@ -541,12 +545,14 @@
<span class="kw">where
</span>Plot: ReadAtSync + <span class="lifetime">&#39;a</span>,
{
<span class="kw">let </span>public_key_hash = public_key.hash();

<span class="comment">// Create auditing info for all sectors in parallel
</span>sectors_metadata
.par_iter()
.map(|sector_metadata| {
(
collect_sector_auditing_details(public_key, global_challenge, sector_metadata),
collect_sector_auditing_details(public_key_hash, global_challenge, sector_metadata),
sector_metadata,
)
})
Expand Down Expand Up @@ -619,12 +625,14 @@
<span class="kw">where
</span>Plot: ReadAtAsync + <span class="lifetime">&#39;a</span>,
{
<span class="kw">let </span>public_key_hash = public_key.hash();

<span class="comment">// Create auditing info for all sectors in parallel and allocate s-buckets
</span><span class="kw">let </span><span class="kw-2">mut </span>audit_preparation = sectors_metadata
.par_iter()
.map(|sector_metadata| {
(
collect_sector_auditing_details(public_key, global_challenge, sector_metadata),
collect_sector_auditing_details(public_key_hash, global_challenge, sector_metadata),
sector_metadata,
)
})
Expand Down Expand Up @@ -745,11 +753,11 @@
}

<span class="kw">fn </span>collect_sector_auditing_details(
public_key: <span class="kw-2">&amp;</span>PublicKey,
public_key_hash: Blake3Hash,
global_challenge: <span class="kw-2">&amp;</span>Blake3Hash,
sector_metadata: <span class="kw-2">&amp;</span>SectorMetadataChecksummed,
) -&gt; SectorAuditingDetails {
<span class="kw">let </span>sector_id = SectorId::new(public_key.hash(), sector_metadata.sector_index);
<span class="kw">let </span>sector_id = SectorId::new(public_key_hash, sector_metadata.sector_index);

<span class="kw">let </span>sector_slot_challenge = sector_id.derive_sector_slot_challenge(global_challenge);
<span class="kw">let </span>s_bucket_audit_index = sector_slot_challenge.s_bucket_audit_index();
Expand Down
6 changes: 6 additions & 0 deletions src/subspace_farmer_components/sector.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@
<a href="#590" id="590">590</a>
<a href="#591" id="591">591</a>
<a href="#592" id="592">592</a>
<a href="#593" id="593">593</a>
<a href="#594" id="594">594</a>
<a href="#595" id="595">595</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
<span class="kw">use </span>parity_scale_codec::{Decode, Encode};
<span class="kw">use </span>rayon::prelude::<span class="kw-2">*</span>;
Expand All @@ -607,13 +610,15 @@
<span class="doccomment">/// Size of the part of the plot containing record chunks (s-buckets).
///
/// Total size of the plot can be computed with [`sector_size()`].
</span><span class="attr">#[inline]
</span><span class="kw">pub const fn </span>sector_record_chunks_size(pieces_in_sector: u16) -&gt; usize {
pieces_in_sector <span class="kw">as </span>usize * Record::SIZE
}

<span class="doccomment">/// Size of the part of the plot containing record metadata.
///
/// Total size of the plot can be computed with [`sector_size()`].
</span><span class="attr">#[inline]
</span><span class="kw">pub const fn </span>sector_record_metadata_size(pieces_in_sector: u16) -&gt; usize {
pieces_in_sector <span class="kw">as </span>usize * RecordMetadata::encoded_size()
}
Expand All @@ -625,6 +630,7 @@
/// [`sector_record_chunks_size()`] and size of record commitments and witnesses with
/// [`sector_record_metadata_size()`]. This function just combines those three together for
/// convenience.
</span><span class="attr">#[inline]
</span><span class="kw">pub const fn </span>sector_size(pieces_in_sector: u16) -&gt; usize {
sector_record_chunks_size(pieces_in_sector)
+ sector_record_metadata_size(pieces_in_sector)
Expand Down
4 changes: 2 additions & 2 deletions subspace_core_primitives/enum.NonEmptyVecErr.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion subspace_core_primitives/index.html

Large diffs are not rendered by default.

Loading

0 comments on commit 8aa1c16

Please sign in to comment.