Skip to content

Commit 661db51

Browse files
committed
fix: add missing RPC help result for quorum RPCs
- quorum (composite command) - quorum dkgstats - quorum info - quorum sign - quorum platformsign - quorum verify - quorum hasrecsig - quorum isconflicting - quorum selectquorum - quorum dkgsimerror - quorum getdata - quorum verifychainlock - quorum verifyislock
1 parent 72284b5 commit 661db51

File tree

1 file changed

+84
-15
lines changed

1 file changed

+84
-15
lines changed

src/rpc/quorums.cpp

Lines changed: 84 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,12 @@ static RPCHelpMan quorum_info()
242242
{"quorumHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Block hash of quorum."},
243243
{"includeSkShare", RPCArg::Type::BOOL, RPCArg::Default{false}, "Include secret key share in output."},
244244
},
245-
RPCResults{},
245+
RPCResult{
246+
RPCResult::Type::OBJ, "", "",
247+
{
248+
{RPCResult::Type::ELISION, "", ""}
249+
},
250+
},
246251
RPCExamples{""},
247252
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
248253
{
@@ -280,7 +285,35 @@ static RPCHelpMan quorum_dkgstatus()
280285
"Detail level of output.\n"
281286
"0=Only show counts. 1=Show member indexes. 2=Show member's ProTxHashes."},
282287
},
283-
RPCResults{},
288+
RPCResult{
289+
RPCResult::Type::OBJ, "", "",
290+
{
291+
{RPCResult::Type::NUM, "time", "Adjusted time for the last update, timestamp"},
292+
{RPCResult::Type::STR, "timeStr", "Adjusted time for the last update, human friendly"},
293+
{RPCResult::Type::ARR, "session", "",
294+
{
295+
{RPCResult::Type::OBJ, "", "",
296+
{
297+
{RPCResult::Type::NUM, "llmqType", "Name of quorum"},
298+
{RPCResult::Type::NUM, "quorumIndex", "Relevant for rotation quorums only, for non rotating quorums is 0"},
299+
{RPCResult::Type::OBJ, "status", "",
300+
{
301+
// TODO: list fields of output for RPC help instead ELISION
302+
{RPCResult::Type::ELISION, "", ""},
303+
}},
304+
}},
305+
},
306+
},
307+
{RPCResult::Type::ARR, "quorumConnections", "",
308+
// TODO: list fields of output for RPC help instead ELISION
309+
{{RPCResult::Type::ELISION, "", ""}},
310+
},
311+
{RPCResult::Type::ARR, "mineableCommitments", "",
312+
// TODO: list fields of output for RPC help instead ELISION
313+
{{RPCResult::Type::ELISION, "", ""}},
314+
},
315+
},
316+
},
284317
RPCExamples{""},
285318
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
286319
{
@@ -388,7 +421,17 @@ static RPCHelpMan quorum_memberof()
388421
"Can be CPU/disk heavy when the value is larger than the number of active quorums."
389422
},
390423
},
391-
RPCResults{},
424+
RPCResult{
425+
RPCResult::Type::ARR, "quorums", "",
426+
{
427+
{RPCResult::Type::OBJ, "", "Quorum Info",
428+
{
429+
{RPCResult::Type::ELISION, "", "See for details help for `quorum info`"},
430+
{RPCResult::Type::BOOL, "isValidMember", ""},
431+
{RPCResult::Type::NUM, "memberIndex", ""},
432+
}},
433+
},
434+
},
392435
RPCExamples{""},
393436
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
394437
{
@@ -492,6 +535,23 @@ static UniValue quorum_sign_helper(const JSONRPCRequest& request, Consensus::LLM
492535
}
493536
}
494537

538+
namespace {
539+
const RPCResults quorum_sign_result{
540+
RPCResult{"if submit is set to true", RPCResult::Type::BOOL, "result", "result of signing, true if success"},
541+
RPCResult{"if submit is not set or set to false", RPCResult::Type::OBJ, "", "",
542+
{
543+
{RPCResult::Type::NUM, "llmqType", "Quorum type"},
544+
{RPCResult::Type::STR_HEX, "quorumHash", "Quorum Hash"},
545+
{RPCResult::Type::NUM, "quorumMember", "Number of quorum member"},
546+
{RPCResult::Type::STR_HEX, "id", "Request ID"},
547+
{RPCResult::Type::STR_HEX, "msgHash", "Hash of message"},
548+
{RPCResult::Type::STR_HEX, "signHash", "Hash of signature"},
549+
{RPCResult::Type::STR_HEX, "signature", "Hex encoded signature"},
550+
},
551+
},
552+
};
553+
} // anonymous namespace
554+
495555
static RPCHelpMan quorum_sign()
496556
{
497557
return RPCHelpMan{"quorum sign",
@@ -504,7 +564,7 @@ static RPCHelpMan quorum_sign()
504564
{"submit", RPCArg::Type::BOOL, RPCArg::Default{true}, "Submits the signature share to the network if this is true. "
505565
"Returns an object containing the signature share if this is false."},
506566
},
507-
RPCResults{},
567+
quorum_sign_result,
508568
RPCExamples{""},
509569
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
510570
{
@@ -531,7 +591,7 @@ static RPCHelpMan quorum_platformsign()
531591
{"submit", RPCArg::Type::BOOL, RPCArg::Default{true}, "Submits the signature share to the network if this is true. "
532592
"Returns an object containing the signature share if this is false."},
533593
},
534-
RPCResults{},
594+
quorum_sign_result,
535595
RPCExamples{""},
536596
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
537597
{
@@ -569,7 +629,7 @@ static RPCHelpMan quorum_verify()
569629
"The height at which the message was signed.\n"
570630
"Only works when quorumHash is \"\"."},
571631
},
572-
RPCResults{},
632+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if the signature is valid"},
573633
RPCExamples{""},
574634
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
575635
{
@@ -623,7 +683,7 @@ static RPCHelpMan quorum_hasrecsig()
623683
{"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."},
624684
{"msgHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Message hash."},
625685
},
626-
RPCResults{},
686+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if node has this recovered signature"},
627687
RPCExamples{""},
628688
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
629689
{
@@ -688,7 +748,7 @@ static RPCHelpMan quorum_isconflicting()
688748
{"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."},
689749
{"msgHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Message hash."},
690750
},
691-
RPCResults{},
751+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if this msgHash is conflicting with previous signing sessions"},
692752
RPCExamples{""},
693753
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
694754
{
@@ -716,7 +776,16 @@ static RPCHelpMan quorum_selectquorum()
716776
{"llmqType", RPCArg::Type::NUM, RPCArg::Optional::NO, "LLMQ type."},
717777
{"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."},
718778
},
719-
RPCResults{},
779+
RPCResult{
780+
RPCResult::Type::OBJ, "", "",
781+
{
782+
{RPCResult::Type::STR_HEX, "quorumHash", "Hash of chosen quorum"},
783+
/* {RPCResult::Type::ARR, "recoveryMembers", "list of members to do sig recovery",
784+
{RPCResult::Type::STR_HEX, "hash", "protx hash of member"}
785+
},
786+
*/
787+
}
788+
},
720789
RPCExamples{""},
721790
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
722791
{
@@ -761,7 +830,7 @@ static RPCHelpMan quorum_dkgsimerror()
761830
{"type", RPCArg::Type::STR, RPCArg::Optional::NO, "Error type."},
762831
{"rate", RPCArg::Type::NUM, RPCArg::Optional::NO, "Rate at which to simulate this error type (between 0 and 100)."},
763832
},
764-
RPCResults{},
833+
RPCResult{RPCResult::Type::NONE, "", ""},
765834
RPCExamples{""},
766835
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
767836
{
@@ -777,7 +846,7 @@ static RPCHelpMan quorum_dkgsimerror()
777846
throw JSONRPCError(RPC_INVALID_PARAMETER, "invalid type. See DKGError class implementation");
778847
} else {
779848
llmq::SetSimulatedDKGErrorRate(type, static_cast<double>(rate) / 100);
780-
return UniValue();
849+
return NullUniValue;
781850
}
782851
},
783852
};
@@ -798,7 +867,7 @@ static RPCHelpMan quorum_getdata()
798867
"3 - Request both, 1 and 2"},
799868
{"proTxHash", RPCArg::Type::STR_HEX, RPCArg::Default{""}, "The proTxHash the contributions will be requested for. Must be member of the specified LLMQ."},
800869
},
801-
RPCResults{},
870+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if the message QGETDATA has been successfully sent"},
802871
RPCExamples{""},
803872
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
804873
{
@@ -960,7 +1029,7 @@ static RPCHelpMan quorum_help()
9601029
{
9611030
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"},
9621031
},
963-
RPCResults{},
1032+
RPCResult{RPCResult::Type::NONE, "", ""},
9641033
RPCExamples{""},
9651034
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
9661035
{
@@ -978,7 +1047,7 @@ static RPCHelpMan verifychainlock()
9781047
{"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The signature of the ChainLock."},
9791048
{"blockHeight", RPCArg::Type::NUM, RPCArg::DefaultHint{"There will be an internal lookup of \"blockHash\" if this is not provided."}, "The height of the ChainLock."},
9801049
},
981-
RPCResults{},
1050+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if the chainlock is valid"},
9821051
RPCExamples{""},
9831052
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
9841053
{
@@ -1037,7 +1106,7 @@ static RPCHelpMan verifyislock()
10371106
{"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The InstantSend Lock signature to verify."},
10381107
{"maxHeight", RPCArg::Type::NUM, RPCArg::Default{-1}, "The maximum height to search quorums from."},
10391108
},
1040-
RPCResults{},
1109+
RPCResult{RPCResult::Type::BOOL, "", "Returns true if the instantsent is valid"},
10411110
RPCExamples{""},
10421111
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
10431112
{

0 commit comments

Comments
 (0)