Skip to content
Open
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/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: 23 additions & 3 deletions src/rpc/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,27 @@ static RPCHelpMan quorum_info()
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::ELISION, "", ""}
{RPCResult::Type::NUM, "height", "Quorum Height"},
{RPCResult::Type::STR, "type", "Quorum type"},
{RPCResult::Type::STR_HEX, "quorumHash", "Quorum hash"},
{RPCResult::Type::NUM, "quorumIndex", "Quorum index (applicable only to rotated quorums)."},
Copy link
Collaborator

Choose a reason for hiding this comment

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

quorumIndex is defined twice (see below), consider adding it to RPCRESULT_MAP

{RPCResult::Type::NUM, "quorumIndex", "Quorum index (applicable only to rotated quorums)."},

{RPCResult::Type::NUM, "quorumIndex", "Relevant for rotation quorums only, 0 for non-rotating quorums"},

{RPCResult::Type::STR_HEX, "minedBlock", "Blockhash where the commitment was mined."},
{RPCResult::Type::NUM, "previousConsecutiveDKGFailures", "Number of previous consecutive DKG failures."},
{RPCResult::Type::ARR, "members", "Members of quorum",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR_HEX, "proTxHash", "ProTx of collaterial"},
Copy link

Choose a reason for hiding this comment

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

syntax: Typo: 'collaterial' should be 'collateral'

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc/quorums.cpp
Line: 259:259

Comment:
**syntax:** Typo: 'collaterial' should be 'collateral'

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment

RESULT_MAP_ENTRY("proTxHash", RPCResult::Type::STR_HEX, "Hash of the masternode's initial ProRegTx"),

{RPCResult::Type::STR, "service", "Address of node. Legacy, will be deprecated in further versions. See `addresses` instead."},
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment, would keep deprecation text synced in all instances

RESULT_MAP_ENTRY("service", RPCResult::Type::STR, "(DEPRECATED) IP address and port of the masternode"),

{RPCResult::Type::ARR, "addresses", "Addresses of node",
Copy link
Collaborator

@kwvg kwvg Oct 25, 2025

Choose a reason for hiding this comment

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

Please use GetRpcResult("addresses") (see example below)

dash/src/evo/core_write.cpp

Lines 498 to 508 in f650f65

RPCResult CSimplifiedMNListEntry::GetJsonHelp(const std::string& key, bool optional)
{
return {RPCResult::Type::OBJ, key, optional, key.empty() ? "" : "The simplified masternode list entry",
{
{RPCResult::Type::NUM, "nVersion", "Version of the entry"},
{RPCResult::Type::NUM, "nType", "Masternode type"},
{RPCResult::Type::STR_HEX, "proRegTxHash", "Hash of the ProRegTx identifying the masternode"},
{RPCResult::Type::STR_HEX, "confirmedHash", "Hash of the block where the masternode was confirmed"},
GetRpcResult("service"),
GetRpcResult("addresses"),
GetRpcResult("pubKeyOperator"),

It's forward declared in core_io.h (see below)

dash/src/core_io.h

Lines 60 to 61 in f650f65

// evo/core_write.cpp
RPCResult GetRpcResult(const std::string& key, bool optional = false);

// TODO - expand it when extended addresses are fully implemented
{{RPCResult::Type::ELISION, "", ""}},
},
{RPCResult::Type::STR_HEX, "pubKeyOperator", "The operator BLS public key"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

We've already defined pubKeyOperator (see below), please use GetRpcResult()

RESULT_MAP_ENTRY("pubKeyOperator", RPCResult::Type::STR, "BLS public key used for operator signing"),

{RPCResult::Type::BOOL, "valid", "True is member valid for this DKG"}
}},
},
},
},
},
RPCExamples{""},
Expand Down Expand Up @@ -309,7 +329,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 +447,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