Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Jun 27, 2025

What was done?

See commits

How Has This Been Tested?

By running test/lint/lint-circular-dependencies.py

-    "coinjoin/coinjoin -> llmq/chainlocks -> net -> coinjoin/coinjoin",
-    "evo/deterministicmns -> validationinterface -> evo/deterministicmns",
-    "evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns",
-    "governance/vote -> masternode/node -> validationinterface -> governance/vote",
-    "llmq/signing -> masternode/node -> validationinterface -> llmq/signing",

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

@knst knst added this to the 23 milestone Jun 27, 2025
@knst knst requested review from PastaPastaPasta and UdjinM6 June 27, 2025 14:45
@coderabbitai
Copy link

coderabbitai bot commented Jun 27, 2025

Walkthrough

This set of changes updates notification interfaces and related method signatures across the codebase to include explicit string identifiers for events and to standardize parameter ownership semantics. Notification methods for governance objects, governance votes, chain locks, and recovered signatures now accept an additional string parameter representing the event's unique identifier, replacing previous internal string generation. Additionally, the deterministic masternode list parameter in governance vote notifications is changed from a const reference to a shared pointer, affecting method signatures and calls in multiple classes and modules, including ZMQ notifier interfaces. Unused header includes are removed, and several expected circular dependencies are eliminated from the linting script. No changes are made to core logic, error handling, or control flow.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29f45ce and e875c42.

📒 Files selected for processing (14)
  • src/governance/governance.cpp (1 hunks)
  • src/governance/object.cpp (1 hunks)
  • src/llmq/chainlocks.cpp (1 hunks)
  • src/llmq/signing.cpp (1 hunks)
  • src/net.cpp (0 hunks)
  • src/validationinterface.cpp (2 hunks)
  • src/validationinterface.h (2 hunks)
  • src/zmq/zmqabstractnotifier.cpp (1 hunks)
  • src/zmq/zmqabstractnotifier.h (1 hunks)
  • src/zmq/zmqnotificationinterface.cpp (1 hunks)
  • src/zmq/zmqnotificationinterface.h (1 hunks)
  • src/zmq/zmqpublishnotifier.cpp (2 hunks)
  • src/zmq/zmqpublishnotifier.h (2 hunks)
  • test/lint/lint-circular-dependencies.py (0 hunks)
💤 Files with no reviewable changes (2)
  • src/net.cpp
  • test/lint/lint-circular-dependencies.py
🚧 Files skipped from review as they are similar to previous changes (12)
  • src/llmq/signing.cpp
  • src/governance/governance.cpp
  • src/llmq/chainlocks.cpp
  • src/zmq/zmqnotificationinterface.h
  • src/governance/object.cpp
  • src/zmq/zmqabstractnotifier.cpp
  • src/zmq/zmqabstractnotifier.h
  • src/zmq/zmqpublishnotifier.cpp
  • src/zmq/zmqnotificationinterface.cpp
  • src/zmq/zmqpublishnotifier.h
  • src/validationinterface.h
  • src/validationinterface.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
src/dsnotificationinterface.h (1)

5-7: Include-guard prefix still reads “BITCOIN”
While outside the immediate scope of this PR, consider renaming the guard to DASH_DSNOTIFICATIONINTERFACE_H (or similar) for long-term consistency with the rest of the Dash-specific headers.

src/llmq/chainlocks.cpp (1)

500-501: Interface update correctly applied
NotifyChainLock(…, clsig, clsig->ToString()) matches the new signature.

Minor nit: clsig->ToString() is calculated multiple times in this method; caching it once (e.g. const std::string clsigStr = clsig->ToString();) would avoid a few redundant string constructions, though the impact is negligible.

src/llmq/signing.cpp (1)

647-648: Call site aligned with new signal signature
NotifyRecoveredSig(recoveredSig, recoveredSig->GetHash().ToString()) compiles with the refactored interface.

As with the previous file, you could cache the hash string once earlier in the method to avoid repeating .ToString() if this path becomes hot.

src/governance/object.cpp (1)

165-165: Fix formatting and approve notification interface update.

The functional changes are correct - converting to shared pointers and adding the vote hash identifier aligns with the notification interface refactor. However, there's a clang formatting issue that needs to be addressed.

Please run clang-format to fix the formatting issue:

-    GetMainSignals().NotifyGovernanceVote(std::make_shared<CDeterministicMNList>(tip_mn_list), std::make_shared<const CGovernanceVote>(vote), vote.GetHash().ToString());
+    GetMainSignals().NotifyGovernanceVote(std::make_shared<CDeterministicMNList>(tip_mn_list), 
+                                          std::make_shared<const CGovernanceVote>(vote), 
+                                          vote.GetHash().ToString());
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f453998 and b773967.

📒 Files selected for processing (15)
  • src/dsnotificationinterface.h (1 hunks)
  • src/governance/governance.cpp (1 hunks)
  • src/governance/object.cpp (1 hunks)
  • src/llmq/chainlocks.cpp (1 hunks)
  • src/llmq/signing.cpp (1 hunks)
  • src/net.cpp (0 hunks)
  • src/validationinterface.cpp (2 hunks)
  • src/validationinterface.h (2 hunks)
  • src/zmq/zmqabstractnotifier.cpp (1 hunks)
  • src/zmq/zmqabstractnotifier.h (1 hunks)
  • src/zmq/zmqnotificationinterface.cpp (1 hunks)
  • src/zmq/zmqnotificationinterface.h (1 hunks)
  • src/zmq/zmqpublishnotifier.cpp (2 hunks)
  • src/zmq/zmqpublishnotifier.h (2 hunks)
  • test/lint/lint-circular-dependencies.py (0 hunks)
💤 Files with no reviewable changes (2)
  • src/net.cpp
  • test/lint/lint-circular-dependencies.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
src/dsnotificationinterface.h (1)
Learnt from: kwvg
PR: dashpay/dash#6530
File: src/validation.cpp:4514-4516
Timestamp: 2025-01-14T08:40:00.994Z
Learning: In Dash Core, error() is used (instead of state.Invalid()) to report critical failures that require immediate user intervention, particularly for database/disk errors and data corruption scenarios. This is an established pattern seen in validation.cpp.
🧬 Code Graph Analysis (5)
src/llmq/chainlocks.cpp (2)
src/validationinterface.cpp (2)
  • GetMainSignals (116-119)
  • GetMainSignals (116-116)
src/validationinterface.h (1)
  • GetMainSignals (247-247)
src/zmq/zmqabstractnotifier.cpp (3)
src/validationinterface.cpp (2)
  • NotifyGovernanceVote (286-291)
  • NotifyGovernanceVote (286-286)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyGovernanceVote (223-228)
  • NotifyGovernanceVote (223-223)
src/zmq/zmqpublishnotifier.cpp (4)
  • NotifyGovernanceVote (265-273)
  • NotifyGovernanceVote (265-265)
  • NotifyGovernanceVote (436-443)
  • NotifyGovernanceVote (436-436)
src/governance/governance.cpp (2)
src/validationinterface.cpp (2)
  • GetMainSignals (116-119)
  • GetMainSignals (116-116)
src/validationinterface.h (1)
  • GetMainSignals (247-247)
src/zmq/zmqpublishnotifier.h (3)
src/validationinterface.h (3)
  • tip_mn_list (169-169)
  • tip_mn_list (169-169)
  • tip_mn_list (237-237)
src/zmq/zmqabstractnotifier.h (1)
  • tip_mn_list (75-75)
src/zmq/zmqnotificationinterface.h (1)
  • tip_mn_list (36-36)
src/validationinterface.h (3)
src/zmq/zmqabstractnotifier.h (8)
  • tip_mn_list (75-75)
  • pindex (62-62)
  • pindex (64-64)
  • pindex (66-66)
  • pindex (73-73)
  • object (76-76)
  • currentTx (77-77)
  • sig (78-78)
src/zmq/zmqnotificationinterface.h (5)
  • tip_mn_list (36-36)
  • pindex (34-34)
  • object (37-37)
  • currentTx (38-38)
  • sig (39-39)
src/zmq/zmqpublishnotifier.h (14)
  • tip_mn_list (66-66)
  • tip_mn_list (135-135)
  • pindex (42-42)
  • pindex (48-48)
  • pindex (90-90)
  • pindex (96-96)
  • pindex (102-102)
  • pindex (114-114)
  • pindex (115-115)
  • object (72-72)
  • object (141-141)
  • currentTx (78-78)
  • currentTx (147-147)
  • sig (153-153)
🪛 GitHub Actions: Clang Diff Format Check
src/governance/object.cpp

[error] 162-163: Clang format differences found. Code formatting does not match the expected style. Please run clang-format to fix the formatting issues.

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: linux64_nowallet-build / Build source
  • GitHub Check: mac-build / Build source
  • GitHub Check: win64-build / Build source
  • GitHub Check: linux64_ubsan-build / Build source
  • GitHub Check: linux64-build / Build source
  • GitHub Check: linux64_fuzz-build / Build source
  • GitHub Check: linux64_sqlite-build / Build source
  • GitHub Check: linux64_tsan-build / Build source
  • GitHub Check: linux64_multiprocess-build / Build source
  • GitHub Check: arm-linux-build / Build source
🔇 Additional comments (15)
src/dsnotificationinterface.h (1)

1-1: Updated copyright notice acknowledged
Change is correct and consistent with Dash Core’s licensing header style.

src/governance/governance.cpp (1)

361-361: LGTM: Correctly adds governance object hash identifier to notification.

The addition of nHash.ToString() as the second parameter to NotifyGovernanceObject is consistent with the broader refactor to include string identifiers in notification methods for improved traceability.

src/zmq/zmqabstractnotifier.cpp (1)

56-59: LGTM: Parameter type conversion aligns with shared ownership pattern.

The change from const CDeterministicMNList& to std::shared_ptr<CDeterministicMNList>& is consistent with the broader refactor to use shared pointers for the deterministic masternode list in notification interfaces.

src/zmq/zmqnotificationinterface.h (1)

36-36: LGTM: Interface signature correctly updated for shared pointer parameter.

The parameter type change from const CDeterministicMNList& to std::shared_ptr<CDeterministicMNList>& is consistent with the notification interface refactor and maintains compatibility with the implementation.

src/zmq/zmqabstractnotifier.h (1)

75-75: LGTM: Virtual method signature correctly updated for shared pointer parameter.

The parameter type change from const CDeterministicMNList& to std::shared_ptr<CDeterministicMNList>& ensures all derived ZMQ notifiers use consistent shared pointer parameters in their NotifyGovernanceVote implementations.

src/zmq/zmqnotificationinterface.cpp (1)

223-228: LGTM: Parameter type change aligns with dependency refactoring.

The change from const CDeterministicMNList& to std::shared_ptr<CDeterministicMNList> is consistent with the broader refactoring to eliminate circular dependencies. The shared ownership semantics provide better lifetime management and the lambda implementation correctly forwards the parameters to the notifiers.

src/zmq/zmqpublishnotifier.h (1)

66-66: LGTM: Method signatures updated consistently.

Both CZMQPublishHashGovernanceVoteNotifier and CZMQPublishRawGovernanceVoteNotifier method signatures are properly updated to use std::shared_ptr<CDeterministicMNList>, maintaining consistency with the base class interface changes and supporting the circular dependency elimination goals.

Also applies to: 135-135

src/zmq/zmqpublishnotifier.cpp (2)

265-273: LGTM: Method signature updated correctly.

The CZMQPublishHashGovernanceVoteNotifier::NotifyGovernanceVote method signature is properly updated to use std::shared_ptr<CDeterministicMNList>, and the implementation logic remains unchanged and correct.


436-443: LGTM: Proper shared_ptr usage in implementation.

The method signature and implementation are correctly updated. The shared_ptr is properly dereferenced with *tip_mn_list when passed to vote->ToString(), which expects a reference to the underlying object.

src/validationinterface.cpp (4)

277-284: LGTM: Enhanced interface with explicit ID parameter.

The addition of the const std::string& id parameter to NotifyChainLock allows callers to provide explicit identifiers, reducing internal dependencies. The logging correctly uses the passed id parameter instead of generating it internally, which supports the circular dependency elimination goals.


286-291: LGTM: Consistent interface updates for governance notifications.

