Skip to content

Commit 2b32dd6

Browse files
2 parents 27eecea + 6dac5dd commit 2b32dd6

35 files changed

+948
-210
lines changed

ci/test/00_setup_env_native_qt5.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export DEP_OPTS="NO_UPNP=1 DEBUG=1"
1414
export RUN_UNIT_TESTS_SEQUENTIAL="true"
1515
export RUN_UNIT_TESTS="false"
1616
export GOAL="install"
17-
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports LDFLAGS=-static-libstdc++"
17+
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++"

configure.ac

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,16 @@ AC_ARG_ENABLE([extended-functional-tests],
178178

179179
AC_ARG_ENABLE([fuzz],
180180
AS_HELP_STRING([--enable-fuzz],
181-
[enable building of fuzz targets (default no). enabling this will disable all other targets]),
181+
[build for fuzzing (default no). enabling this will disable all other targets and override --{enable,disable}-fuzz-binary]),
182182
[enable_fuzz=$enableval],
183183
[enable_fuzz=no])
184184

185+
AC_ARG_ENABLE([fuzz-binary],
186+
AS_HELP_STRING([--enable-fuzz-binary],
187+
[enable building of fuzz binary (default yes).]),
188+
[enable_fuzz_binary=$enableval],
189+
[enable_fuzz_binary=yes])
190+
185191
AC_ARG_ENABLE([danger_fuzz_link_all],
186192
AS_HELP_STRING([--enable-danger-fuzz-link-all],
187193
[Danger! Modifies source code. Needs git and gnu sed installed. Link each fuzz target (default no).]),
@@ -1275,7 +1281,7 @@ AC_DEFUN([SUPPRESS_WARNINGS],
12751281

12761282
dnl enable-fuzz should disable all other targets
12771283
if test "x$enable_fuzz" = "xyes"; then
1278-
AC_MSG_WARN(enable-fuzz will disable all other targets)
1284+
AC_MSG_WARN(enable-fuzz will disable all other targets and force --enable-fuzz-binary=yes)
12791285
build_bitcoin_utils=no
12801286
build_bitcoin_cli=no
12811287
build_bitcoin_tx=no
@@ -1290,15 +1296,16 @@ if test "x$enable_fuzz" = "xyes"; then
12901296
use_upnp=no
12911297
use_natpmp=no
12921298
use_zmq=no
1299+
enable_fuzz_binary=yes
12931300

12941301
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"]],,[[$CXXFLAG_WERROR]])
12951302

1296-
AC_MSG_CHECKING([whether main function is needed])
1303+
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
12971304
AX_CHECK_LINK_FLAG(
12981305
[[-fsanitize=$use_sanitizers]],
12991306
[AC_MSG_RESULT([no])],
13001307
[AC_MSG_RESULT([yes])
1301-
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"],
1308+
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
13021309
[],
13031310
[AC_LANG_PROGRAM([[
13041311
#include <cstdint>
@@ -1321,6 +1328,8 @@ else
13211328
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
13221329
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
13231330
fi
1331+
1332+
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
13241333
fi
13251334

13261335
if test x$enable_wallet != xno; then
@@ -1733,6 +1742,7 @@ AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
17331742
AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"])
17341743
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
17351744
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
1745+
AM_CONDITIONAL([ENABLE_FUZZ_BINARY],[test x$enable_fuzz_binary = xyes])
17361746
AM_CONDITIONAL([ENABLE_FUZZ_LINK_ALL],[test x$enable_danger_fuzz_link_all = xyes])
17371747
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
17381748
AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes])
@@ -1748,6 +1758,8 @@ AM_CONDITIONAL([ENABLE_ARM_CRC],[test x$enable_arm_crc = xyes])
17481758
AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"])
17491759
AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes])
17501760
AM_CONDITIONAL([WORDS_BIGENDIAN],[test x$ac_cv_c_bigendian = xyes])
1761+
AM_CONDITIONAL([USE_NATPMP],[test x$use_natpmp = xyes])
1762+
AM_CONDITIONAL([USE_UPNP],[test x$use_upnp = xyes])
17511763

17521764
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
17531765
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ libbitcoin_wallet_a_SOURCES = \
508508
coinjoin/client.cpp \
509509
coinjoin/options.cpp \
510510
coinjoin/util.cpp \
511+
hdchain.cpp \
511512
wallet/coincontrol.cpp \
512513
wallet/context.cpp \
513514
wallet/crypter.cpp \
@@ -682,7 +683,6 @@ libbitcoin_common_a_SOURCES = \
682683
compressor.cpp \
683684
core_read.cpp \
684685
core_write.cpp \
685-
hdchain.cpp \
686686
key.cpp \
687687
key_io.cpp \
688688
merkleblock.cpp \

src/Makefile.test.include

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
if ENABLE_FUZZ
6+
if ENABLE_FUZZ_BINARY
77
noinst_PROGRAMS += test/fuzz/fuzz
8-
else
8+
endif
9+
10+
if !ENABLE_FUZZ
911
bin_PROGRAMS += test/test_dash
1012
endif
1113

@@ -61,6 +63,14 @@ FUZZ_SUITE_LD_COMMON = \
6163
$(GMP_LIBS) \
6264
$(BACKTRACE_LIB)
6365

66+
if USE_UPNP
67+
FUZZ_SUITE_LD_COMMON += $(MINIUPNPC_LIBS)
68+
endif
69+
70+
if USE_NATPMP
71+
FUZZ_SUITE_LD_COMMON += $(NATPMP_LIBS)
72+
endif
73+
6474
# test_dash binary #
6575
BITCOIN_TESTS =\
6676
test/arith_uint256_tests.cpp \
@@ -178,10 +188,16 @@ BITCOIN_TESTS += \
178188
wallet/test/ismine_tests.cpp \
179189
wallet/test/scriptpubkeyman_tests.cpp
180190

191+
FUZZ_SUITE_LD_COMMON +=\
192+
$(LIBBITCOIN_WALLET) \
193+
$(SQLITE_LIBS) \
194+
$(BDB_LIBS)
195+
181196
if USE_BDB
182197
BITCOIN_TESTS += wallet/test/db_tests.cpp
183198
endif
184199

200+
185201
BITCOIN_TEST_SUITE += \
186202
wallet/test/wallet_test_fixture.cpp \
187203
wallet/test/wallet_test_fixture.h \
@@ -204,11 +220,12 @@ test_test_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $
204220

205221
if ENABLE_ZMQ
206222
test_test_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
223+
FUZZ_SUITE_LD_COMMON += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
207224
endif
208225

209-
if ENABLE_FUZZ
210226
FUZZ_SUITE_LDFLAGS_COMMON = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(LDFLAGS_WRAP_EXCEPTIONS) $(PTHREAD_FLAGS)
211227

228+
if ENABLE_FUZZ_BINARY
212229
test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
213230
test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
214231
test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON)
@@ -240,6 +257,7 @@ test_fuzz_fuzz_SOURCES = \
240257
test/fuzz/crypto_hkdf_hmac_sha256_l32.cpp \
241258
test/fuzz/crypto_poly1305.cpp \
242259
test/fuzz/cuckoocache.cpp \
260+
test/fuzz/data_stream.cpp \
243261
test/fuzz/decode_tx.cpp \
244262
test/fuzz/descriptor_parse.cpp \
245263
test/fuzz/deserialize.cpp \
@@ -260,6 +278,7 @@ test_fuzz_fuzz_SOURCES = \
260278
test/fuzz/locale.cpp \
261279
test/fuzz/merkleblock.cpp \
262280
test/fuzz/message.cpp \
281+
test/fuzz/muhash.cpp \
263282
test/fuzz/multiplication_overflow.cpp \
264283
test/fuzz/net.cpp \
265284
test/fuzz/net_permissions.cpp \
@@ -272,6 +291,7 @@ test_fuzz_fuzz_SOURCES = \
272291
test/fuzz/parse_script.cpp \
273292
test/fuzz/parse_univalue.cpp \
274293
test/fuzz/policy_estimator.cpp \
294+
test/fuzz/policy_estimator_io.cpp \
275295
test/fuzz/pow.cpp \
276296
test/fuzz/prevector.cpp \
277297
test/fuzz/primitives_transaction.cpp \
@@ -300,11 +320,13 @@ test_fuzz_fuzz_SOURCES = \
300320
test/fuzz/strprintf.cpp \
301321
test/fuzz/system.cpp \
302322
test/fuzz/timedata.cpp \
323+
test/fuzz/torcontrol.cpp \
303324
test/fuzz/transaction.cpp \
304325
test/fuzz/tx_in.cpp \
305-
test/fuzz/tx_out.cpp
306-
307-
endif # ENABLE_FUZZ
326+
test/fuzz/tx_out.cpp \
327+
test/fuzz/validation_load_mempool.cpp \
328+
test/fuzz/versionbits.cpp
329+
endif # ENABLE_FUZZ_BINARY
308330

309331
nodist_test_test_dash_SOURCES = $(GENERATED_TEST_FILES)
310332

src/chainparams.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class CMainParams : public CChainParams {
136136
CMainParams() {
137137
strNetworkID = CBaseChainParams::MAIN;
138138
consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050)
139+
consensus.BIP16Height = 0;
139140
consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
140141
consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
141142
consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
@@ -182,15 +183,15 @@ class CMainParams : public CChainParams {
182183

183184
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
184185
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 19999999999; // TODO: To be determined later
185-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 999999999999ULL;
186+
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
186187
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 4032;
187188
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 3226; // 80% of 4032
188189
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 2420; // 60% of 4032
189190
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
190191

191192
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
192193
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 19999999999; // TODO: To be determined later
193-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 999999999999ULL;
194+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
194195
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 4032;
195196
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 3226; // 80% of 4032
196197
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 2420; // 60% of 4032
@@ -332,6 +333,7 @@ class CTestNetParams : public CChainParams {
332333
CTestNetParams() {
333334
strNetworkID = CBaseChainParams::TESTNET;
334335
consensus.nSubsidyHalvingInterval = 210240;
336+
consensus.BIP16Height = 0;
335337
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
336338
consensus.nMasternodePaymentsIncreaseBlock = 4030;
337339
consensus.nMasternodePaymentsIncreasePeriod = 10;
@@ -378,15 +380,15 @@ class CTestNetParams : public CChainParams {
378380

379381
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
380382
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 19999999999; // TODO: To be determined later
381-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 999999999999ULL;
383+
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
382384
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 100;
383385
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
384386
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
385387
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
386388

387389
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
388390
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 19999999999; // TODO: To be determined later
389-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 999999999999ULL;
391+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
390392
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 100;
391393
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 80; // 80% of 100
392394
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 60; // 60% of 100
@@ -503,6 +505,7 @@ class CDevNetParams : public CChainParams {
503505
explicit CDevNetParams(const ArgsManager& args) {
504506
strNetworkID = CBaseChainParams::DEVNET;
505507
consensus.nSubsidyHalvingInterval = 210240;
508+
consensus.BIP16Height = 0;
506509
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
507510
consensus.nMasternodePaymentsIncreaseBlock = 4030;
508511
consensus.nMasternodePaymentsIncreasePeriod = 10;
@@ -548,15 +551,15 @@ class CDevNetParams : public CChainParams {
548551

549552
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
550553
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 1661990400; // Sep 1st, 2022
551-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 999999999999ULL;
554+
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
552555
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 120;
553556
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 80; // 80% of 100
554557
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 60; // 60% of 100
555558
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
556559

557560
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
558561
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1661990400; // Sep 1st, 2022
559-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 999999999999ULL;
562+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
560563
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 120;
561564
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 80; // 80% of 100
562565
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 60; // 60% of 100
@@ -739,6 +742,7 @@ class CRegTestParams : public CChainParams {
739742
explicit CRegTestParams(const ArgsManager& args) {
740743
strNetworkID = CBaseChainParams::REGTEST;
741744
consensus.nSubsidyHalvingInterval = 150;
745+
consensus.BIP16Height = 0; // always enforce P2SH BIP16 on regtest
742746
consensus.nMasternodePaymentsStartBlock = 240;
743747
consensus.nMasternodePaymentsIncreaseBlock = 350;
744748
consensus.nMasternodePaymentsIncreasePeriod = 10;
@@ -781,19 +785,19 @@ class CRegTestParams : public CChainParams {
781785
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
782786
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
783787
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
784-
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL;
788+
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
785789

786790
consensus.vDeployments[Consensus::DEPLOYMENT_V20].bit = 9;
787791
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nStartTime = 0;
788-
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = 999999999999ULL;
792+
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
789793
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nWindowSize = 480;
790794
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdStart = 384; // 80% of 480
791795
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nThresholdMin = 288; // 60% of 480
792796
consensus.vDeployments[Consensus::DEPLOYMENT_V20].nFalloffCoeff = 5; // this corresponds to 10 periods
793797

794798
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
795799
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 0;
796-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = 999999999999ULL;
800+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
797801
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 1030;
798802
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 800; // 80% of 1000
799803
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 600; // 60% of 1000

src/consensus/params.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <uint256.h>
1010
#include <llmq/params.h>
1111

12+
#include <limits>
1213
#include <map>
1314

1415
namespace Consensus {
@@ -39,6 +40,15 @@ struct BIP9Deployment {
3940
int64_t nThresholdMin{0};
4041
/** A coefficient which adjusts the speed a required number of signaling blocks is decreasing from nThresholdStart to nThresholdMin at with each period. */
4142
int64_t nFalloffCoeff{0};
43+
44+
/** Constant for nTimeout very far in the future. */
45+
static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
46+
47+
/** Special value for nStartTime indicating that the deployment is always active.
48+
* This is useful for testing, as it means tests don't need to deal with the activation
49+
* process (which takes at least 3 BIP9 intervals). Only tests that specifically test the
50+
* behaviour during activation cannot use this. */
51+
static constexpr int64_t ALWAYS_ACTIVE = -1;
4252
};
4353

4454
/**
@@ -48,6 +58,8 @@ struct Params {
4858
uint256 hashGenesisBlock;
4959
uint256 hashDevnetGenesisBlock;
5060
int nSubsidyHalvingInterval;
61+
/** Block height at which BIP16 becomes active */
62+
int BIP16Height;
5163
int nMasternodePaymentsStartBlock;
5264
int nMasternodePaymentsIncreaseBlock;
5365
int nMasternodePaymentsIncreasePeriod; // in blocks

src/test/fuzz/banman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int64_t ConsumeBanTimeOffset(FuzzedDataProvider& fuzzed_data_provider) noexcept
2626

2727
void initialize_banman()
2828
{
29-
InitializeFuzzingContext();
29+
static const auto testing_setup = MakeNoLogFileContext<>();
3030
}
3131

3232
FUZZ_TARGET_INIT(banman, initialize_banman)

src/test/fuzz/coins_view.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ bool operator==(const Coin& a, const Coin& b)
3737

3838
void initialize_coins_view()
3939
{
40-
static const ECCVerifyHandle ecc_verify_handle;
41-
ECC_Start();
42-
SelectParams(CBaseChainParams::REGTEST);
40+
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
4341
}
4442

4543
FUZZ_TARGET_INIT(coins_view, initialize_coins_view)

src/test/fuzz/connman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
void initialize_connman()
1919
{
20-
InitializeFuzzingContext();
20+
static const auto testing_setup = MakeNoLogFileContext<>();
2121
}
2222

2323
FUZZ_TARGET_INIT(connman, initialize_connman)

src/test/fuzz/data_stream.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) 2020 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <addrman.h>
6+
#include <net.h>
7+
#include <test/fuzz/FuzzedDataProvider.h>
8+
#include <test/fuzz/fuzz.h>
9+
#include <test/fuzz/util.h>
10+
11+
#include <cstdint>
12+
#include <vector>
13+
14+
void initialize_data_stream_addr_man()
15+
{
16+
static const auto testing_setup = MakeNoLogFileContext<>();
17+
}
18+
19+
FUZZ_TARGET_INIT(data_stream_addr_man, initialize_data_stream_addr_man)
20+
{
21+
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
22+
CDataStream data_stream = ConsumeDataStream(fuzzed_data_provider);
23+
CAddrMan addr_man;
24+
CAddrDB::Read(addr_man, data_stream);
25+
}

0 commit comments

Comments
 (0)