Skip to content

fix: update cache clearing calls #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ big-tests = []
# This feature enables a fixed number of discarded rows for TreeR. The `FIL_PROOFS_ROWS_TO_DISCARD`
# setting is ignored, no `TemporaryAux` file will be written.
fixed-rows-to-discard = ["filecoin-proofs-v1/fixed-rows-to-discard", "storage-proofs-core/fixed-rows-to-discard"]

[patch.crates-io]
filecoin-proofs = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
fr32 = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
filecoin-hashers = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
storage-proofs-core = { git = "https://github.com/filecoin-project/rust-fil-proofs" }
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.70.0
1.83.0
11 changes: 6 additions & 5 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,8 @@ mod tests {
}

fn test_porep_id_aux(rsp: &RegisteredSealProof) {
use std::fmt::Write;

let expected_porep_id = match rsp {
RegisteredSealProof::StackedDrg2KiBV1 => {
"0000000000000000000000000000000000000000000000000000000000000000"
Expand Down Expand Up @@ -1044,11 +1046,10 @@ mod tests {
"1300000000000000000000000000000000000000000000000000000000000000"
}
};
let hex: String = rsp
.porep_id()
.iter()
.map(|x| format!("{:01$x}", x, 2))
.collect();
let hex: String = rsp.porep_id().iter().fold(String::new(), |mut output, x| {
let _ = write!(output, "{:01$x}", x, 2);
output
});

assert_eq!(expected_porep_id, &hex);
}
Expand Down
18 changes: 6 additions & 12 deletions src/seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,13 @@ pub struct SealCommitPhase2Output {
pub proof: Vec<u8>,
}

/// Ensure that any persisted cached data for specified sector size is discarded.
/// Ensure that any persisted cached data is discarded.
///
/// # Arguments
///
/// * `sector_size` - Sector size associated with cache data to clear.
/// * `cache_path` - Path to directory where cached data is stored.
pub fn clear_cache(sector_size: u64, cache_path: &Path) -> Result<()> {
use filecoin_proofs_v1::clear_cache;

with_shape!(sector_size, clear_cache, cache_path)
pub fn clear_cache(cache_path: &Path) -> Result<()> {
filecoin_proofs_v1::clear_cache(cache_path)
}

/// Generate and persist synthetic Merkle tree proofs for sector replica. Must be called with output from [`seal_pre_commit_phase2`].
Expand Down Expand Up @@ -424,12 +421,9 @@ fn generate_synth_proofs_inner<Tree: 'static + MerkleTreeTrait>(
///
/// # Arguments
///
/// * `sector_size` - Sector size associated with cache data to clear.
/// * `cache_path` - Path to directory where cached data is stored.
pub fn clear_synthetic_proofs(sector_size: u64, cache_path: &Path) -> Result<()> {
use filecoin_proofs_v1::clear_synthetic_proofs;

with_shape!(sector_size, clear_synthetic_proofs, cache_path)
pub fn clear_synthetic_proofs(cache_path: &Path) -> Result<()> {
filecoin_proofs_v1::clear_synthetic_proofs(cache_path)
}

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