Skip to content

fix: bound governance inv request cache#7425

Closed
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix/governance-inv-request-bound
Closed

fix: bound governance inv request cache#7425
thepastaclaw wants to merge 1 commit into
dashpay:developfrom
thepastaclaw:fix/governance-inv-request-bound

Conversation

@thepastaclaw

@thepastaclaw thepastaclaw commented Jul 7, 2026

Copy link
Copy Markdown

Issue being fixed or feature implemented

Bounds the governance inventory request cache used to track pending governance object and vote requests.

Previously, unknown governance inventory hashes could be retained until the reliable-propagation timeout without a hard cache size limit. This change keeps that state finite while preserving duplicate handling and response acceptance semantics.

What was done?

  • Added a MAX_REQUESTED_HASHES cap for pending governance inventory request hashes.
  • Preserved duplicate request handling for hashes already in the cache.
  • Added an expiry marker so the full-cache path avoids repeated full-map scans before anything can expire.
  • Added focused unit coverage for cache bounding, duplicate handling, and expiration behavior.

How Has This Been Tested?

Tested locally on macOS in a fresh worktree rebased on current upstream/develop:

  • make -C src test/test_dash -j$(sysctl -n hw.ncpu)
  • src/test/test_dash --run_test=governance_inv_tests
  • git diff --check upstream/develop..HEAD
  • COMMIT_RANGE=upstream/develop..HEAD test/lint/lint-whitespace.py
  • Scoped Codex review of upstream/develop..HEAD: no significant issues found; recommendation ship.

Breaking Changes

None.

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 (for repository code-owners and collaborators only)

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 838acb09-3ac8-4e87-bfa8-5603ee90864f

📥 Commits

Reviewing files that changed from the base of the PR and between 759474f and 93667f0.

📒 Files selected for processing (5)
  • src/governance/governance.cpp
  • src/governance/governance.h
  • src/governance/net_governance.cpp
  • src/init.cpp
  • src/test/governance_inv_tests.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/governance/net_governance.cpp
  • src/init.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/governance/governance.h
  • src/governance/governance.cpp

Walkthrough

The governance manager now stores requested inventory hashes in a bounded 50,000-entry cache. It prunes expired entries, rejects duplicates, evicts entries when saturated, and updates acceptance, clearing, invalid-vote removal, and cleanup to use the new cache. Tests cover expiry, bounds, saturation, FIFO eviction, and re-announcement behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Peer
  participant CGovernanceManager
  participant RequestedHashCache

  Peer->>CGovernanceManager: ConfirmInventoryRequest(inv)
  CGovernanceManager->>RequestedHashCache: Check hash presence
  alt cache full and cleanup due
    CGovernanceManager->>CGovernanceManager: PruneExpiredRequestedHashes(now)
    CGovernanceManager->>RequestedHashCache: Remove expired entries
  end
  CGovernanceManager->>RequestedHashCache: Insert hash and expiry
  RequestedHashCache-->>CGovernanceManager: Evict oldest entry when full
  Peer->>CGovernanceManager: AcceptMessage(nHash)
  CGovernanceManager->>RequestedHashCache: HasKey and erase hash
Loading

Possibly related PRs

  • dashpay/dash#7387: Touches the governance requested-INVs cache plumbing and related tests.

Suggested reviewers: knst, UdjinM6, PastaPastaPasta

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: bounding the governance INV request cache.
Description check ✅ Passed The description accurately describes the cache cap, duplicate handling, pruning, and tests in the changeset.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@thepastaclaw

thepastaclaw commented Jul 7, 2026

Copy link
Copy Markdown
Author

✅ Review complete (commit 93667f0)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: reviewers: opus general failed_quota, gpt-5.5 general completed, opus dash-core-commit-history failed_quota, gpt-5.5 dash-core-commit-history completed; verifier: gpt-5.5 completed after opus verifier failed_quota.

Verified the worktree is exactly at 8b73122 and inspected the governance request-cache changes, related networking paths, cleanup behavior, and added unit coverage. No concrete agent or CodeRabbit findings were present, and I found no in-scope correctness issues to carry forward.

No in-scope findings.

Note: GitHub does not allow me to submit an APPROVE review on my own PR, so this is posted as a COMMENT while preserving the verified clean result.

@thepastaclaw

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thepastaclaw

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

🧹 Nitpick comments (1)
src/governance/governance.cpp (1)

593-616: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Verify unordered_lru_cache fit for this bounded/TTL cache.

The repository's coding guidelines state that src/{masternode,llmq,evo,coinjoin,governance}/**/*.{cpp,h} should use unordered_lru_cache for LRU-evicted caching. m_requested_hash_time is now hand-bounded with a custom cap + TTL-pruning scheme instead. Since this cache needs time-based expiry (not pure recency-based LRU eviction), migrating may not be a clean fit — worth confirming whether unordered_lru_cache supports TTL-style eviction before deciding to refactor.

Logic itself (opportunistic prune-then-cap-check in Lines 594-612) is correct: pruning is only attempted when the cache is already full and the tracked next-cleanup time has passed, and insertion is gated on the post-prune size.

🤖 Prompt for 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.

In `@src/governance/governance.cpp` around lines 593 - 616, The current
m_requested_hash_time cache in CGovernanceManager::ConfirmInventoryRequest is
manually bounded with TTL pruning, so first confirm whether unordered_lru_cache
can support this time-based expiry model before refactoring. If it cannot
express TTL-style eviction cleanly, keep the existing prune-then-cap logic and
document that this cache is intentionally not a pure LRU case; if it can,
migrate the cache while preserving the current full-cache pruning and insertion
gating behavior.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@src/governance/governance.cpp`:
- Around line 593-616: The current m_requested_hash_time cache in
CGovernanceManager::ConfirmInventoryRequest is manually bounded with TTL
pruning, so first confirm whether unordered_lru_cache can support this
time-based expiry model before refactoring. If it cannot express TTL-style
eviction cleanly, keep the existing prune-then-cap logic and document that this
cache is intentionally not a pure LRU case; if it can, migrate the cache while
preserving the current full-cache pruning and insertion gating behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 62f71a87-31c6-42e9-b8b5-1281b0e482db

📥 Commits

Reviewing files that changed from the base of the PR and between f084efb and 43b1ab8.

📒 Files selected for processing (3)
  • src/governance/governance.cpp
  • src/governance/governance.h
  • src/test/governance_inv_tests.cpp

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: reviewers: opus general failed_quota, gpt-5.5 general completed, opus dash-core-commit-history failed_quota, gpt-5.5 dash-core-commit-history completed; verifier: gpt-5.5 completed after opus verifier failed_quota.

Prior reconciliation: the previous exact-SHA review at 8b73122 had zero verified findings, so there are no carried-forward prior findings.

Latest delta: 43b1ab8 only adds the lint-required /* Continued */ marker to the multiline governance LogPrint. That does not introduce a runtime issue, but it is a commit-history fixup to the preceding cache-bound commit.

Cumulative current-head review found no additional code defects. I did not run tests in this review worktree because src/test/test_dash is not built there.

1 suggestion:

Review finding details
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `<commit:43b1ab8>`:
- [SUGGESTION] <commit:43b1ab8>:1: Squash the one-line log-continuation fixup
  Commit 43b1ab805111df18bebfe2f2790a85fdb06e5d79 only changes the LogPrint call introduced by the immediately preceding governance cache-bound commit to add the continuation marker. As permanent history, this is a review fixup rather than a standalone logical change, so it adds avoidable noise to git log and blame for the actual cache fix. Squash it into 8b73122a5466035ec9cdf3e6281bc445e5e82d9a before merge.

@thepastaclaw

Copy link
Copy Markdown
Author

Checked the unordered_lru_cache suggestion. This cache is intentionally time-expiring: entries are pruned by request age and m_requested_hash_time_next_cleanup, not just by recency. unordered_lru_cache would not preserve that TTL behavior cleanly, so I am keeping the current bounded prune-then-cap logic. The existing tests cover duplicate handling, capacity rejection, and expiry after time advances.

@thepastaclaw thepastaclaw force-pushed the fix/governance-inv-request-bound branch from 43b1ab8 to 45e84b5 Compare July 8, 2026 01:03
@thepastaclaw

Copy link
Copy Markdown
Author

Addressed the commit-history review finding by squashing the one-line log-continuation fixup into the original governance cache-bound commit.\n\n- Fixed: <commit:43b1ab8>:1 is folded into 45e84b51886c (single PR commit).\n- Validation: python3 test/lint/lint-logs.py, git diff --check, ./autogen.sh, ./configure --without-gui, make -C src test/test_dash -j4, and src/test/test_dash --run_test=governance_inv_tests all passed locally.

@thepastaclaw

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: reviewers: opus general failed_quota, gpt-5.5 general completed, opus dash-core-commit-history failed_quota, gpt-5.5 dash-core-commit-history completed; verifier: gpt-5.5 completed after opus verifier failed_quota.

Verified current head 45e84b5 against the changed governance cache code, tests, and prior review artifact. The cache bound preserves duplicate handling and response gating, the expiry marker is updated on prune/clear, and the focused tests cover the new cap and expiration path. No in-scope findings remain, and the prior one-line fixup history finding is resolved by the single squashed commit.

Prior reconciliation: prior-1 is FIXED. The previous suggestion to squash the standalone 43b1ab80 log-continuation fixup no longer applies because the current stack is a single substantive commit at 45e84b51.

Carried-Forward Prior Findings: None.

New Findings In Latest Delta: None.

No in-scope findings.

Note: GitHub does not allow me to submit an APPROVE review on my own PR, so this is posted as a COMMENT while preserving the verified clean result.

@thepastaclaw

Copy link
Copy Markdown
Author

Status recheck: #7414 has merged, and this PR is still conflict-clean at 45e84b51886c93bd5c5fd3bb554332b31ffc1575 with predict_conflicts and the Dash CI matrix green. Review state is still REVIEW_REQUIRED, so this should be ready for human review/merge consideration.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Independent current-head DoS review found a saturation policy that turns the memory cap into a global governance-intake eclipse.

Comment thread src/governance/governance.cpp Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18d4725d99

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/governance/governance.cpp Outdated

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: reviewers claude/general=opus(completed), codex/general=gpt-5.5(failed), claude/dash-core-commit-history=opus(completed), codex/dash-core-commit-history=gpt-5.5(failed); verifier=opus

The bounded FIFO cache correctly routes every erase path through EraseRequestedHash so the map and ordering list stay in lockstep, and Clear/Prune reset auxiliary state. Test coverage (bounded, liveness-under-saturation, accept-then-reannounce, expiration cycle) is solid; no correctness, security, or consensus concerns found. Two non-blocking observations: stale test doc comments describing a desync the PR itself eliminates, and a commit-history nit — the two-commit stack should be squashed because 18d4725 reworks the admission policy 45e84b5 just introduced before either has shipped, and Dash merges without squashing so bisect would land on the known-flawed intermediate.

Prior reconciliation: the prior exact-SHA review at 45e84b5 produced zero findings, so nothing is carried forward. Reviewers still confirmed the prior verified output was clean before concluding.

Carried-Forward Prior Findings: none. The prior review was clean; no prior findings exist to re-validate against current head 18d4725.

New Findings In Latest Delta: findings whose root cause is introduced by the 45e84b5..18d4725 delta are listed here, separately from any cumulative current-head findings.

💬 2 nitpick(s)

1 additional finding(s) omitted (not in diff).

Comment thread src/test/governance_inv_tests.cpp Outdated

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/governance/governance.cpp (1)

637-657: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

CacheMap’s ordering contract is required here. PruneExpiredRequestedHashes() assumes the back of GetItemList() is always the oldest entry, and CacheMap does use the back for eviction. Keep this dependency explicit, since any change to Insert/PruneLast ordering would break the prune logic.

🤖 Prompt for 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.

In `@src/governance/governance.cpp` around lines 637 - 657, Document the ordering
dependency in CGovernanceManager::PruneExpiredRequestedHashes: explicitly state
that CacheMap::GetItemList() keeps the oldest entry at the back because CacheMap
eviction uses the back, and that changes to CacheMap::Insert or PruneLast
ordering must preserve this contract.
🤖 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.

Outside diff comments:
In `@src/governance/governance.cpp`:
- Around line 637-657: Document the ordering dependency in
CGovernanceManager::PruneExpiredRequestedHashes: explicitly state that
CacheMap::GetItemList() keeps the oldest entry at the back because CacheMap
eviction uses the back, and that changes to CacheMap::Insert or PruneLast
ordering must preserve this contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 01f08ef2-25f4-472b-9570-5f4a727a3b12

📥 Commits

Reviewing files that changed from the base of the PR and between 18d4725 and 759474f.

📒 Files selected for processing (5)
  • src/governance/governance.cpp
  • src/governance/governance.h
  • src/governance/net_governance.cpp
  • src/init.cpp
  • src/test/governance_inv_tests.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/governance/net_governance.cpp
  • src/init.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/governance_inv_tests.cpp

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: reviewers claude/general=opus(completed), codex/general=gpt-5.5(failed), claude/dash-core-commit-history=opus(completed), codex/dash-core-commit-history=gpt-5.5(failed); verifier=opus

Verified the CacheMap refactor at 759474f1 against cachemap.h, the literal 18d4725d..759474f1 delta, and the full PR diff. Insert deduplicates without reordering, evicts the oldest entry when full so honest INVs remain admissible, and every erase/clear path routes through CacheMap, keeping its index and ordering list synchronized. PruneExpiredRequestedHashes correctly walks the oldest entries under the monotonic-time ordering invariant. No correctness, security, or consensus concerns were found.

Prior Finding Reconciliation

  • FIXED — stale test comments: src/test/governance_inv_tests.cpp:192-215 now describes CacheMap keeping its index and ordering list in lockstep and explicitly says no stale ordering slot can linger. The stale-FIFO wording from the prior finding is gone.
  • STILL VALID — commit-stack squash: the prior suggestion to squash 18d4725d into 45e84b51 remains valid and is broadened to include 759474f1, which replaces the hand-rolled FIFO introduced by 18d4725d with CacheMap before any of the commits ship.

Carried-Forward Prior Findings

  • [SUGGESTION] <commit:18d4725d>:1: Squash the three-commit stack into one — each commit reworks the previous before anything ships

    The three commits are a single never-shipped change iterated in place, not a refactor/feature/tests progression:

    • 45e84b51 adds MAX_REQUESTED_HASHES and makes ConfirmInventoryRequest return false when the cache is full.
    • 18d4725d identifies that return-false behavior as an eclipse vector and replaces it with a hand-rolled FIFO: a std::list<uint256> mirror, iterator storage in the map value, and EraseRequestedHash/EvictOldestRequestedHash helpers.
    • 759474f1 then deletes that entire hand-rolled apparatus and re-implements the same behavior on the existing CacheMap abstraction.

    Because Dash merges without squashing, git bisect into 45e84b51 lands on the deliberately known eclipse-vulnerable design, while 18d4725d introduces a structure discarded one commit later. Squash all three into one fix: bound governance inv request cache commit that uses CacheMap from the start. The current-head code is correct; this is commit-history hygiene only.

New Findings In Latest Delta

None. The CacheMap replacement is behavior-preserving; it only broadens the evidence for the carried-forward squash suggestion above.

Cumulative Current-Head Findings

None beyond the carried-forward commit-history suggestion.

🟡 1 suggestion

🤖 Prompt for the review finding with AI agents
This finding is from an automated code review. Verify it against the current commit stack before acting.

- [SUGGESTION] <commit:18d4725d>:1: Squash the three-commit stack into one. Commits 45e84b51, 18d4725d, and 759474f1 are successive implementations of the same never-shipped bounded governance inventory request-cache change. Squash them into one commit that uses CacheMap from the start so develop history does not retain an eclipse-vulnerable intermediate and a hand-rolled FIFO discarded one commit later.

Bound pending governance inventory requests at the protocol INV limit while preserving intake liveness by evicting the oldest request when saturated.

Keep expiry cleanup correct across wall-clock rollback by scanning all cached entries, and cover capacity, saturation, accept/reannounce ordering, rollback expiry, and real INV routing with unit tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thepastaclaw thepastaclaw force-pushed the fix/governance-inv-request-bound branch from 759474f to 93667f0 Compare July 10, 2026 16:16
@thepastaclaw

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Code Review

Source: orchestrator=openai/gpt-5.6-sol(high, orchestration-only); reviewers codex/general=gpt-5.6-sol(completed), sonnet5/general=claude-sonnet-5(failed), codex/dash-core-commit-history=gpt-5.6-sol(completed), sonnet5/dash-core-commit-history=claude-sonnet-5(failed); fallback verifier=gpt-5.6-sol (verifier-codex-7425-1783704169).

Prior Finding Reconciliation: prior-1 is FIXED. Range-diff and commit history confirm that the former three-commit stack was replaced by the single coherent commit 93667f0, eliminating the superseded intermediate designs and their bisect/blame concerns.

Carried-Forward Prior Findings: none.

New Findings In Latest Delta: none. The literal 759474f..93667f0 delta correctly scans every cached request when expiration order diverges after a wall-clock rollback, preserves valid entries, removes expired entries safely, and recalculates the earliest cleanup time. The added rollback test exercises this behavior.

Additional Cumulative Findings: one documentation nitpick. The test-only maximum-size accessor still describes the superseded drop-new policy even though the cumulative implementation admits new hashes by evicting the oldest cached request. No correctness, security, consensus, or commit-history defects were found. The cumulative PR diff is the single five-file commit above merge base f084efb; diff-check and the scoped whitespace lint pass.

💬 1 nitpick(s)

* ConfirmInventoryRequest pending expiration in CheckAndRemove. */
size_t RequestedHashCacheSizeForTesting() const
EXCLUSIVE_LOCKS_REQUIRED(!cs_store);
/** Test-only accessor: maximum inv hashes tracked before dropping new requests. */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

💬 Nitpick: Accessor comment describes the superseded drop-new policy

The comment says saturation drops new requests, but ConfirmInventoryRequest deliberately admits each new hash and CacheMap::Insert evicts the oldest cached request when the 50,000-entry limit is reached. This eviction behavior is the liveness property implemented at governance.cpp:602-613 and exercised by the saturation tests, so the test API documentation should describe FIFO eviction instead of the superseded refusal policy.

Suggested change
/** Test-only accessor: maximum inv hashes tracked before dropping new requests. */
/** Test-only accessor: maximum inv hashes tracked; saturation evicts the oldest request. */

source: ['codex-general']

@thepastaclaw

Copy link
Copy Markdown
Author

Closing as superseded by #7442, which removes the redundant governance-owned request cache and reuses the bounded per-peer net-layer request tracker instead.

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