Both the parameter type change to std::shared_ptr<CDeterministicMNList> and the addition of the id parameter are well-implemented. The logging uses the provided id string, eliminating the need for internal ID generation and supporting dependency reduction.


293-298: LGTM: Governance object notification updated consistently.

The addition of the id parameter and corresponding logging update follows the same pattern as other notification methods, maintaining consistency across the interface.


309-315: LGTM: Recovered signature notification enhanced appropriately.

The NotifyRecoveredSig method is consistently updated with the id parameter, and the logging properly utilizes the provided identifier string.

src/validationinterface.h (2)

169-169: LGTM: Virtual interface updated for consistency.

The change from const CDeterministicMNList& to std::shared_ptr<CDeterministicMNList> in the virtual NotifyGovernanceVote method ensures all derived classes use consistent parameter types and supports improved lifetime management for circular dependency elimination.


236-240: LGTM: Main signals interface enhanced with explicit identifiers.

The addition of const std::string& id parameters to NotifyChainLock, NotifyGovernanceVote, NotifyGovernanceObject, and NotifyRecoveredSig methods, along with the shared_ptr change for the governance vote method, creates a consistent interface that reduces internal dependencies and supports the circular dependency elimination objectives.

@knst knst force-pushed the refactor-circular-dsnotificationinterface branch from b773967 to e66d2cf Compare June 27, 2025 14:49
@knst knst requested a review from kwvg July 1, 2025 15:10
kwvg
kwvg previously approved these changes Jul 1, 2025
Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK e66d2cf

fDirtyCache = true;
// SEND NOTIFICATION TO SCRIPT/ZMQ
GetMainSignals().NotifyGovernanceVote(tip_mn_list, std::make_shared<const CGovernanceVote>(vote));
GetMainSignals().NotifyGovernanceVote(std::make_shared<CDeterministicMNList>(tip_mn_list),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a huge fan of this but existing practice so it's probably alright

UdjinM6
UdjinM6 previously approved these changes Jul 2, 2025
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK e66d2cf

@github-actions
Copy link

github-actions bot commented Jul 4, 2025

This pull request has conflicts, please rebase.

@knst knst dismissed stale reviews from UdjinM6 and kwvg via 24fed4a July 5, 2025 13:08
@knst knst force-pushed the refactor-circular-dsnotificationinterface branch from e66d2cf to 24fed4a Compare July 5, 2025 13:08
@knst knst requested review from UdjinM6 and kwvg July 5, 2025 13:09
kwvg
kwvg previously approved these changes Jul 6, 2025
Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK 24fed4a

UdjinM6
UdjinM6 previously approved these changes Jul 6, 2025
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK 24fed4a

@github-actions
Copy link

github-actions bot commented Jul 7, 2025

This pull request has conflicts, please rebase.

@knst knst dismissed stale reviews from UdjinM6 and kwvg via 27899d2 July 7, 2025 08:11
@knst knst force-pushed the refactor-circular-dsnotificationinterface branch from 24fed4a to 27899d2 Compare July 7, 2025 08:11
kwvg
kwvg previously approved these changes Jul 7, 2025
Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK 27899d2

UdjinM6
UdjinM6 previously approved these changes Jul 8, 2025
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

rebase looks clean

re-utACK 27899d2

These circular dependencies exists only because excessive logging here.
Prepared extra debug info outside of validationinterface
@github-actions
Copy link

github-actions bot commented Jul 9, 2025

This pull request has conflicts, please rebase.

@knst knst dismissed stale reviews from UdjinM6 and kwvg via 29f45ce July 9, 2025 18:43
@knst knst force-pushed the refactor-circular-dsnotificationinterface branch from 27899d2 to 29f45ce Compare July 9, 2025 18:43
@PastaPastaPasta PastaPastaPasta force-pushed the refactor-circular-dsnotificationinterface branch from 29f45ce to e875c42 Compare July 9, 2025 18:46
@PastaPastaPasta
Copy link
Member

Rebased on latest develop

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 e875c42; builds locally

Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK e875c42

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK e875c42

@PastaPastaPasta PastaPastaPasta merged commit fe99b59 into dashpay:develop Jul 10, 2025
34 of 36 checks passed
@knst knst deleted the refactor-circular-dsnotificationinterface branch July 16, 2025 08:12
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