Skip to content

Evo: ignore stale block tip notifications - #1941

Merged
reubenyap merged 1 commit into
firoorg:masterfrom
navidR:dev/navidr/ignore-stale-dmn-tip-notifications
Sep 28, 2026
Merged

reubenyap merged 1 commit into
firoorg:masterfrom
navidR:dev/navidr/ignore-stale-dmn-tip-notifications

Conversation

@navidR

@navidR navidR commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Ignore delayed deterministic-masternode tip notifications when their block is no longer the active chain tip. Add regressions covering stale callbacks and valid pure-disconnect updates after repeated invalidations.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 88bd533b-fb46-4b7f-aa84-57c8188ccd70

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0c771 and ed931df.

📒 Files selected for processing (2)
  • src/evo/deterministicmns.cpp
  • src/test/evo_deterministicmns_tests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Summary by CodeRabbit

  • Bug Fixes
    • Masternode updates now apply only to the active chain tip. Delayed notifications for outdated blocks no longer overwrite the current masternode state, including during block disconnections and invalidations. This keeps the reported masternode set aligned with the chain’s current tip as it changes.

Walkthrough

UpdatedBlockTip now ignores block indexes that are not the active chain tip. Tests cover pure disconnect notifications and delayed updates for stale tips.

Changes

Deterministic MN tip updates

Layer / File(s) Summary
Active-tip guard and disconnect coverage
src/evo/deterministicmns.cpp, src/test/evo_deterministicmns_tests.cpp
UpdatedBlockTip updates tipIndex only for the active chain tip. Disconnect tests check the restored active tip and MN set, then send delayed updates for stale tips.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: levonpetrosyan93

Merge Risk: ⚪ Minimal · up to ed931

The stale-tip guard and regression coverage are mergeable with no identified blocking risk.

Security Architecture Review

Security architecture risk: 🔵 Low · up to ed931

The new check prevents delayed notifications from restoring an obsolete masternode list. No new security exposure was established, but recovery after a partially failed chain transition remains insufficiently covered.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Exposure is concentrated in a node's active-chain masternode-list selection and its consumers. The change does not establish a new externally callable entrypoint or cross-service dependency.

Trust Boundaries and Controls

  • observed — The callback now compares a notified block with the validation-owned active tip under cs_main before changing manager state. Repeated-invalidation coverage sends a delayed stale tip and checks that the selected list remains unchanged.

Resilience and Maintainability Implications

  • inferred — The stale-callback regressions do not establish what list consumers see after a partially completed disconnect that returns without a tip notification.

Hardening Proposals

  • proposed — Separately verify and, if necessary, restore manager-tip synchronization when validation exits after a partial disconnect or interrupted transition.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. 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 and concisely identifies the main change: ignoring stale block tip notifications.
Description check ✅ Passed The description explains the intended behavior change and identifies the regression coverage for stale callbacks and pure-disconnect updates. It omits the template headings and the optional code chang…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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.

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

Reviewed the current draft head. I traced queued tip notifications through the deterministic-masternode manager, checked every tipIndex reader, and verified the cs_main-to-manager lock order against block processing. The stale callback is rejected while current and null-tip updates still work, and the full CI matrix is green. I found no actionable issues.

@navidR
navidR marked this pull request as ready for review September 28, 2026 09:18
@codeant-ai

codeant-ai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR ed931df Sep 28, 2026 · 09:18 09:20

@codeant-ai

codeant-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:S This PR changes 10-29 lines, ignoring generated files label Sep 28, 2026
@codeant-ai

codeant-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown

User description

Ignore delayed deterministic-masternode tip notifications when their block is no longer the active chain tip. Add regressions covering stale callbacks and valid pure-disconnect updates after repeated invalidations.


CodeAnt-AI Description

Ignore stale deterministic masternode tip notifications

What Changed

  • Deterministic masternode state now ignores delayed tip updates when the reported block is no longer the active chain tip
  • Chain reorganizations and repeated invalidations continue restoring the correct masternode list
  • Regression coverage verifies stale callbacks do not overwrite valid updates

Impact

✅ Consistent masternode lists after chain reorganizations
✅ Fewer stale tip updates
✅ Reliable masternode state after repeated block invalidations

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@navidR
navidR requested a review from reubenyap September 28, 2026 09:23
@reubenyap
reubenyap merged commit 3d50187 into firoorg:master Sep 28, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants