File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ FUZZ_TARGETS = \
134134 test/fuzz/scriptnum_ops \
135135 test/fuzz/service_deserialize \
136136 test/fuzz/signature_checker \
137+ test/fuzz/signet \
137138 test/fuzz/snapshotmetadata_deserialize \
138139 test/fuzz/span \
139140 test/fuzz/spanparsing \
@@ -1106,6 +1107,12 @@ test_fuzz_signature_checker_LDADD = $(FUZZ_SUITE_LD_COMMON)
11061107test_fuzz_signature_checker_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
11071108test_fuzz_signature_checker_SOURCES = test/fuzz/signature_checker.cpp
11081109
1110+ test_fuzz_signet_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
1111+ test_fuzz_signet_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
1112+ test_fuzz_signet_LDADD = $(FUZZ_SUITE_LD_COMMON)
1113+ test_fuzz_signet_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
1114+ test_fuzz_signet_SOURCES = test/fuzz/signet.cpp
1115+
11091116test_fuzz_snapshotmetadata_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DSNAPSHOTMETADATA_DESERIALIZE=1
11101117test_fuzz_snapshotmetadata_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
11111118test_fuzz_snapshotmetadata_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
Original file line number Diff line number Diff line change 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 < chainparams.h>
6+ #include < consensus/validation.h>
7+ #include < primitives/block.h>
8+ #include < signet.h>
9+ #include < streams.h>
10+ #include < test/fuzz/fuzz.h>
11+ #include < test/fuzz/FuzzedDataProvider.h>
12+ #include < test/fuzz/util.h>
13+
14+ #include < cstdint>
15+ #include < optional>
16+ #include < vector>
17+
18+ void initialize ()
19+ {
20+ InitializeFuzzingContext (CBaseChainParams::SIGNET);
21+ }
22+
23+ void test_one_input (const std::vector<uint8_t >& buffer)
24+ {
25+ FuzzedDataProvider fuzzed_data_provider{buffer.data (), buffer.size ()};
26+ const std::optional<CBlock> block = ConsumeDeserializable<CBlock>(fuzzed_data_provider);
27+ if (!block) {
28+ return ;
29+ }
30+ (void )CheckSignetBlockSolution (*block, Params ().GetConsensus ());
31+ if (GetWitnessCommitmentIndex (*block) != NO_WITNESS_COMMITMENT) {
32+ (void )SignetTxs (*block, ConsumeScript (fuzzed_data_provider));
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments