Skip to content

fix(net): follow up on ChainLock cache feedback - #7548

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/chainlock-cache-followup
Aug 6, 2026
Merged

fix(net): follow up on ChainLock cache feedback#7548
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/chainlock-cache-followup

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Aug 5, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Follow-up to #7482 addressing post-merge review feedback.

What was done?

  • Renamed limited-map thresholds so max_size() is the actual maximum and cutoff_size() is the post-prune size.
  • Removed the detailed ChainLock implementation comments and test-only threshold accessors.
  • Preserved the existing 1,024/2,048 ChainLock cache configuration.
  • Reworked the ChainLock test around a fixed 2,500-entry safety bound and recent CLSIG availability, without asserting internal pruning details.

How Has This Been Tested?

  • make -j1
  • ./src/test/test_dash --run_test=limitedmap_tests/* --log_level=message
  • ./src/test/test_dash --run_test=llmq_chainlock_tests/* --log_level=message
  • test/lint/lint-whitespace.py
  • test/lint/lint-includes.py

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have added or updated relevant unit/integration/functional/e2e tests

This pull request was created by Codex.

@thepastaclaw

thepastaclaw commented Aug 5, 2026

Copy link
Copy Markdown

✅ Final review complete — no blockers (commit e5c8384)

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

unordered_limitedmap now separates the retained cutoff from the pruning maximum. Its APIs and pruning logic use the new semantics. The chainlock cache uses fixed cutoff and maximum sizes of 1024 and 2048. Testing accessors for internal cache thresholds were removed. Tests now verify bounded growth, batch pruning, recent-entry retention, and eviction behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • dashpay/dash#7482: Both changes modify unordered_limitedmap and seen-chainlock cache sizing and pruning semantics.

Suggested reviewers: thepastaclaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies this as a follow-up fix for ChainLock cache feedback, which matches the main changes.
Description check ✅ Passed The description accurately covers the limited-map threshold changes, ChainLock cache updates, tests, and lint checks.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/test/llmq_chainlock_tests.cpp`:
- Around line 216-237: Update the chainlock cache recency logic exercised by
ProcessNewChainLock so entries sharing the same seconds-resolution timestamp are
ordered by insertion order, preserving the newest RECENT_CHAINLOCKS_TO_RETAIN
entries during pruning. Extend the test around the process lambda with a
same-timestamp burst, assert the required recent-hash retention and cache-size
bounds, and keep the existing distinct-timestamp coverage intact.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cda9fa71-c20c-4405-b7b3-edd340ebc2e5

📥 Commits

Reviewing files that changed from the base of the PR and between 43ec910 and 1c6054b.

📒 Files selected for processing (5)
  • src/chainlock/handler.cpp
  • src/chainlock/handler.h
  • src/limitedmap.h
  • src/test/limitedmap_tests.cpp
  • src/test/llmq_chainlock_tests.cpp

Comment thread src/test/llmq_chainlock_tests.cpp
@PastaPastaPasta
PastaPastaPasta force-pushed the fix/chainlock-cache-followup branch from 1c6054b to e5c8384 Compare August 5, 2026 20:58
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/chainlock/handler.h`:
- Around line 57-58: Update the SEEN_CHAINLOCKS_CUTOFF_SIZE and
SEEN_CHAINLOCKS_MAX_SIZE constants in the chainlock handler to use the specified
bounds of 1000 and 2000, respectively, rather than deriving them from the
current 1024 cutoff.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7112e897-4fea-4b28-b0ea-9596aef77819

📥 Commits

Reviewing files that changed from the base of the PR and between 43ec910 and e5c8384.

📒 Files selected for processing (5)
  • src/chainlock/handler.cpp
  • src/chainlock/handler.h
  • src/limitedmap.h
  • src/test/limitedmap_tests.cpp
  • src/test/llmq_chainlock_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/test/llmq_chainlock_tests.cpp
  • src/test/limitedmap_tests.cpp
  • src/chainlock/handler.cpp
  • src/limitedmap.h

Comment thread src/chainlock/handler.h

@knst knst left a comment

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.

utACK e5c8384

@PastaPastaPasta
PastaPastaPasta merged commit c4c8b98 into dashpay:develop Aug 6, 2026
53 of 55 checks passed
@PastaPastaPasta PastaPastaPasta added this to the 24 milestone Aug 7, 2026
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.

3 participants