Skip to content

fix(consensus): voter-list corruption and duplicate round-validator slots#1349

Open
oXtxNt9U wants to merge 8 commits into
developfrom
fix/evm/consenus-contract
Open

fix(consensus): voter-list corruption and duplicate round-validator slots#1349
oXtxNt9U wants to merge 8 commits into
developfrom
fix/evm/consenus-contract

Conversation

@oXtxNt9U

Copy link
Copy Markdown
Contributor

Summary

  • _unvote: on head removal, clear the new head's prev pointer instead of the tail's. The old code corrupted the voter linked list, letting any voter crash nodes via a getVotes out-of-bounds panic.
  • calculateRoundValidators: revert with InsufficientActiveValidators when there are fewer distinct active validators than the round size, instead of padding slots with duplicates — duplicate slots can never be signed (validatorIndex is not in the signed message), orphaning them and halting consensus.
  • drop redundant persistent _shuffle() (-63% round-selection gas)

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.33%. Comparing base (6284884) to head (8bf6b65).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1349      +/-   ##
===========================================
+ Coverage    59.10%   59.33%   +0.22%     
===========================================
  Files          968      972       +4     
  Lines        65587    66016     +429     
  Branches      1835     1915      +80     
===========================================
+ Hits         38768    39168     +400     
- Misses       26579    26606      +27     
- Partials       240      242       +2     
Flag Coverage Δ
contracts 93.00% <100.00%> (?)
packages 59.11% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

oXtxNt9U added 8 commits June 26, 2026 10:11
  the tail's. The old code corrupted the voter linked list, letting any
  voter crash nodes via a getVotes out-of-bounds panic.

- calculateRoundValidators: revert with InsufficientActiveValidators when
  there are fewer distinct active validators than the round size, instead
  of padding slots with duplicates — duplicate slots can never be signed
  (validatorIndex is not in the signed message), orphaning them and
  halting consensus.
@oXtxNt9U oXtxNt9U force-pushed the fix/evm/consenus-contract branch from 18f4d3c to 8bf6b65 Compare June 26, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant