Skip to content

Commit 5082839

Browse files
refactor: update dependencies and remove once_cell
1 parent 447b944 commit 5082839

File tree

4 files changed

+21
-82
lines changed

4 files changed

+21
-82
lines changed

rust/Cargo.lock

Lines changed: 10 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ storage-proofs = { git = "https://github.com/filecoin-project/rust-fil-proofs.gi
1818
bls-signatures = { git = "https://github.com/filecoin-project/bls-signatures.git", branch = "master" }
1919
byteorder = "1.2"
2020
drop_struct_macro_derive = "0.4.0"
21-
ff = "0.4"
21+
ff = "0.5"
2222
ffi-toolkit = "0.4.0"
2323
libc = "0.2.58"
2424
log = "0.4.7"
25-
once_cell = "0.2.4"
2625
paired = "0.16.0"
2726
pretty_env_logger = "0.3.0"
28-
rand = "0.4"
27+
rand = "0.7"
2928
rayon = "1"
3029
anyhow = "1.0.23"
3130

rust/src/bls/api.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::slice::from_raw_parts;
22

33
use bls_signatures::{
4-
aggregate as aggregate_sig, hash as hash_sig,
4+
aggregate as aggregate_sig,
5+
groupy::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError},
6+
hash as hash_sig,
57
paired::bls12_381::{G2Affine, G2Compressed},
6-
paired::GroupDecodingError,
7-
paired::{CurveAffine, CurveProjective, EncodedPoint},
88
verify as verify_sig, PrivateKey, PublicKey, Serialize, Signature,
99
};
1010
use libc;
11-
use rand::OsRng;
11+
use rand::rngs::OsRng;
1212

1313
use rayon::prelude::*;
1414

@@ -161,10 +161,8 @@ pub unsafe extern "C" fn verify(
161161
/// * `raw_seed_ptr` - pointer to a seed byte array
162162
#[no_mangle]
163163
pub unsafe extern "C" fn private_key_generate() -> *mut types::PrivateKeyGenerateResponse {
164-
let rng = &mut OsRng::new().expect("not enough randomness");
165-
166164
let mut raw_private_key: [u8; PRIVATE_KEY_BYTES] = [0; PRIVATE_KEY_BYTES];
167-
PrivateKey::generate(rng)
165+
PrivateKey::generate(&mut OsRng)
168166
.write_bytes(&mut raw_private_key.as_mut())
169167
.expect("preallocated");
170168

rust/src/proofs/api.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::mem;
22
use std::slice::from_raw_parts;
3+
use std::sync::Once;
34

45
use ffi_toolkit::{
56
c_str_to_pbuf, catch_panic_response, raw_ptr, rust_str_to_c_str, FCPResponseStatus,
@@ -10,7 +11,6 @@ use filecoin_proofs::{
1011
PoStConfig, SectorClass, SectorSize, UnpaddedByteIndex, UnpaddedBytesAmount,
1112
};
1213
use libc;
13-
use once_cell::sync::OnceCell;
1414
use storage_proofs::hasher::pedersen::PedersenDomain;
1515
use storage_proofs::hasher::Domain;
1616
use storage_proofs::sector::SectorId;
@@ -740,13 +740,12 @@ pub unsafe extern "C" fn destroy_generate_candidates_response(
740740
}
741741

742742
/// Protects the init off the logger.
743-
static LOG_INIT: OnceCell<bool> = OnceCell::new();
743+
static LOG_INIT: Once = Once::new();
744744

745745
/// Ensures the logger is initialized.
746746
fn init_log() {
747-
LOG_INIT.get_or_init(|| {
748-
let _ = pretty_env_logger::try_init_timed();
749-
true
747+
LOG_INIT.call_once(|| {
748+
pretty_env_logger::init_timed();
750749
});
751750
}
752751

0 commit comments

Comments
 (0)