Skip to content

Commit d1ad2f5

Browse files
vmxcryptonemo
andauthored
fix: update cache clearing calls (#106)
* fix: update cache clearing calls Adapt to the changes in rust-fil-proofs. BREAKING CHANGE: `clear_cache()` and `clear_synthetic_proofs` no longer take the sector size as input. * feat: update rust-toolchain to 1.83.0 feat: point to later proofs master style: fix require clippy updates --------- Co-authored-by: nemo <[email protected]>
1 parent 0b5325e commit d1ad2f5

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ big-tests = []
2828
# This feature enables a fixed number of discarded rows for TreeR. The `FIL_PROOFS_ROWS_TO_DISCARD`
2929
# setting is ignored, no `TemporaryAux` file will be written.
3030
fixed-rows-to-discard = ["filecoin-proofs-v1/fixed-rows-to-discard", "storage-proofs-core/fixed-rows-to-discard"]
31+
32+
[patch.crates-io]
33+
filecoin-proofs = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
34+
fr32 = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
35+
filecoin-hashers = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
36+
storage-proofs-core = { git = "https://github.com/filecoin-project/rust-fil-proofs" }

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.70.0
1+
1.83.0

src/registry.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,8 @@ mod tests {
982982
}
983983

984984
fn test_porep_id_aux(rsp: &RegisteredSealProof) {
985+
use std::fmt::Write;
986+
985987
let expected_porep_id = match rsp {
986988
RegisteredSealProof::StackedDrg2KiBV1 => {
987989
"0000000000000000000000000000000000000000000000000000000000000000"
@@ -1044,11 +1046,10 @@ mod tests {
10441046
"1300000000000000000000000000000000000000000000000000000000000000"
10451047
}
10461048
};
1047-
let hex: String = rsp
1048-
.porep_id()
1049-
.iter()
1050-
.map(|x| format!("{:01$x}", x, 2))
1051-
.collect();
1049+
let hex: String = rsp.porep_id().iter().fold(String::new(), |mut output, x| {
1050+
let _ = write!(output, "{:01$x}", x, 2);
1051+
output
1052+
});
10521053

10531054
assert_eq!(expected_porep_id, &hex);
10541055
}

src/seal.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,13 @@ pub struct SealCommitPhase2Output {
330330
pub proof: Vec<u8>,
331331
}
332332

333-
/// Ensure that any persisted cached data for specified sector size is discarded.
333+
/// Ensure that any persisted cached data is discarded.
334334
///
335335
/// # Arguments
336336
///
337-
/// * `sector_size` - Sector size associated with cache data to clear.
338337
/// * `cache_path` - Path to directory where cached data is stored.
339-
pub fn clear_cache(sector_size: u64, cache_path: &Path) -> Result<()> {
340-
use filecoin_proofs_v1::clear_cache;
341-
342-
with_shape!(sector_size, clear_cache, cache_path)
338+
pub fn clear_cache(cache_path: &Path) -> Result<()> {
339+
filecoin_proofs_v1::clear_cache(cache_path)
343340
}
344341

345342
/// Generate and persist synthetic Merkle tree proofs for sector replica. Must be called with output from [`seal_pre_commit_phase2`].
@@ -424,12 +421,9 @@ fn generate_synth_proofs_inner<Tree: 'static + MerkleTreeTrait>(
424421
///
425422
/// # Arguments
426423
///
427-
/// * `sector_size` - Sector size associated with cache data to clear.
428424
/// * `cache_path` - Path to directory where cached data is stored.
429-
pub fn clear_synthetic_proofs(sector_size: u64, cache_path: &Path) -> Result<()> {
430-
use filecoin_proofs_v1::clear_synthetic_proofs;
431-
432-
with_shape!(sector_size, clear_synthetic_proofs, cache_path)
425+
pub fn clear_synthetic_proofs(cache_path: &Path) -> Result<()> {
426+
filecoin_proofs_v1::clear_synthetic_proofs(cache_path)
433427
}
434428

435429
/// First step in sector sealing process. Called before [`seal_pre_commit_phase2`].
@@ -1793,7 +1787,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
17931787
///
17941788
/// * `registered_proof` - Selected seal proof for this byte source.
17951789
/// * `source` - A readable source of unprocessed piece bytes. The piece's commitment will be
1796-
/// generated for the bytes read from the source plus any added padding.
1790+
/// generated for the bytes read from the source plus any added padding.
17971791
/// * `piece_size` - The number of unpadded user-bytes which can be read from source before EOF.
17981792
///
17991793
/// Returns piece commitment in [`PieceInfo`] struct.

0 commit comments

Comments
 (0)