mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#21810: fuzz: Various RPC fuzzer follow-ups
5252f86eb6
fuzz: Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of #ifdef forests (practicalswift)54549dda31
fuzz: RPC fuzzer post-merge follow-ups. Remove unused includes. Update list of fuzzed RPC commands. (practicalswift) Pull request description: Various RPC fuzzer follow-ups: * Remove unused includes. * Update list of fuzzed RPC commands. * Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of `#ifdef` forests. Context: https://github.com/bitcoin/bitcoin/pull/21169#pullrequestreview-646723483 ACKs for top commit: MarcoFalke: Concept ACK5252f86eb6
Tree-SHA512: 286d70798131706ffb157758e1c73f7f00ed96ce120c7d9dc849e672b283f1362df47b206cfec9da44d5debb5869225e721761dcd5c38a7d5d1019dc6c912ab2
This commit is contained in:
commit
ea71726a54
1 changed files with 6 additions and 26 deletions
|
@ -3,9 +3,7 @@
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <base58.h>
|
#include <base58.h>
|
||||||
#include <chainparamsbase.h>
|
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
#include <interfaces/chain.h>
|
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
|
@ -70,18 +68,15 @@ const std::vector<std::string> RPC_COMMANDS_NOT_SAFE_FOR_FUZZING{
|
||||||
"addpeeraddress", // avoid DNS lookups
|
"addpeeraddress", // avoid DNS lookups
|
||||||
"analyzepsbt", // avoid signed integer overflow in CFeeRate::GetFee(unsigned long) (https://github.com/bitcoin/bitcoin/issues/20607)
|
"analyzepsbt", // avoid signed integer overflow in CFeeRate::GetFee(unsigned long) (https://github.com/bitcoin/bitcoin/issues/20607)
|
||||||
"dumptxoutset", // avoid writing to disk
|
"dumptxoutset", // avoid writing to disk
|
||||||
#ifdef ENABLE_WALLET
|
|
||||||
"dumpwallet", // avoid writing to disk
|
"dumpwallet", // avoid writing to disk
|
||||||
#endif
|
"echoipc", // avoid assertion failure (Assertion `"EnsureAnyNodeContext(request.context).init" && check' failed.)
|
||||||
"echoipc", // avoid assertion failure (Assertion `"EnsureAnyNodeContext(request.context).init" && check' failed.)
|
"generatetoaddress", // avoid prohibitively slow execution (when `num_blocks` is large)
|
||||||
"generatetoaddress", // avoid timeout
|
"generatetodescriptor", // avoid prohibitively slow execution (when `nblocks` is large)
|
||||||
"gettxoutproof", // avoid slow execution
|
"gettxoutproof", // avoid prohibitively slow execution
|
||||||
#ifdef ENABLE_WALLET
|
|
||||||
"importwallet", // avoid reading from disk
|
"importwallet", // avoid reading from disk
|
||||||
"loadwallet", // avoid reading from disk
|
"loadwallet", // avoid reading from disk
|
||||||
#endif
|
|
||||||
"mockscheduler", // avoid assertion failure (Assertion `delta_seconds.count() > 0 && delta_seconds < std::chrono::hours{1}' failed.)
|
|
||||||
"prioritisetransaction", // avoid signed integer overflow in CTxMemPool::PrioritiseTransaction(uint256 const&, long const&) (https://github.com/bitcoin/bitcoin/issues/20626)
|
"prioritisetransaction", // avoid signed integer overflow in CTxMemPool::PrioritiseTransaction(uint256 const&, long const&) (https://github.com/bitcoin/bitcoin/issues/20626)
|
||||||
|
"savemempool", // disabled as a precautionary measure: may take a file path argument in the future
|
||||||
"setban", // avoid DNS lookups
|
"setban", // avoid DNS lookups
|
||||||
"stop", // avoid shutdown state
|
"stop", // avoid shutdown state
|
||||||
};
|
};
|
||||||
|
@ -107,7 +102,6 @@ const std::vector<std::string> RPC_COMMANDS_SAFE_FOR_FUZZING{
|
||||||
"finalizepsbt",
|
"finalizepsbt",
|
||||||
"generate",
|
"generate",
|
||||||
"generateblock",
|
"generateblock",
|
||||||
"generatetodescriptor",
|
|
||||||
"getaddednodeinfo",
|
"getaddednodeinfo",
|
||||||
"getbestblockhash",
|
"getbestblockhash",
|
||||||
"getblock",
|
"getblock",
|
||||||
|
@ -145,11 +139,11 @@ const std::vector<std::string> RPC_COMMANDS_SAFE_FOR_FUZZING{
|
||||||
"joinpsbts",
|
"joinpsbts",
|
||||||
"listbanned",
|
"listbanned",
|
||||||
"logging",
|
"logging",
|
||||||
|
"mockscheduler",
|
||||||
"ping",
|
"ping",
|
||||||
"preciousblock",
|
"preciousblock",
|
||||||
"pruneblockchain",
|
"pruneblockchain",
|
||||||
"reconsiderblock",
|
"reconsiderblock",
|
||||||
"savemempool",
|
|
||||||
"scantxoutset",
|
"scantxoutset",
|
||||||
"sendrawtransaction",
|
"sendrawtransaction",
|
||||||
"setmocktime",
|
"setmocktime",
|
||||||
|
@ -334,20 +328,6 @@ void initialize_rpc()
|
||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const std::string& rpc_command : RPC_COMMANDS_SAFE_FOR_FUZZING) {
|
|
||||||
const bool supported_rpc_command = std::find(supported_rpc_commands.begin(), supported_rpc_commands.end(), rpc_command) != supported_rpc_commands.end();
|
|
||||||
if (!supported_rpc_command) {
|
|
||||||
std::cerr << "Error: Unknown RPC command \"" << rpc_command << "\" found in RPC_COMMANDS_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
|
|
||||||
std::terminate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const std::string& rpc_command : RPC_COMMANDS_NOT_SAFE_FOR_FUZZING) {
|
|
||||||
const bool supported_rpc_command = std::find(supported_rpc_commands.begin(), supported_rpc_commands.end(), rpc_command) != supported_rpc_commands.end();
|
|
||||||
if (!supported_rpc_command) {
|
|
||||||
std::cerr << "Error: Unknown RPC command \"" << rpc_command << "\" found in RPC_COMMANDS_NOT_SAFE_FOR_FUZZING. Please update " << __FILE__ << ".\n";
|
|
||||||
std::terminate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const char* limit_to_rpc_command_env = std::getenv("LIMIT_TO_RPC_COMMAND");
|
const char* limit_to_rpc_command_env = std::getenv("LIMIT_TO_RPC_COMMAND");
|
||||||
if (limit_to_rpc_command_env != nullptr) {
|
if (limit_to_rpc_command_env != nullptr) {
|
||||||
g_limit_to_rpc_command = std::string{limit_to_rpc_command_env};
|
g_limit_to_rpc_command = std::string{limit_to_rpc_command_env};
|
||||||
|
|
Loading…
Add table
Reference in a new issue