Skip to content

Conversation

@UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Nov 29, 2023

Issue being fixed or feature implemented

Fix/tidy up a few qdata/qwatch related parts, improve performance for regular non-watching nodes

based on #5744 atm

What was done?

pls see individual commits

How Has This Been Tested?

run tests

Breaking Changes

n/a

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

…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.
@UdjinM6 UdjinM6 marked this pull request as ready for review December 6, 2023 20:42
Copy link

@ogabrielides ogabrielides left a 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

}
} else if (!request.params[4].isNull()) {
// Require no proTxHash otherwise
throw JSONRPCError(RPC_INVALID_PARAMETER, "Should not specify proTxHash");

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?

Copy link
Author

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.

Choose a reason for hiding this comment

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

Got it. Thanks!

Copy link
Member

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?

ogabrielides
ogabrielides previously approved these changes Dec 16, 2023
Copy link

@ogabrielides ogabrielides left a comment

Choose a reason for hiding this comment

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

utack

}
}
if (nRequestedMemberIdx == std::numeric_limits<size_t>::max()) {
LogPrintf("CDKGSessionManager::%s -- not a member, nProTxHash=%s\n", __func__, nProTxHash.ToString());
Copy link
Member

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?

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());
Copy link
Member

Choose a reason for hiding this comment

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

same


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;
Copy link
Member

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.

Suggested change
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;

}
} else if (!request.params[4].isNull()) {
// Require no proTxHash otherwise
throw JSONRPCError(RPC_INVALID_PARAMETER, "Should not specify proTxHash");
Copy link
Member

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?

@UdjinM6
Copy link
Author

UdjinM6 commented Dec 17, 2023

dropped c5a66ff and 16f5e00, adjusted d0a4894

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a 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

@UdjinM6
Copy link
Author

UdjinM6 commented Dec 17, 2023

utACK for squash merge; LGTM if you think c5a66ff is valuable, let's open a new PR targeted for v21 with release notes?

#5772

Approval contingent on CI

Gitlab had some unrelated issues https://gitlab.com/dashpay/dash/-/jobs/5770189961, restarted it

Copy link
Collaborator

@knst knst left a 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.

if (msg_type == NetMsgType::QWATCH) {
if (!fMasternodeMode) {
// non-masternodes should never receive this
m_peerman->Misbehaving(pfrom.GetId(), 10);
Copy link
Collaborator

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

return;
}

if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled())) {
Copy link
Collaborator

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.

}

{
if (fMasternodeMode || utils::IsWatchQuorumsEnabled()) {
Copy link
Collaborator

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 ;
}

Copy link
Collaborator

@knst knst left a 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!

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a 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

@PastaPastaPasta PastaPastaPasta merged commit c25d9ae into dashpay:develop Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants