aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-04-24 14:37:52 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-04-24 14:38:23 -0400
commit8c0f86f284408f316e27702510733289a6a139e7 (patch)
treeedf3941e27530f6e3384f76423802bc984faa42c /src
parent7812889849eb936afadc7267b51ad3768b2adf94 (diff)
parentfdceb6328382ac0f9d643f9d42ba0509062d7d48 (diff)
Merge #18757: test: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer
fdceb6328382ac0f9d643f9d42ba0509062d7d48 fuzz: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer (practicalswift) Pull request description: Remove enumeration of expected deserialization exceptions in `ProcessMessage(...)` fuzzer. Closes #18749. Top commit has no ACKs. Tree-SHA512: fe0411dd1e574fe635019d9e3329202798295c8be1b0c5cb9c092ecc27ab7d4d2883104d7bd781ff5d422d13480d858fc8a7f5578d09268d142ae966afb79002
Diffstat (limited to 'src')
-rw-r--r--src/test/fuzz/process_message.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/test/fuzz/process_message.cpp b/src/test/fuzz/process_message.cpp
index 0ed3721636..c03365199a 100644
--- a/src/test/fuzz/process_message.cpp
+++ b/src/test/fuzz/process_message.cpp
@@ -19,16 +19,13 @@
#include <validationinterface.h>
#include <version.h>
-#include <algorithm>
#include <atomic>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <iosfwd>
#include <iostream>
-#include <map>
#include <memory>
-#include <set>
#include <string>
#include <vector>
@@ -44,19 +41,6 @@ const std::string LIMIT_TO_MESSAGE_TYPE{TO_STRING(MESSAGE_TYPE)};
const std::string LIMIT_TO_MESSAGE_TYPE;
#endif
-const std::map<std::string, std::set<std::string>> EXPECTED_DESERIALIZATION_EXCEPTIONS = {
- {"CDataStream::read(): end of data: iostream error", {"addr", "block", "blocktxn", "cmpctblock", "feefilter", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "ping", "sendcmpct", "tx"}},
- {"CompactSize exceeds limit of type: iostream error", {"cmpctblock"}},
- {"differential value overflow: iostream error", {"getblocktxn"}},
- {"index overflowed 16 bits: iostream error", {"getblocktxn"}},
- {"index overflowed 16-bits: iostream error", {"cmpctblock"}},
- {"indexes overflowed 16 bits: iostream error", {"getblocktxn"}},
- {"non-canonical ReadCompactSize(): iostream error", {"addr", "block", "blocktxn", "cmpctblock", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "tx"}},
- {"ReadCompactSize(): size too large: iostream error", {"addr", "block", "blocktxn", "cmpctblock", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "tx"}},
- {"Superfluous witness record: iostream error", {"block", "blocktxn", "cmpctblock", "tx"}},
- {"Unknown transaction optional data: iostream error", {"block", "blocktxn", "cmpctblock", "tx"}},
-};
-
const TestingSetup* g_setup;
} // namespace
@@ -91,13 +75,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
g_setup->m_node.peer_logic->InitializeNode(&p2p_node);
try {
(void)ProcessMessage(&p2p_node, random_message_type, random_bytes_data_stream, GetTimeMillis(), Params(), *g_setup->m_node.mempool, g_setup->m_node.connman.get(), g_setup->m_node.banman.get(), std::atomic<bool>{false});
- } catch (const std::ios_base::failure& e) {
- const std::string exception_message{e.what()};
- const auto p = EXPECTED_DESERIALIZATION_EXCEPTIONS.find(exception_message);
- if (p == EXPECTED_DESERIALIZATION_EXCEPTIONS.cend() || p->second.count(random_message_type) == 0) {
- std::cout << "Unexpected exception when processing message type \"" << random_message_type << "\": " << exception_message << std::endl;
- assert(false);
- }
+ } catch (const std::ios_base::failure&) {
}
SyncWithValidationInterfaceQueue();
}