Skip to content

Commit dfd8448

Browse files
committed
chore: fix master branch
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.
1 parent 47d71fd commit dfd8448

File tree

10 files changed

+24
-16
lines changed

10 files changed

+24
-16
lines changed

fr32/src/convert.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub enum Error {
1212
/// Invariants:
1313
/// - Value of each 32-byte chunks MUST represent valid Frs.
1414
/// - Total length must be a multiple of 32.
15+
///
1516
/// That is to say: each 32-byte chunk taken alone must be a valid Fr32.
1617
pub type Fr32Vec = Vec<u8>;
1718

fr32/src/padding.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,14 @@ need to handle the potential bit-level misalignments:
563563
// offset and num_bytes are based on the unpadded data, so
564564
// if [0, 1, ..., 255] was the original unpadded data, offset 3 and len 4 would return
565565
// [3, 4, 5, 6].
566-
pub fn write_unpadded<W: ?Sized>(
566+
pub fn write_unpadded<W>(
567567
source: &[u8],
568568
target: &mut W,
569569
offset: usize,
570570
len: usize,
571571
) -> io::Result<usize>
572572
where
573-
W: Write,
573+
W: Write + ?Sized,
574574
{
575575
// Check that there's actually `len` raw data bytes encoded inside
576576
// `source` starting at `offset`.
@@ -630,15 +630,15 @@ The reader will generally operate with bit precision, even if the padded
630630
layout is byte-aligned (no extra bits) the data inside it isn't (since
631631
we pad at the bit-level).
632632
**/
633-
fn write_unpadded_aux<W: ?Sized>(
633+
fn write_unpadded_aux<W>(
634634
padding_map: &PaddingMap,
635635
source: &[u8],
636636
target: &mut W,
637637
write_pos: usize,
638638
max_write_size: usize,
639639
) -> io::Result<usize>
640640
where
641-
W: Write,
641+
W: Write + ?Sized,
642642
{
643643
// Position of the reader in the padded bit stream layout, deduced from
644644
// the position of the writer (`write_pos`) in the raw data layout.

rust-toolchain

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

storage-proofs-core/src/gadgets/insertion.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,7 @@ pub fn pick<Scalar: PrimeField, CS: ConstraintSystem<Scalar>>(
321321
condition: &Boolean,
322322
a: &AllocatedNum<Scalar>,
323323
b: &AllocatedNum<Scalar>,
324-
) -> Result<AllocatedNum<Scalar>, SynthesisError>
325-
where
326-
CS: ConstraintSystem<Scalar>,
327-
{
324+
) -> Result<AllocatedNum<Scalar>, SynthesisError> {
328325
let c = AllocatedNum::alloc(cs.namespace(|| "pick result"), || {
329326
if condition
330327
.get_value()

storage-proofs-core/src/parameter_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ where
249249
let param_identifier = pub_params.identifier();
250250
info!("parameter set identifier for cache: {}", param_identifier);
251251
let mut hasher = Sha256::default();
252-
hasher.update(&param_identifier.into_bytes());
252+
hasher.update(param_identifier.into_bytes());
253253
let circuit_hash = hasher.finalize();
254254
format!(
255255
"{}-{:02x}",

storage-proofs-core/src/test_helper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub fn setup_replica(data: &[u8], replica_path: &Path) -> MmapMut {
99
.read(true)
1010
.write(true)
1111
.create(true)
12+
.truncate(true)
1213
.open(replica_path)
1314
.expect("Failed to create replica");
1415
f.write_all(data).expect("Failed to write data to replica");

storage-proofs-porep/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fn main() {
2+
println!("cargo::rustc-check-cfg=cfg(nightly)");
23
cfg_if_nightly()
34
}
45

storage-proofs-porep/src/stacked/vanilla/cache.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::collections::{BTreeMap, HashSet};
2+
use std::fmt::Write;
23
use std::fs::{remove_file, File};
34
use std::io;
45
use std::path::{Path, PathBuf};
@@ -250,7 +251,10 @@ impl ParentCache {
250251
drop(data);
251252

252253
let hash = hasher.finalize();
253-
digest_hex = hash.iter().map(|x| format!("{:01$x}", x, 2)).collect();
254+
digest_hex = hash.iter().fold(String::new(), |mut output, x| {
255+
let _write_never_fails = write!(output, "{:01$x}", x, 2);
256+
output
257+
});
254258

255259
info!(
256260
"[open] parent cache: calculated consistency digest: {:?}",
@@ -343,7 +347,10 @@ impl ParentCache {
343347
let mut hasher = Sha256::new();
344348
hasher.update(&data);
345349
let hash = hasher.finalize();
346-
digest_hex = hash.iter().map(|x| format!("{:01$x}", x, 2)).collect();
350+
digest_hex = hash.iter().fold(String::new(), |mut output, x| {
351+
let _write_never_fails = write!(output, "{:01$x}", x, 2);
352+
output
353+
});
347354
info!(
348355
"[generate] parent cache: generated consistency digest: {:?}",
349356
digest_hex

storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ pub fn create_labels_for_encoding<
465465
// This could fail, but we will ignore the error if so.
466466
// It will be logged as a warning by `bind_core`.
467467
debug!("binding core in main thread");
468-
group.get(0).map(|core_index| bind_core(*core_index))
468+
group.first().map(|core_index| bind_core(*core_index))
469469
});
470470

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

569569
// NOTE: this means we currently keep 2x sector size around, to improve speed

storage-proofs-porep/src/stacked/vanilla/proof.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,11 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
192192
t_aux.synth_proofs_path(),
193193
partition_count,
194194
)
195-
.map_err(|error| {
195+
.inspect_err(|_| {
196196
info!(
197197
"failed to read porep proofs from synthetic proofs file: {:?}",
198198
t_aux.synth_proofs_path(),
199199
);
200-
error
201200
})
202201
}
203202
}
@@ -1503,6 +1502,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
15031502
);
15041503
let mut f = OpenOptions::new()
15051504
.create(true)
1505+
.truncate(true)
15061506
.write(true)
15071507
.open(&tree_r_last_path)
15081508
.expect("failed to open file for tree_r_last");
@@ -1912,6 +1912,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
19121912
);
19131913
let mut f = OpenOptions::new()
19141914
.create(true)
1915+
.truncate(true)
19151916
.write(true)
19161917
.open(&tree_r_last_path)
19171918
.expect("failed to open file for tree_r_last");

0 commit comments

Comments
 (0)