Skip to content

refactor: simplify architecture of quorum observer and quorum participant#7247

Open
knst wants to merge 16 commits intodashpay:developfrom
knst:refactor-llmq-observer-parent
Open

refactor: simplify architecture of quorum observer and quorum participant#7247
knst wants to merge 16 commits intodashpay:developfrom
knst:refactor-llmq-observer-parent

Conversation

@knst
Copy link
Copy Markdown
Collaborator

@knst knst commented Mar 24, 2026

Issue being fixed or feature implemented

It's a follow-up for #7066 and related PRs

This PR is reducing mental concentration when reading quorum-related code by significant simplification amount of levels of abstractions and inheritance classes from each other.

This PR is a direct dependency of #7234 (kernel / chainstate project)

Performance is not expected to be improved by any noticeable margin.

Compilation time is expected to be improved marginally due to fewer files (-2) to compile and less transitive includes over src/llmq/quorumsman.h.

What was done?

This changes has been spotted during #7234 and extracted to own PR.

  • Remove QuorumObserverParent; decouple QuorumParticipant from QuorumObserver inheritance — they become independent implementations of a common QuorumRole interface.
  • Merge QuorumObserver and ObserverContext into a single class, then remove the transitional QuorumRoleBase by folding it into QuorumRole.
  • Rename src/llmq/observer/context.{h,cpp} to src/llmq/observer.{h,cpp} — flatten the now-single-file subdirectory.
  • Inline QuorumParticipant into ActiveContext — it only applies to active masternode mode; src/active/quorums.{h,cpp} deleted.
  • Remove four friend declarations from CDKGSession (ActiveDKGSession, ActiveDKGSessionHandler, CDKGSessionHandler, CDKGSessionManager); affected members changed from private to protected.
  • Extract network code from CQuorumManager and ActiveContext into new NetQuorum (src/llmq/net_quorum.{h,cpp}) — handles QGETDATA/QDATA processing, quorum peer connections, data recovery, and periodic cleanup.

Class hierarchy — before vs. after

*by claude

Before:
QuorumObserverParent (interface, implemented by CQuorumManager)

QuorumObserver (base class with shared state)
├── ObserverContext (observer mode, also CValidationInterface)
└── QuorumParticipant (active mode, in src/active/quorums.h)

After:
QuorumRole (pure virtual interface in quorumsman.h)
├── ObserverContext (observer mode, in src/llmq/observer.h)
└── ActiveContext (active mode, QuorumParticipant inlined)

How Has This Been Tested?

Run unit & functional 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

Loading
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