Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Feb 13, 2022

Follow-up work to my on-going review of #2722 (review). Starts in eeefe79c.

The current intra-quorum relay members selection algorithm receives a quorum member and selects a number of relay connections equals to the quorum size bits count.
So, for example: each DMN, in a quorum of 400 members, deterministically selects 9 other members and mark them as intra-quorum-relay members.

In the test LLMQ params case, with a quorum of 2, this algorithm falls into an infinite loop. Blocking the node's LLMQ session forever.
The process cannot select the input member for intra-quorum relay and expects to return a minimum of 2 elements.

Added a test case commit first so the issue can be easily verified/tested.

Aside from that, added some other performance improvements and cleanups for the LLMQ sessions:


  1. Faster and cleaner GetQuorumRelayMembers calculation.
    1. No need to re-calculate the quorum members internally, the function' callers already have calculated the DMN list.
    2. As 'onlyOutbound' argument is always true. There is no need to loop over all the quorum members. The function only calculates the local DMN outbound relay connections.
  2. Inside the CDKGSessionHandler::UpdateBlockTip: No need to walk-backwards through the chain to get the last quorum index. Can just look it up on chainActive`.
  3. GetPhaseAndQuorumHash() returning an struct instead of a pair.
  4. Remove unused 'messageHandlerPool' field in the CDKGSession` class.

@furszy furszy self-assigned this Feb 13, 2022
@furszy furszy changed the title [LLMQ][BugFix] Fix infinite loop in quorum relay members selection algorithm [WIP][LLMQ][BugFix] Fix infinite loop in quorum relay members selection algorithm Feb 13, 2022
@furszy furszy force-pushed the 2022_GetQuorumRelayMembers_infinite_loop branch from e17129a to c9a0ebb Compare February 14, 2022 02:54
@furszy furszy changed the title [WIP][LLMQ][BugFix] Fix infinite loop in quorum relay members selection algorithm [LLMQ][BugFix] Fix infinite loop in quorum relay members selection algorithm Feb 14, 2022
@furszy furszy force-pushed the 2022_GetQuorumRelayMembers_infinite_loop branch from 79ecd82 to 90743c8 Compare February 15, 2022 20:58
furszy and others added 12 commits February 16, 2022 12:41
…t the last quorum index.

Can just look it up on chainActive.
1) No need to re-calculate the quorum members internally, all the function' callers already have calculated the list.

2) As 'onlyOutbound' argument is always true. There is no need to loop over all the quorum members. The function only calculates the local DMN outbound relay connections.
Also more strict checking of expected size in unit test
by initializing CDeterministicMNCPtr lists.

Also speed up get_quorum_relay_members test loop by precomputing the
log2 and checking quorum sizes in decreasing order.

Also test up to 2000-mns quorums
@furszy furszy force-pushed the 2022_GetQuorumRelayMembers_infinite_loop branch from 64f5f21 to b4e7fe1 Compare February 16, 2022 15:41
@furszy
Copy link
Author

furszy commented Feb 16, 2022

Rebased on master, plus added three cool commits from zebra that simplify the new test code.

Ready to go.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

obviously, ACK b4e7fe1

@furszy furszy merged commit fe98913 into PIVX-Project:master Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants