Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ if test "$enable_debug" = "yes"; then
AX_CHECK_PREPROC_FLAG([-DDEBUG_CORE], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_CORE"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKCONTENTION], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKCONTENTION"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DRPC_DOC_CHECK], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DRPC_DOC_CHECK"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
AX_CHECK_COMPILE_FLAG([-ftrapv], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"], [], [$CXXFLAG_WERROR])
else
Expand Down
1 change: 1 addition & 0 deletions src/evo/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const std::map<std::string, RPCResult> RPCRESULT_MAP{{
RESULT_MAP_ENTRY("PoSeRevivedHeight", RPCResult::Type::NUM, "Height masternode recovered from Proof of Service violations"),
RESULT_MAP_ENTRY("proTxHash", RPCResult::Type::STR_HEX, "Hash of the masternode's initial ProRegTx"),
RESULT_MAP_ENTRY("pubKeyOperator", RPCResult::Type::STR, "BLS public key used for operator signing"),
RESULT_MAP_ENTRY("quorumIndex", RPCResult::Type::NUM, "Quorum index. Relevant for rotation quorums only, 0 for non-rotating quorums"),
RESULT_MAP_ENTRY("quorumHash", RPCResult::Type::STR_HEX, "Hash of the quorum"),
RESULT_MAP_ENTRY("quorumSig", RPCResult::Type::STR_HEX, "BLS recovered threshold signature of quorum"),
RESULT_MAP_ENTRY("registeredHeight", RPCResult::Type::NUM, "Height masternode was registered"),
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid values for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
argsman.AddArg("-rpcauth=<userpw>", "Username and HMAC-SHA-256 hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
argsman.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC);
argsman.AddArg("-rpcdoccheck", strprintf("Throw a non-fatal error at runtime if the documentation for an RPC is incorrect (default: %u)", DEFAULT_RPC_DOC_CHECK), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
argsman.AddArg("-rpccookiefile=<loc>", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
argsman.AddArg("-rpcexternaluser=<users>", "List of comma-separated usernames for JSON-RPC external connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
argsman.AddArg("-rpcexternalworkqueue=<n>", strprintf("Set the depth of the work queue to service external RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
Expand Down
26 changes: 22 additions & 4 deletions src/rpc/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,25 @@ static RPCHelpMan quorum_info()
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::ELISION, "", ""}
{RPCResult::Type::NUM, "height", "Quorum Height"},
{RPCResult::Type::STR, "type", "Quorum type"},
GetRpcResult("quorumHash"),
GetRpcResult("quorumIndex"),
{RPCResult::Type::STR_HEX, "minedBlock", "Blockhash where the commitment was mined."},
{RPCResult::Type::NUM, "previousConsecutiveDKGFailures", "Number of previous consecutive DKG failures. Only present for rotation-enabled quorums."},
{RPCResult::Type::ARR, "members", "Members of quorum",
{
{RPCResult::Type::OBJ, "", "",
{
GetRpcResult("proTxHash"),
GetRpcResult("service"),
GetRpcResult("addresses"),
GetRpcResult("pubKeyOperator"),
{RPCResult::Type::BOOL, "valid", "True if member is valid for this DKG"},
{RPCResult::Type::STR_HEX, "pubKeyShare", /*optional=*/true, "Share of BLS public key of the member. Only present if member is valid."}
}},
},
},
Comment on lines +249 to +267
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix clang-format violations to pass CI checks.

The CI pipeline reports clang-format differences in this file. Run the formatting tool to resolve this before merge.

#!/bin/bash
# Apply clang-format to fix formatting issues
git diff -U0 origin/develop -- src/rpc/quorums.cpp | ./contrib/devtools/clang-format-diff.py -p1 -i
🤖 Prompt for AI Agents
In src/rpc/quorums.cpp around lines 249 to 267 there are clang-format style
violations; run the repository's clang-format diff tool or clang-format directly
to reformat this file (for example run the provided script: git diff -U0
origin/develop -- src/rpc/quorums.cpp | ./contrib/devtools/clang-format-diff.py
-p1 -i or run clang-format with the project config), stage and commit the
resulting changes so CI no longer reports formatting differences.

},
},
RPCExamples{""},
Expand Down Expand Up @@ -296,7 +314,7 @@ static RPCHelpMan quorum_dkgstatus()
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "llmqType", "Name of quorum"},
{RPCResult::Type::NUM, "quorumIndex", "Relevant for rotation quorums only, 0 for non-rotating quorums"},
GetRpcResult("quorumIndex"),
{RPCResult::Type::OBJ, "status", "",
{
// TODO: list fields of output for RPC help instead ELISION
Expand All @@ -309,7 +327,7 @@ static RPCHelpMan quorum_dkgstatus()
// TODO: list fields of output for RPC help instead ELISION
{{RPCResult::Type::ELISION, "", ""}},
},
{RPCResult::Type::ARR, "mineableCommitments", "",
{RPCResult::Type::ARR, "minableCommitments", "",
// TODO: list fields of output for RPC help instead ELISION
{{RPCResult::Type::ELISION, "", ""}},
},
Expand Down Expand Up @@ -427,7 +445,7 @@ static RPCHelpMan quorum_memberof()
{
{RPCResult::Type::OBJ, "", "Quorum Info",
{
{RPCResult::Type::ELISION, "", "See for details help for `quorum info`"},
{RPCResult::Type::ELISION, "", "See `help quorum info` for details"},
{RPCResult::Type::BOOL, "isValidMember", ""},
{RPCResult::Type::NUM, "memberIndex", ""},
}},
Expand Down
8 changes: 6 additions & 2 deletions src/rpc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <script/signingprovider.h>
#include <tinyformat.h>
#include <util/check.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.h>
#include <util/translation.h>

const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
Expand Down Expand Up @@ -536,7 +536,11 @@ UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const
if (request.mode == JSONRPCRequest::GET_HELP || !IsValidNumArgs(request.params.size())) {
throw std::runtime_error(ToString());
}
return m_fun(*this, request);
const UniValue ret = m_fun(*this, request);
if (gArgs.GetBoolArg("-rpcdoccheck", DEFAULT_RPC_DOC_CHECK)) {
CHECK_NONFATAL(std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [&ret](const RPCResult& res) { return res.MatchesType(ret); }));
}
return ret;
}

bool RPCHelpMan::IsValidNumArgs(size_t num_args) const
Expand Down
8 changes: 8 additions & 0 deletions src/rpc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#include <variant>
#include <vector>

static constexpr bool DEFAULT_RPC_DOC_CHECK{
#ifdef RPC_DOC_CHECK
true
#else
false
#endif
};

/**
* String used to describe UNIX epoch time in documentation, factored out to a
* constant for consistency.
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
f.write("[{}]\n".format(chain_name_conf_section))
f.write("port=" + str(p2p_port(n)) + "\n")
f.write("rpcport=" + str(rpc_port(n)) + "\n")
f.write("rpcdoccheck=1\n")
f.write("fallbackfee=0.00001\n")
f.write("server=1\n")
f.write("keypool=1\n")
Expand Down
Loading