Skip to content

Harden masternode handling to avoid empty validator sets#4

Draft
Copilot wants to merge 3 commits into
v0/deejae69-2866302dfrom
copilot/improve-master-functionality
Draft

Harden masternode handling to avoid empty validator sets#4
Copilot wants to merge 3 commits into
v0/deejae69-2866302dfrom
copilot/improve-master-functionality

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 24, 2026

The “Master improvements” scope needed safeguards to prevent empty masternode sets and clearer validation when epoch data is missing.

Changes

  • Snapshot handling: fail fast when penalties remove all candidates to avoid empty validator sets.
  • Leader selection: guard HotStuff leader lookup against null/empty masternode arrays.
  • Seal validation: return clear errors when epoch info or masternodes are absent; align messaging.
  • Tests: added coverage for fully penalized snapshots and missing/empty masternode validation paths.

Key check:

EnsureMasternodesAvailable(candidates, blockNumber); // SnapshotManager
if (currentMasternodes is null || currentMasternodes.Length == 0) throw ...; // HotStuff leader selection

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Targeted XDC tests added/executed for penalized snapshots and missing/empty masternode cases.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

Remarks

None.

Original prompt

Master improvements


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.


Summary by cubic

Hardens masternode handling to prevent crashes and report clear errors when none are available. Adds explicit checks: SnapshotManager now throws when penalties remove all candidates, XdcHotStuff throws on empty/null sets, and XdcSealValidator fails with a message if epoch info is missing or empty; adds focused tests.

Written for commit 55f6e34. Summary will update on new commits.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
express-4bpo Error Error Mar 29, 2026 7:41am

@Deejae69
Copy link
Copy Markdown
Owner

Deejae69 commented Mar 24, 2026 via email

Copilot AI and others added 2 commits March 24, 2026 17:05
Co-authored-by: Deejae69 <179696940+Deejae69@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Deejae69/nethermind/sessions/dca6063e-0d71-4707-af2a-aad7ffcd5f30
Co-authored-by: Deejae69 <179696940+Deejae69@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Deejae69/nethermind/sessions/dca6063e-0d71-4707-af2a-aad7ffcd5f30
Copilot AI changed the title [WIP] Enhance master process efficiency Harden masternode handling to avoid empty validator sets Mar 24, 2026
Copilot AI requested a review from Deejae69 March 24, 2026 17:08
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Modifies core consensus logic and error handling in XDC masternode selection, which is a critical path requiring human review for protocol safety.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Requires human review: This PR modifies core consensus logic for XDC (SnapshotManager, HotStuff, and SealValidator), including new error handling and exceptions in critical execution paths.

Copy link
Copy Markdown
Owner

@Deejae69 Deejae69 left a comment

Choose a reason for hiding this comment

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

Improve coding

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.

2 participants