Skip to content

refactor: introduce two new cache structures to minimize cs_main cont…#6418

Closed
PastaPastaPasta wants to merge 2 commits intodashpay:developfrom
PastaPastaPasta:refactor-minimize-cs_main-contention-quorum-signing
Closed

refactor: introduce two new cache structures to minimize cs_main cont…#6418
PastaPastaPasta wants to merge 2 commits intodashpay:developfrom
PastaPastaPasta:refactor-minimize-cs_main-contention-quorum-signing

Conversation

@PastaPastaPasta
Copy link
Copy Markdown
Member

…ention during llmq signing

Please remove the italicized help prompts before submitting or merging

Provide a general summary of your changes in the Title above

Pull requests without a rationale and clear improvement may be closed
immediately.

Please provide clear motivation for your patch and explain how it improves
Dash Core user experience or Dash Core developer experience
significantly:

  • Any test improvements or new tests that improve coverage are always welcome.
  • All other changes should have accompanying unit tests (see src/test/) or
    functional tests (see test/). Contributors should note which tests cover
    modified code. If no tests exist for a region of modified code, new tests
    should accompany the change.
  • Bug fixes are most welcome when they come with steps to reproduce or an
    explanation of the potential issue as well as reasoning for the way the bug
    was fixed.
  • Features are welcome, but might be rejected due to design or scope issues.
    If a feature is based on a lot of dependencies, contributors should first
    consider building the system outside of Dash Core, if possible.

Issue being fixed or feature implemented

  • Why is this change required? What problem does it solve?
  • If it fixes an open issue, please link to the issue here.

What was done?

Describe your changes in detail

How Has This Been Tested?

Please describe in detail how you tested your changes.

Include details of your testing environment, and the tests you ran
to see how your change affects other areas of the code, etc.

Breaking Changes

Please describe any breaking changes your code introduces

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • 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)

@PastaPastaPasta PastaPastaPasta force-pushed the refactor-minimize-cs_main-contention-quorum-signing branch from e6a28c4 to 6cae4a5 Compare November 21, 2024 04:40
Comment thread src/llmq/quorums.cpp
auto pindexStart = [&]() -> const CBlockIndex*
{
LOCK(cs_main);
auto chainTip = cachedChainTip.load();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if cachedChainTip is null, better to load it from active_chain IMO

PastaPastaPasta added a commit that referenced this pull request Nov 22, 2024
… contention

3d67771 refactor: add in quorumBaseBlockIndexCache to reduce cs_main contention (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  subset of #6418; only includes the new quorumBaseBlockIndexCache, doesn't include the caching of the chain-tip, as that introduced regressions I'm still debugging.

  ## What was done?
  introduce a LRU cache for quorumHash -> const CBlockIndex*; this should significantly reduce cs_main contention during high transaction load.

  ## How Has This Been Tested?
  Ran tests locally; let's see CI happy, and I also intend to run this on a testnet MN first and see the level of contention reduction

  ## Breaking Changes
  None

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] 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
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 3d67771
  knst:
    utACK 3d67771

Tree-SHA512: dbb4bdafed095397ca0e12dbd8bba25c108d199538387c71b1ff4285af821f9d9ad0ad4426407a015528270f3c163fa66ce91755efb1c8a7a90fd7cb70a918bc
@github-actions
Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@DashCoreAutoGuix
Copy link
Copy Markdown

❌ Backport Verification - CATASTROPHIC FAILURE

Original Bitcoin commit: Not found
Reviewed commit hash: a8ed736a59-verify-1753726866

Critical violations:

  • No Bitcoin commit reference found in PR title, body, or commit messages
  • Changes are exclusively in Dash-specific llmq/ directory
  • This appears to be native Dash development, not a Bitcoin backport
❌ Analysis

Files changed:

  • src/llmq/ehf_signals.cpp
  • src/llmq/instantsend.cpp
  • src/llmq/quorums.cpp
  • src/llmq/quorums.h
  • src/llmq/signing.cpp
  • src/rpc/quorums.cpp

All files are in the llmq/ directory which contains Dash-specific Long Living Masternode Quorum functionality that does not exist in Bitcoin Core.

The commit messages show:

  • "actually use cachedChainTip"
  • "refactor: (mostly) introduce two new cache structures to minimize cs_main contention during llmq signing"

This is clearly native Dash development work, not a Bitcoin Core backport.

This verification system is designed specifically for Bitcoin Core backports. Native Dash development should follow different review processes and not be processed through the backport verification system.

This PR has been automatically closed. If this is intended to be a Bitcoin backport, please create a new PR with proper Bitcoin commit references and backport structure.

@DashCoreAutoGuix
Copy link
Copy Markdown

Automatically closed: This is not a Bitcoin Core backport but appears to be native Dash development. The backport verification system is designed specifically for Bitcoin Core backports. Please use appropriate review processes for native Dash development.

@PastaPastaPasta
Copy link
Copy Markdown
Member Author

Closing: the LRU cache portion was already merged. Remaining cs_main-free work is superseded by #6962.

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.

3 participants