Skip to content

Commit

Permalink
chore: fix building master branch
Browse files Browse the repository at this point in the history
The current build fails due to:

error: package `home v0.5.11` cannot be built because it requires rustc 1.81
or newer, while the currently active rustc version is 1.70.0

This commit increases the Rust version from 1.70.0 to 1.81.0.

Also fix most of the Clippy errors. One about an `Arc` is still there as a
fix is non-trivial, needs proper testing and hence deserves a separate PR.
  • Loading branch information
vmx committed Jan 3, 2025
1 parent 47d71fd commit 8ee4f89
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 16 deletions.
1 change: 1 addition & 0 deletions fr32/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub enum Error {
/// Invariants:
/// - Value of each 32-byte chunks MUST represent valid Frs.
/// - Total length must be a multiple of 32.
///
/// That is to say: each 32-byte chunk taken alone must be a valid Fr32.
pub type Fr32Vec = Vec<u8>;

Expand Down
8 changes: 4 additions & 4 deletions fr32/src/padding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,14 @@ need to handle the potential bit-level misalignments:
// offset and num_bytes are based on the unpadded data, so
// if [0, 1, ..., 255] was the original unpadded data, offset 3 and len 4 would return
// [3, 4, 5, 6].
pub fn write_unpadded<W: ?Sized>(
pub fn write_unpadded<W>(
source: &[u8],
target: &mut W,
offset: usize,
len: usize,
) -> io::Result<usize>
where
W: Write,
W: Write + ?Sized,
{
// Check that there's actually `len` raw data bytes encoded inside
// `source` starting at `offset`.
Expand Down Expand Up @@ -630,15 +630,15 @@ The reader will generally operate with bit precision, even if the padded
layout is byte-aligned (no extra bits) the data inside it isn't (since
we pad at the bit-level).
**/
fn write_unpadded_aux<W: ?Sized>(
fn write_unpadded_aux<W>(
padding_map: &PaddingMap,
source: &[u8],
target: &mut W,
write_pos: usize,
max_write_size: usize,
) -> io::Result<usize>
where
W: Write,
W: Write + ?Sized,
{
// Position of the reader in the padded bit stream layout, deduced from
// the position of the writer (`write_pos`) in the raw data layout.
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.70.0
1.81.0
5 changes: 1 addition & 4 deletions storage-proofs-core/src/gadgets/insertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,7 @@ pub fn pick<Scalar: PrimeField, CS: ConstraintSystem<Scalar>>(
condition: &Boolean,
a: &AllocatedNum<Scalar>,
b: &AllocatedNum<Scalar>,
) -> Result<AllocatedNum<Scalar>, SynthesisError>
where
CS: ConstraintSystem<Scalar>,
{
) -> Result<AllocatedNum<Scalar>, SynthesisError> {
let c = AllocatedNum::alloc(cs.namespace(|| "pick result"), || {
if condition
.get_value()
Expand Down
2 changes: 1 addition & 1 deletion storage-proofs-core/src/parameter_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ where
let param_identifier = pub_params.identifier();
info!("parameter set identifier for cache: {}", param_identifier);
let mut hasher = Sha256::default();
hasher.update(&param_identifier.into_bytes());
hasher.update(param_identifier.into_bytes());
let circuit_hash = hasher.finalize();
format!(
"{}-{:02x}",
Expand Down
1 change: 1 addition & 0 deletions storage-proofs-core/src/test_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub fn setup_replica(data: &[u8], replica_path: &Path) -> MmapMut {
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(replica_path)
.expect("Failed to create replica");
f.write_all(data).expect("Failed to write data to replica");
Expand Down
1 change: 1 addition & 0 deletions storage-proofs-porep/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fn main() {
println!("cargo::rustc-check-cfg=cfg(nightly)");
cfg_if_nightly()
}

Expand Down
11 changes: 9 additions & 2 deletions storage-proofs-porep/src/stacked/vanilla/cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::{BTreeMap, HashSet};
use std::fmt::Write;
use std::fs::{remove_file, File};
use std::io;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -250,7 +251,10 @@ impl ParentCache {
drop(data);

let hash = hasher.finalize();
digest_hex = hash.iter().map(|x| format!("{:01$x}", x, 2)).collect();
digest_hex = hash.iter().fold(String::new(), |mut output, x| {
let _write_never_fails = write!(output, "{:01$x}", x, 2);
output
});

info!(
"[open] parent cache: calculated consistency digest: {:?}",
Expand Down Expand Up @@ -343,7 +347,10 @@ impl ParentCache {
let mut hasher = Sha256::new();
hasher.update(&data);
let hash = hasher.finalize();
digest_hex = hash.iter().map(|x| format!("{:01$x}", x, 2)).collect();
digest_hex = hash.iter().fold(String::new(), |mut output, x| {
let _write_never_fails = write!(output, "{:01$x}", x, 2);
output
});
info!(
"[generate] parent cache: generated consistency digest: {:?}",
digest_hex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ pub fn create_labels_for_encoding<
// This could fail, but we will ignore the error if so.
// It will be logged as a warning by `bind_core`.
debug!("binding core in main thread");
group.get(0).map(|core_index| bind_core(*core_index))
group.first().map(|core_index| bind_core(*core_index))
});

// NOTE: this means we currently keep 2x sector size around, to improve speed
Expand Down Expand Up @@ -563,7 +563,7 @@ pub fn create_labels_for_decoding<Tree: 'static + MerkleTreeTrait, T: AsRef<[u8]
// This could fail, but we will ignore the error if so.
// It will be logged as a warning by `bind_core`.
debug!("binding core in main thread");
group.get(0).map(|core_index| bind_core(*core_index))
group.first().map(|core_index| bind_core(*core_index))
});

// NOTE: this means we currently keep 2x sector size around, to improve speed
Expand Down
5 changes: 3 additions & 2 deletions storage-proofs-porep/src/stacked/vanilla/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,11 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
t_aux.synth_proofs_path(),
partition_count,
)
.map_err(|error| {
.inspect_err(|_| {
info!(
"failed to read porep proofs from synthetic proofs file: {:?}",
t_aux.synth_proofs_path(),
);
error
})
}
}
Expand Down Expand Up @@ -1503,6 +1502,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
);
let mut f = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&tree_r_last_path)
.expect("failed to open file for tree_r_last");
Expand Down Expand Up @@ -1912,6 +1912,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
);
let mut f = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&tree_r_last_path)
.expect("failed to open file for tree_r_last");
Expand Down

0 comments on commit 8ee4f89

Please sign in to comment.