mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Enable lints for tests only running optimized (#6664)
* enable linting optimized-only tests * fix automatically fixable or obvious lints * fix suspicious_open_options by removing manual options * fix `await_holding_lock`s * avoid failing lint due to now disabled `#[cfg(debug_assertions)]` * reduce future sizes in tests * fix accidently flipped assert logic * restore holding lock for web3signer download * Merge branch 'unstable' into lint-opt-tests
This commit is contained in:
@@ -58,7 +58,7 @@ fn eip2335_test_vector_scrypt() {
|
||||
}
|
||||
"#;
|
||||
|
||||
let keystore = decode_and_check_sk(&vector);
|
||||
let keystore = decode_and_check_sk(vector);
|
||||
assert_eq!(
|
||||
*keystore.uuid(),
|
||||
Uuid::parse_str("1d85ae20-35c5-4611-98e8-aa14a633906f").unwrap(),
|
||||
@@ -102,7 +102,7 @@ fn eip2335_test_vector_pbkdf() {
|
||||
}
|
||||
"#;
|
||||
|
||||
let keystore = decode_and_check_sk(&vector);
|
||||
let keystore = decode_and_check_sk(vector);
|
||||
assert_eq!(
|
||||
*keystore.uuid(),
|
||||
Uuid::parse_str("64625def-3331-4eea-ab6f-782f3ed16a83").unwrap(),
|
||||
|
||||
@@ -54,25 +54,17 @@ fn file() {
|
||||
let dir = tempdir().unwrap();
|
||||
let path = dir.path().join("keystore.json");
|
||||
|
||||
let get_file = || {
|
||||
File::options()
|
||||
.write(true)
|
||||
.read(true)
|
||||
.create(true)
|
||||
.open(path.clone())
|
||||
.expect("should create file")
|
||||
};
|
||||
|
||||
let keystore = KeystoreBuilder::new(&keypair, GOOD_PASSWORD, "".into())
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
keystore
|
||||
.to_json_writer(&mut get_file())
|
||||
.to_json_writer(File::create_new(&path).unwrap())
|
||||
.expect("should write to file");
|
||||
|
||||
let decoded = Keystore::from_json_reader(&mut get_file()).expect("should read from file");
|
||||
let decoded =
|
||||
Keystore::from_json_reader(File::open(&path).unwrap()).expect("should read from file");
|
||||
|
||||
assert_eq!(
|
||||
decoded.decrypt_keypair(BAD_PASSWORD).err().unwrap(),
|
||||
|
||||
@@ -132,20 +132,11 @@ fn file_round_trip() {
|
||||
let dir = tempdir().unwrap();
|
||||
let path = dir.path().join("keystore.json");
|
||||
|
||||
let get_file = || {
|
||||
File::options()
|
||||
.write(true)
|
||||
.read(true)
|
||||
.create(true)
|
||||
.open(path.clone())
|
||||
.expect("should create file")
|
||||
};
|
||||
|
||||
wallet
|
||||
.to_json_writer(&mut get_file())
|
||||
.to_json_writer(File::create_new(&path).unwrap())
|
||||
.expect("should write to file");
|
||||
|
||||
let decoded = Wallet::from_json_reader(&mut get_file()).unwrap();
|
||||
let decoded = Wallet::from_json_reader(File::open(&path).unwrap()).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
decoded.decrypt_seed(&[1, 2, 3]).err().unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user