Skip to content

Commit 05ac46b

Browse files
more fixes
1 parent 6f3a964 commit 05ac46b

File tree

10 files changed

+19
-37
lines changed

10 files changed

+19
-37
lines changed

dash/src/bip152.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ mod test {
504504
fn test_getblocktx_panic_when_encoding_u64_max() {
505505
serialize(&BlockTransactionsRequest {
506506
block_hash: Hash::all_zeros(),
507-
indexes: vec![core::u64::MAX],
507+
indexes: vec![u64::MAX],
508508
});
509509
}
510510
}

dash/src/blockdata/fee_rate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ crate::parse::impl_parse_str_from_int_infallible!(FeeRate, u64, from_sat_per_kwu
138138

139139
#[cfg(test)]
140140
mod tests {
141-
use std::u64;
142141

143142
use super::*;
144143

dash/src/consensus/encode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ mod tests {
14381438
.is_err()
14391439
);
14401440

1441-
let rand_io_err = Error::Io(io::Error::new(io::ErrorKind::Other, ""));
1441+
let rand_io_err = Error::Io(io::Error::other(""));
14421442

14431443
// Check serialization that `if len > MAX_VEC_SIZE {return err}` isn't inclusive,
14441444
// by making sure it fails with IO Error and not an `OversizedVectorAllocation` Error.
@@ -1466,7 +1466,7 @@ mod tests {
14661466
Vec<T>: Decodable,
14671467
T: fmt::Debug,
14681468
{
1469-
let rand_io_err = Error::Io(io::Error::new(io::ErrorKind::Other, ""));
1469+
let rand_io_err = Error::Io(io::Error::other(""));
14701470
let varint = VarInt((super::MAX_VEC_SIZE / mem::size_of::<T>()) as u64);
14711471
let err = deserialize::<Vec<T>>(&serialize(&varint)).unwrap_err();
14721472
assert_eq!(discriminant(&err), discriminant(&rand_io_err));
@@ -1617,7 +1617,7 @@ mod tests {
16171617
// Expect the write to succeed
16181618
let bytes_written = result.expect("Failed to write");
16191619
// Calculate expected bytes written
1620-
let expected_bytes = (size + 7) / 8;
1620+
let expected_bytes = size.div_ceil(8);
16211621
assert_eq!(
16221622
bytes_written, expected_bytes,
16231623
"Incorrect number of bytes written for bitset with size {}",

dash/src/crypto/sighash.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,6 @@ mod tests {
15631563

15641564
#[derive(serde::Deserialize)]
15651565
#[serde(rename_all = "camelCase")]
1566-
15671566
struct KpsGiven {
15681567
#[serde(with = "con_serde::With::<con_serde::Hex>")]
15691568
raw_unsigned_tx: Transaction,
@@ -1572,7 +1571,6 @@ mod tests {
15721571

15731572
#[derive(serde::Deserialize)]
15741573
#[serde(rename_all = "camelCase")]
1575-
15761574
struct KpsIntermediary {
15771575
hash_prevouts: sha256::Hash,
15781576
hash_outputs: sha256::Hash,
@@ -1583,7 +1581,6 @@ mod tests {
15831581

15841582
#[derive(serde::Deserialize)]
15851583
#[serde(rename_all = "camelCase")]
1586-
15871584
struct KpsInputSpendingGiven {
15881585
txin_index: usize,
15891586
internal_privkey: SecretKey,
@@ -1594,7 +1591,6 @@ mod tests {
15941591

15951592
#[derive(serde::Deserialize)]
15961593
#[serde(rename_all = "camelCase")]
1597-
15981594
struct KpsInputSpendingIntermediary {
15991595
internal_pubkey: XOnlyPublicKey,
16001596
tweak: TapTweakHash,
@@ -1606,14 +1602,12 @@ mod tests {
16061602

16071603
#[derive(serde::Deserialize)]
16081604
#[serde(rename_all = "camelCase")]
1609-
16101605
struct KpsInputSpendingExpected {
16111606
witness: Vec<String>,
16121607
}
16131608

16141609
#[derive(serde::Deserialize)]
16151610
#[serde(rename_all = "camelCase")]
1616-
16171611
struct KpsInputSpending {
16181612
given: KpsInputSpendingGiven,
16191613
intermediary: KpsInputSpendingIntermediary,
@@ -1623,7 +1617,6 @@ mod tests {
16231617

16241618
#[derive(serde::Deserialize)]
16251619
#[serde(rename_all = "camelCase")]
1626-
16271620
struct KeyPathSpending {
16281621
given: KpsGiven,
16291622
intermediary: KpsIntermediary,
@@ -1632,7 +1625,6 @@ mod tests {
16321625

16331626
#[derive(serde::Deserialize)]
16341627
#[serde(rename_all = "camelCase")]
1635-
16361628
struct TestData {
16371629
version: u64,
16381630
key_path_spending: Vec<KeyPathSpending>,

dash/src/merkle_tree/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ mod tests {
601601
let mut height = 1;
602602
let mut ntx = tx_count;
603603
while ntx > 1 {
604-
ntx = (ntx + 1) / 2;
604+
ntx = ntx.div_ceil(2);
605605
height += 1;
606606
}
607607

@@ -629,7 +629,7 @@ mod tests {
629629

630630
// Verify PartialMerkleTree's size guarantees
631631
let n = min(tx_count, 1 + match_txid1.len() * height);
632-
assert!(serialized.len() <= 10 + (258 * n + 7) / 8);
632+
assert!(serialized.len() <= 10 + (258 * n).div_ceil(8));
633633

634634
// Deserialize into a tester copy
635635
let pmt2: PartialMerkleTree =

dash/src/network/message.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ mod test {
994994
// Verify
995995
match decoded.payload {
996996
NetworkMessage::SendDsq(wants_dsq) => {
997-
assert_eq!(wants_dsq, true);
997+
assert!(wants_dsq);
998998
}
999999
_ => panic!("Expected SendDsq message"),
10001000
}
@@ -1015,7 +1015,7 @@ mod test {
10151015
// Verify
10161016
match decoded.payload {
10171017
NetworkMessage::SendDsq(wants_dsq) => {
1018-
assert_eq!(wants_dsq, false);
1018+
assert!(!wants_dsq);
10191019
}
10201020
_ => panic!("Expected SendDsq message"),
10211021
}

dash/src/pow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ mod tests {
14901490

14911491
let config = bincode::config::standard();
14921492

1493-
let bin_encoded = bincode::encode_to_vec(&uint, config).unwrap();
1493+
let bin_encoded = bincode::encode_to_vec(uint, config).unwrap();
14941494
let bin_decoded: U256 = bincode::decode_from_slice(&bin_encoded, config).unwrap().0;
14951495
assert_eq!(bin_decoded, uint);
14961496
};

dash/src/sml/masternode_list_engine/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,19 +1278,19 @@ mod tests {
12781278
let block_container_bytes: &[u8] =
12791279
include_bytes!("../../../tests/data/test_DML_diffs/block_container_2240504.dat");
12801280
let block_container: MasternodeListEngineBlockContainer =
1281-
bincode::decode_from_slice(&block_container_bytes, bincode::config::standard())
1281+
bincode::decode_from_slice(block_container_bytes, bincode::config::standard())
12821282
.expect("expected to decode")
12831283
.0;
12841284
let mn_list_diffs_bytes: &[u8] =
12851285
include_bytes!("../../../tests/data/test_DML_diffs/mnlistdiffs_2240504.dat");
12861286
let mn_list_diffs: BTreeMap<(CoreBlockHeight, CoreBlockHeight), MnListDiff> =
1287-
bincode::decode_from_slice(&mn_list_diffs_bytes, bincode::config::standard())
1287+
bincode::decode_from_slice(mn_list_diffs_bytes, bincode::config::standard())
12881288
.expect("expected to decode")
12891289
.0;
12901290
let qr_info_bytes: &[u8] =
12911291
include_bytes!("../../../tests/data/test_DML_diffs/qrinfo_2240504.dat");
12921292
let qr_info: QRInfo =
1293-
bincode::decode_from_slice(&qr_info_bytes, bincode::config::standard())
1293+
bincode::decode_from_slice(qr_info_bytes, bincode::config::standard())
12941294
.expect("expected to decode")
12951295
.0;
12961296

@@ -1403,10 +1403,9 @@ mod tests {
14031403

14041404
for (cycle_hash, quorums) in mn_list_engine.rotated_quorums_per_cycle.iter() {
14051405
for (i, quorum) in quorums.iter().enumerate() {
1406-
mn_list_engine.validate_quorum(quorum).expect(
1407-
format!("expected to validate quorum {} in cycle hash {}", i, cycle_hash)
1408-
.as_str(),
1409-
);
1406+
mn_list_engine.validate_quorum(quorum).unwrap_or_else(|_| {
1407+
panic!("expected to validate quorum {} in cycle hash {}", i, cycle_hash)
1408+
});
14101409
}
14111410
}
14121411
}

dash/src/sml/quorum_entry/validation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ mod tests {
134134
#[test]
135135
fn test_real_operator_key_compatibility() {
136136
// Real operator public keys from mainnet quorum at height 2300832
137-
let real_keys = vec![
137+
let real_keys = [
138138
hex!(
139139
"86e7ea34cc084da3ed0e90649ad444df0ca25d638164a596b4fbec9567bbcf3e635a8d8457107e7fe76326f3816e34d9"
140140
),
@@ -294,7 +294,7 @@ mod tests {
294294
println!("Verification with modern sig format: {:?}", result);
295295

296296
// Try with reversed block hash (endianness)
297-
let mut reversed_hash = block_hash.clone();
297+
let mut reversed_hash = block_hash;
298298
reversed_hash.reverse();
299299
let result_reversed = sig.verify(&pk, &reversed_hash);
300300
println!("Verification with reversed block hash: {:?}", result_reversed);
@@ -399,7 +399,7 @@ mod tests {
399399
for _ in 0..10 {
400400
let _ = verify_secure_basic_with_mode::<Bls12381G2Impl, _>(
401401
&operator_keys,
402-
inner_sig.clone(),
402+
inner_sig,
403403
msg,
404404
SerializationFormat::Modern,
405405
);
@@ -412,7 +412,7 @@ mod tests {
412412
for _ in 0..iterations {
413413
let _ = verify_secure_basic_with_mode::<Bls12381G2Impl, _>(
414414
&operator_keys,
415-
inner_sig.clone(),
415+
inner_sig,
416416
msg,
417417
SerializationFormat::Modern,
418418
);

key-wallet-ffi/include/key_wallet_ffi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,10 +1294,6 @@ FFIAccount *account_collection_get_identity_topup_not_bound(const FFIAccountColl
12941294
FFIBLSAccount *account_collection_get_provider_operator_keys(const FFIAccountCollection *collection)
12951295
;
12961296

1297-
/*
1298-
Get the provider operator keys account if it exists (stub when BLS is disabled)
1299-
*/
1300-
void *account_collection_get_provider_operator_keys(const FFIAccountCollection *_collection) ;
13011297

13021298
/*
13031299
Check if provider operator keys account exists
@@ -1321,10 +1317,6 @@ FFIBLSAccount *account_collection_get_provider_operator_keys(const FFIAccountCol
13211317
FFIEdDSAAccount *account_collection_get_provider_platform_keys(const FFIAccountCollection *collection)
13221318
;
13231319

1324-
/*
1325-
Get the provider platform keys account if it exists (stub when EdDSA is disabled)
1326-
*/
1327-
void *account_collection_get_provider_platform_keys(const FFIAccountCollection *_collection) ;
13281320

13291321
/*
13301322
Check if provider platform keys account exists

0 commit comments

Comments
 (0)