-
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: assert in signing_shares for quorums with 3 members but 2 nodes only #6261
fix: assert in signing_shares for quorums with 3 members but 2 nodes only #6261
Conversation
fc8f802
to
7690e8c
Compare
src/llmq/signing_shares.cpp
Outdated
@@ -809,7 +809,7 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256& | |||
|
|||
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, size_t attempt) | |||
{ | |||
assert(size_t(attempt) < quorum->members.size()); | |||
assert(size_t(attempt) <= quorum->members.size()); |
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.
Interesting. However if we are going to allow attempt
to wrap around then quorum->members.size()
is actually irrelevant here imo, attempt
should be limited by recoveryMembers
instead.
From src/llmq/params.h
:
// How many members should we try to send all sigShares to before we give up.
int recoveryMembers;
Pls consider 8ff9ba1.
…nt of attempts Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
…sure that is enough
7690e8c
to
f44edde
Compare
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 f44edde
@@ -807,9 +807,9 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256& | |||
sigman.ProcessRecoveredSig(rs); | |||
} | |||
|
|||
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, size_t attempt) | |||
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, int attempt) |
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.
nit: clang format complains
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, int attempt) | |
CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256& id, int attempt) |
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 will fix it if need to force-push again.
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 f44edde
Issue being fixed or feature implemented
Currently we have several quorums which have size 3 with threshold 2 nodes:
llmq_test_instantsend
,llmq_test_platform
,llmq_test
and they are used on RegTest.For extreme case when only 2 nodes exist the assert happens:
Discovered during implementation of https://github.com/dashpay/dash-issues/issues/77
What was done?
Changed condition in assert, implemented special case of using Nth element from array size N for
SelectMemberForRecovery
, added test for this case.How Has This Been Tested?
Improved functional test
feature_asset_locks.py
to test this corner case for quorumllmq_test_instantsend
andllmq_test_platform
Breaking Changes
N/A
Checklist: