From fdd86b1b252ac648e29bd111300232872e0474ab Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 17 Dec 2023 22:47:32 +0300 Subject: [PATCH 1/3] rpc: require `proTxHash` to be unspecified when not asking for `ENCRYPTED_CONTRIBUTIONS` in `quorum getdata` rpc --- src/rpc/quorums.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index b33d42e4f4..6976af712e 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -804,8 +804,8 @@ static RPCHelpMan quorum_getdata() uint16_t nDataMask = static_cast(ParseInt32V(request.params[3], "dataMask")); uint256 proTxHash; - // Check if request wants ENCRYPTED_CONTRIBUTIONS data if (nDataMask & llmq::CQuorumDataRequest::ENCRYPTED_CONTRIBUTIONS) { + // Require proTxHash if request wants ENCRYPTED_CONTRIBUTIONS data if (!request.params[4].isNull()) { proTxHash = ParseHashV(request.params[4], "proTxHash"); if (proTxHash.IsNull()) { @@ -814,6 +814,9 @@ static RPCHelpMan quorum_getdata() } else { throw JSONRPCError(RPC_INVALID_PARAMETER, "proTxHash missing"); } + } else if (!request.params[4].isNull()) { + // Require no proTxHash otherwise + throw JSONRPCError(RPC_INVALID_PARAMETER, "Should not specify proTxHash"); } const CBlockIndex* pQuorumBaseBlockIndex = WITH_LOCK(cs_main, return chainman.m_blockman.LookupBlockIndex(quorumHash)); From 7a32a409c003937e05a7a18ec340af8b13e13365 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 18 Dec 2023 18:39:01 +0300 Subject: [PATCH 2/3] doc: add partial release notes --- doc/release-notes-5772.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/release-notes-5772.md diff --git a/doc/release-notes-5772.md b/doc/release-notes-5772.md new file mode 100644 index 0000000000..e771ebe780 --- /dev/null +++ b/doc/release-notes-5772.md @@ -0,0 +1,4 @@ +RPC changes +----------- + +`quorum getdata` RPC will no longer allow `proTxHash` to be specified when `dataMask` is set to `1`. From f18b4e8ca911181a87392ef23b971bac44b21a14 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 9 Aug 2024 00:33:53 +0300 Subject: [PATCH 3/3] test: expect `Should not specify proTxHash` error when flag is `0x01` --- test/functional/p2p_quorum_data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/functional/p2p_quorum_data.py b/test/functional/p2p_quorum_data.py index 7257007f8a..16350bce1c 100755 --- a/test/functional/p2p_quorum_data.py +++ b/test/functional/p2p_quorum_data.py @@ -395,6 +395,8 @@ class QuorumDataMessagesTest(DashTestFramework): def test_rpc_quorum_getdata_protx_hash(): self.log.info("Test optional proTxHash of `quorum getdata`") + assert_raises_rpc_error(-8, "Should not specify proTxHash", + mn1.node.quorum, "getdata", 0, 100, quorum_hash, 0x01, mn1.proTxHash) assert_raises_rpc_error(-8, "proTxHash missing", mn1.node.quorum, "getdata", 0, 100, quorum_hash, 0x02) assert_raises_rpc_error(-8, "proTxHash invalid",