17
17
#include < test/util/mining.h>
18
18
#include < test/util/net.h>
19
19
#include < test/util/setup_common.h>
20
+ #include < test/util/validation.h>
20
21
#include < validationinterface.h>
21
22
#include < version.h>
22
23
@@ -73,7 +74,12 @@ void initialize_process_message()
73
74
void fuzz_target (FuzzBufferType buffer, const std::string& LIMIT_TO_MESSAGE_TYPE)
74
75
{
75
76
FuzzedDataProvider fuzzed_data_provider (buffer.data (), buffer.size ());
76
- ConnmanTestMsg& connman = *(ConnmanTestMsg*)g_setup->m_node .connman .get ();
77
+
78
+ ConnmanTestMsg& connman = *static_cast <ConnmanTestMsg*>(g_setup->m_node .connman .get ());
79
+ TestChainState& chainstate = *static_cast <TestChainState*>(&g_setup->m_node .chainman ->ActiveChainstate ());
80
+ SetMockTime (1610000000 ); // any time to successfully reset ibd
81
+ chainstate.ResetIbd ();
82
+
77
83
const std::string random_message_type{fuzzed_data_provider.ConsumeBytesAsString (CMessageHeader::COMMAND_SIZE).c_str ()};
78
84
if (!LIMIT_TO_MESSAGE_TYPE.empty () && random_message_type != LIMIT_TO_MESSAGE_TYPE) {
79
85
return ;
@@ -86,6 +92,9 @@ void fuzz_target(FuzzBufferType buffer, const std::string& LIMIT_TO_MESSAGE_TYPE
86
92
g_setup->m_node .peerman ->InitializeNode (&p2p_node);
87
93
FillNode (fuzzed_data_provider, p2p_node, /* init_version */ successfully_connected);
88
94
95
+ const auto mock_time = ConsumeTime (fuzzed_data_provider);
96
+ SetMockTime (mock_time);
97
+
89
98
// fuzzed_data_provider is fully consumed after this call, don't use it
90
99
CDataStream random_bytes_data_stream{fuzzed_data_provider.ConsumeRemainingBytes <unsigned char >(), SER_NETWORK, PROTOCOL_VERSION};
91
100
try {
@@ -109,8 +118,16 @@ FUZZ_TARGET_MSG(blocktxn);
109
118
FUZZ_TARGET_MSG (cfcheckpt);
110
119
FUZZ_TARGET_MSG (cfheaders);
111
120
FUZZ_TARGET_MSG (cfilter);
121
+ FUZZ_TARGET_MSG (clsig);
112
122
FUZZ_TARGET_MSG (cmpctblock);
113
- FUZZ_TARGET_MSG (feefilter);
123
+ FUZZ_TARGET_MSG (dsa);
124
+ FUZZ_TARGET_MSG (dsc);
125
+ FUZZ_TARGET_MSG (dsf);
126
+ FUZZ_TARGET_MSG (dsi);
127
+ FUZZ_TARGET_MSG (dsq);
128
+ FUZZ_TARGET_MSG (dss);
129
+ FUZZ_TARGET_MSG (dssu);
130
+ FUZZ_TARGET_MSG (dstx);
114
131
FUZZ_TARGET_MSG (filteradd);
115
132
FUZZ_TARGET_MSG (filterclear);
116
133
FUZZ_TARGET_MSG (filterload);
@@ -122,17 +139,47 @@ FUZZ_TARGET_MSG(getcfheaders);
122
139
FUZZ_TARGET_MSG (getcfilters);
123
140
FUZZ_TARGET_MSG (getdata);
124
141
FUZZ_TARGET_MSG (getheaders);
142
+ FUZZ_TARGET_MSG (getheaders2);
143
+ FUZZ_TARGET_MSG (getmnlistd);
144
+ FUZZ_TARGET_MSG (getqrinfo);
145
+ FUZZ_TARGET_MSG (getsporks);
146
+ FUZZ_TARGET_MSG (govobj);
147
+ FUZZ_TARGET_MSG (govobjvote);
148
+ FUZZ_TARGET_MSG (govsync);
125
149
FUZZ_TARGET_MSG (headers);
150
+ FUZZ_TARGET_MSG (headers2);
126
151
FUZZ_TARGET_MSG (inv);
152
+ FUZZ_TARGET_MSG (isdlock);
127
153
FUZZ_TARGET_MSG (mempool);
128
154
FUZZ_TARGET_MSG (merkleblock);
155
+ FUZZ_TARGET_MSG (mnauth);
156
+ FUZZ_TARGET_MSG (mnlistdiff);
129
157
FUZZ_TARGET_MSG (notfound);
130
158
FUZZ_TARGET_MSG (ping);
131
159
FUZZ_TARGET_MSG (pong);
160
+ FUZZ_TARGET_MSG (qbsigs);
161
+ FUZZ_TARGET_MSG (qcomplaint);
162
+ FUZZ_TARGET_MSG (qcontrib);
163
+ FUZZ_TARGET_MSG (qdata);
164
+ FUZZ_TARGET_MSG (qfcommit);
165
+ FUZZ_TARGET_MSG (qgetdata);
166
+ FUZZ_TARGET_MSG (qgetsigs);
167
+ FUZZ_TARGET_MSG (qjustify);
168
+ FUZZ_TARGET_MSG (qpcommit);
169
+ FUZZ_TARGET_MSG (qrinfo);
170
+ FUZZ_TARGET_MSG (qsendrecsigs);
171
+ FUZZ_TARGET_MSG (qsigrec);
172
+ FUZZ_TARGET_MSG (qsigsesann);
173
+ FUZZ_TARGET_MSG (qsigshare);
174
+ FUZZ_TARGET_MSG (qsigsinv);
175
+ FUZZ_TARGET_MSG (qwatch);
132
176
FUZZ_TARGET_MSG (sendaddrv2);
133
177
FUZZ_TARGET_MSG (sendcmpct);
178
+ FUZZ_TARGET_MSG (senddsq);
134
179
FUZZ_TARGET_MSG (sendheaders);
180
+ FUZZ_TARGET_MSG (sendheaders2);
181
+ FUZZ_TARGET_MSG (spork);
182
+ FUZZ_TARGET_MSG (ssc);
135
183
FUZZ_TARGET_MSG (tx);
136
184
FUZZ_TARGET_MSG (verack);
137
185
FUZZ_TARGET_MSG (version);
138
- FUZZ_TARGET_MSG (wtxidrelay);
0 commit comments