-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: A set of qdata
/qwatch
related fixes
#5745
Conversation
…sages, only the final one
…oring qwatch on our side Checking for `qwatch` doesn't make sense in these conditions because it's set on the node we are watching when it receives `QWATCH` message from us, it's always `false` on the watching node itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, some nit and a question for you
src/rpc/quorums.cpp
Outdated
@@ -730,6 +730,9 @@ static UniValue quorum_getdata(const JSONRPCRequest& request, const LLMQContext& | |||
} 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in this case we ask for a quorum wide data only (QUORUM_VERIFICATION_VECTOR
) and not for a data about one specific MN, so proTxHash
is not used in any way in this case and should not be provided. If it still was provided then maybe user doesn't quite understand what he is doing exactly or maybe he made a typo in dataMask
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be a breaking change, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utack
src/llmq/dkgsessionmgr.cpp
Outdated
@@ -429,13 +440,15 @@ bool CDKGSessionManager::GetEncryptedContributions(Consensus::LLMQType llmqType, | |||
} | |||
} | |||
if (nRequestedMemberIdx == std::numeric_limits<size_t>::max()) { | |||
LogPrintf("CDKGSessionManager::%s -- not a member, nProTxHash=%s\n", __func__, nProTxHash.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not guard this behind a category?
src/llmq/dkgsessionmgr.cpp
Outdated
return false; | ||
} | ||
|
||
for (const auto i : irange::range(members.size())) { | ||
if (validMembers[i]) { | ||
CBLSIESMultiRecipientObjects<CBLSSecretKey> encryptedContributions; | ||
if (!db->Read(std::make_tuple(DB_ENC_CONTRIB, llmqType, pQuorumBaseBlockIndex->GetBlockHash(), members[i]->proTxHash), encryptedContributions)) { | ||
LogPrintf("CDKGSessionManager::%s -- can't read from db, nProTxHash=%s\n", __func__, nProTxHash.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/llmq/quorums.h
Outdated
@@ -275,7 +275,7 @@ class CQuorumManager | |||
size_t GetQuorumRecoveryStartOffset(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex) const; | |||
|
|||
void StartCachePopulatorThread(const CQuorumCPtr pQuorum) const; | |||
void StartQuorumDataRecoveryThread(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex, uint16_t nDataMask) const; | |||
void StartQuorumDataRecoveryThread(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex, const uint16_t nDataMaskIn) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const in a declaration doesn't do anything; generally this should only be present in the definition.
void StartQuorumDataRecoveryThread(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex, const uint16_t nDataMaskIn) const; | |
void StartQuorumDataRecoveryThread(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex, uint16_t nDataMaskIn) const; |
src/rpc/quorums.cpp
Outdated
@@ -730,6 +730,9 @@ static UniValue quorum_getdata(const JSONRPCRequest& request, const LLMQContext& | |||
} 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be a breaking change, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK for squash merge; LGTM if you think c5a66ff is valuable, let's open a new PR targeted for v21 with release notes?
Approval contingent on CI
Gitlab had some unrelated issues https://gitlab.com/dashpay/dash/-/jobs/5770189961, restarted it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's refactor IsWatchQuorumsEnabled
to validate fMasternodeMode
(see a comment for details).
Other comments are non-actionable, just marks for conflicts resolving.
@@ -189,6 +189,11 @@ void CDKGSessionManager::ProcessMessage(CNode& pfrom, const CQuorumManager& quor | |||
} | |||
|
|||
if (msg_type == NetMsgType::QWATCH) { | |||
if (!fMasternodeMode) { | |||
// non-masternodes should never receive this | |||
m_peerman->Misbehaving(pfrom.GetId(), 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a notice: refactored in #5782 - one of these 2 PR should be changed after other is merged
@@ -198,6 +198,12 @@ void CDKGSessionManager::ProcessMessage(CNode& pfrom, const CQuorumManager& quor | |||
return; | |||
} | |||
|
|||
if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potentially conflict with #5790 - one of PR to edit; depends which one get merge first.
|
||
for (const auto& params : Params().GetConsensus().llmqs) { | ||
CheckQuorumConnections(params, pindexNew); | ||
} | ||
|
||
{ | ||
if (fMasternodeMode || utils::IsWatchQuorumsEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see many check "fMasternodeMode || utils::IsWatchQuorumsEnabled()" - maybe move a boolean flag fMasternodeMode
inside IsWatchQuorumsEnabled
such as:
bool IsWatchQuorumsEnabled()
{
static bool fIsWatchQuroumsEnabled = gArgs.GetBoolArg("-watchquorums", DEFAULT_WATCH_QUORUMS);
return fIsWatchQuroumsEnabled ||fMasternodeMode ;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's refactor IsWatchQuorumsEnabled to validate fMasternodeMode (see a comment for details).
can be actually done after by new PR; not that important changes. utACK!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-approval to trigger conflicts check
Issue being fixed or feature implemented
Fix/tidy up a few
qdata
/qwatch
related parts, improve performance for regular non-watching nodesbased on #5744 atmWhat was done?
pls see individual commits
How Has This Been Tested?
run tests
Breaking Changes
n/a
Checklist: