From: Matt Corallo Date: Fri, 6 Jan 2023 19:53:47 +0000 (+0000) Subject: Switch to hashbrown in fuzzing X-Git-Tag: v0.0.114-beta~61^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=7bdbbca3b064be9eadfb716392e099f19878b927;p=rust-lightning Switch to hashbrown in fuzzing hashbrown by default uses ahash, which may be a bit faster, but more importantly, if we upgrade to hashbrown 0.13/ahash 0.8 we can make it use a constant randomization factor, making fuzzers happier. --- diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index bc1ed6f0c..a6d91781b 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -18,11 +18,13 @@ libfuzzer_fuzz = ["libfuzzer-sys"] stdin_fuzz = [] [dependencies] -afl = { version = "0.12", optional = true } -lightning = { path = "../lightning", features = ["regex"] } +lightning = { path = "../lightning", features = ["regex", "hashbrown"] } lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync" } bitcoin = { version = "0.29.0", features = ["secp-lowmemory"] } hex = "0.3" +hashbrown = "0.8" + +afl = { version = "0.12", optional = true } honggfuzz = { version = "0.5", optional = true, default-features = false } libfuzzer-sys = { version = "0.4", optional = true } diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index fda004682..c9147cd83 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -61,7 +61,7 @@ use bitcoin::secp256k1::Secp256k1; use std::mem; use std::cmp::{self, Ordering}; -use std::collections::{HashSet, hash_map, HashMap}; +use hashbrown::{HashSet, hash_map, HashMap}; use std::sync::{Arc,Mutex}; use std::sync::atomic; use std::io::Cursor; diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index ae9e6295c..8a0b6de65 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -58,7 +58,7 @@ use bitcoin::secp256k1::ecdsa::RecoverableSignature; use bitcoin::secp256k1::Secp256k1; use std::cell::RefCell; -use std::collections::{HashMap, hash_map}; +use hashbrown::{HashMap, hash_map}; use std::convert::TryInto; use std::cmp; use std::sync::{Arc, Mutex}; diff --git a/fuzz/src/router.rs b/fuzz/src/router.rs index cb397bdec..3e51d0c6a 100644 --- a/fuzz/src/router.rs +++ b/fuzz/src/router.rs @@ -29,7 +29,7 @@ use bitcoin::blockdata::constants::genesis_block; use crate::utils::test_logger; use std::convert::TryInto; -use std::collections::HashSet; +use hashbrown::HashSet; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering};