Repository navigation
fix(consensus): rebuild short rotating quorum quarters faithfully after quarter_steps activation - #8012
Draft
UdjinM6 wants to merge 8 commits into
Draft
fix(consensus): rebuild short rotating quorum quarters faithfully after quarter_steps activation#8012UdjinM6 wants to merge 8 commits into
UdjinM6 wants to merge 8 commits into
Conversation
Collaborator
|
🕓 Review not started yet because this PR is a draft.
Commit 76a8bbc. Normal review starts when eligible; priority review starts as soon as a slot is available. |
…vior change Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…steps Once quarter_steps is active at a cycle's base block, the builder records the cycle's new quarters with the step-encoded walk and always stores a snapshot, and every rebuild of that cycle replays the steps, so short and empty quarters are rebuilt exactly as selected instead of being padded with invented members. Cycles before activation keep the legacy encoding byte for byte. Predictions of a future cycle take the rule from the deployment state after the work block and report the cycle as unknown while it is still STARTED or LOCKED_IN. ReplayNewQuarters also rejects a skip list that would repeat a position within one quarter, which the walk never produces. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The QuorumComposition, QuarterComposition, sortedCombinedMns and DKGComposition debug logs identified masternodes by the first 4 hex characters of their proTxHash, which collide often enough to make log-based checks of these compositions ambiguous. Use 16 characters. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
UdjinM6
force-pushed
the
rotation-quarter-steps
branch
from
November 1, 2026 18:43
0d96baf to
76a8bbc
Compare
knst
reviewed
Nov 2, 2026
| Consensus changes | ||
| ----------------- | ||
|
|
||
| - A new EHF deployment, `quarter_steps` (version bit 15), changes how rotating LLMQs (DIP0024) record and |
Collaborator
There was a problem hiding this comment.
A testnet replay with an ungated version of this fix stopped at h=841,634 (bad-cb-payee), so the change has to be gated.
Instead introduction of fork, better to add exception for testnet for that specific block hashes.
|
This pull request has conflicts, please rebase. |
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
Rotating LLMQs (DIP0024) are built from four quarters, one per DKG cycle. When a cycle can't fill a quarter because too few eligible masternodes are left outside that quorum index's previous three quarters, the builder correctly selects fewer members. But neither legacy snapshot mode records quarter lengths, so when later cycles rebuild that quarter from its snapshot,
GetQuorumQuarterMembersBySnapshotfills it up toquarterSizeby continuing around the candidate list. That adds members that were never selected, and they can repeat members of the quorum's other quarters. Separately, some builder early returns store no snapshot at all, and a missing snapshot makes later cycles stop loading their older quarters.In regtest with 3 masternodes this produces compositions like
[4a61 | 4a61 | 4a61 | dd15]. The DKG maps a proTxHash to a single member index, so a repeated masternode's extra slots never record a contribution; they are treated as non-contributing members, which leads to complaints and PoSe penalties for an honest masternode. This is what madefeature_llmq_dkgerrors.pyfail intermittently.A second, related path: when the builder collects previous members into
CDeterministicMNLists withAddMN, unique-property conflicts between historical member states (e.g. an address reused after service updates) throw and are silently swallowed. The member drops out of its index's exclusion set and can be selected again ([A, B, A]), and a candidate can be blocked by a conflict with a previous member's old state.Mainnet history never hit the short-quarter case: a
-reindex-chainstatereplay with a build that logs every short quarter and early return found none. Testnet did: an early return at h=838,368 (7 enabled masternodes) and short quarters in 12 cycles (h=901,152–903,168 and h=1,366,560–1,367,136, with 47–57 candidates). A testnet replay with an ungated version of this fix stopped at h=841,634 (bad-cb-payee), so the change has to be gated.What was done?
The consensus changes to quarter selection and snapshot interpretation are gated by a new EHF deployment,
quarter_steps(version bit 15). Whether a cycle uses them is decided byDeploymentActiveAt(cycleBase), and every rebuild of a quarter uses the state at that quarter's own cycle base. Cycles before activation are built and rebuilt exactly as before.refactor(llmq): the existing selection and rebuild loops move unchanged intoWalkLegacyQuarters/ReplayLegacyQuarters, with tests pinning their output, including the skip-list quirk where a first skip at position 0 is treated as unset, and the serialized snapshot bytes.feat(llmq):WalkNewQuarters/ReplayNewQuartersrecord skips as walk step numbers in the existingmnSkipList: the first entry is the absolute step, each later entry is the positive delta from the previous skip. A quarter ends when full or afterlist.size()consecutive skips, so the rebuild reproduces exactly what was selected, including short and empty quarters. The decoder rejects malformed, unconsumed or duplicate-position lists. The snapshot serialization andqrinfoformats are unchanged.feat: thequarter_stepsdeployment (mainnet/testnet parameters areNEVER_ACTIVEplaceholders until the release sets them; devnet/regtest copyevo_shares), and a regtest-only-llmqtestdip0024params=<size>:<threshold>that sets theLLMQ_TEST_DIP0024size and setsminSize,thresholdanddkgBadVotesThresholdto<threshold>; the size must be a positive multiple of 4 within the supported maximum.feat(llmq):AddMNconflict path.ComputeRotationQuartersexposes each index's four quarters;GetAllQuorumMembershandles an empty rotation result safely;quorum dkginfogains an additionalknown: falsecase, with a specific reason, when the deployment state at a future cycle base can't be settled from its work block under a conservative state/window rule (LOCKED_IN is always treated as unknown).Includes a release note describing the rule for SPV implementers.
test:DashTestFrameworkactivatesquarter_stepsby default (vbparams=quarter_steps:-1:...), with a per-test switch to turn it off, and gains a configurable rotating-quorum minimum size and optional "predictions must be known" checks.llmq: rotation composition debug logs print 16-character proTxHash prefixes instead of 4.test: newfeature_llmq_rotation_short_quarters.py.How Has This Been Tested?
Tested on macOS (Apple Silicon), depends build, configured with
--enable-debug --enable-werror --enable-crash-hooks.src/test/llmq_utils_tests.cpp,llmq_params_tests.cpp,evo_snapshot_tests.cpp), fulltest_dashsuite passing:[A, B, A]case.feature_llmq_rotation_short_quarters.py(3 masternodes,-llmqtestdip0024params=8:3):getdeploymentinfo;AddMNsets fails the new exclusion unit tests.feature_llmq_rotation.py,feature_llmq_chainlocks.py,feature_llmq_is_cl_conflicts.py,feature_llmq_is_retroactive.py,rpc_verifyislock.py,feature_llmq_connections.py,feature_llmq_simplepose.py,feature_llmq_signing.py,feature_llmq_dkgerrors.py(8 parallel runs),feature_mnehf.py,feature_evo_shares_activation.py,interface_rest.py,feature_asset_locks.py,feature_dip3_deterministicmns.py,feature_llmq_evo.py,rpc_masternode.py,p2p_quorum_data.py,feature_llmq_data_recovery.py,rpc_blockchain.py. Not run locally:interface_zmq_dash.py(no Pythonzmqmodule in my environment).-reindex-chainstatewith a logging-only build, used for the findings above.-reindex-chainstatereplays of mainnet and testnet with this branch (0d96bafed4), offline from the existing block files: both reached their existing tips with a single active chain tip and no rejected blocks or consensus errors indebug.log, including the testnet short-quarter cycles listed above where the ungated fix had failed.quarter_stepsisNEVER_ACTIVEon both networks, so history replays under the legacy rule unchanged.Breaking Changes
Consensus change, inactive until
quarter_stepsactivates; mainnet/testnet dates are not set yet. After activation:mnSkipListchanges for affected cycles (same serialized format);Quarters built before activation keep the legacy rebuild, so repeated members remain possible during the transition. The first quorum made up entirely of new-rule quarters comes three cycles after the first cycle that uses the new rule. Quorum sizes, minimum sizes and thresholds are unchanged; the fix only keeps short compositions as selected, and the existing DKG and commitment rules still decide whether they form a quorum.
SPV clients that rebuild rotating quorums from
qrinfomust implement the rule described indoc/release-notes-8012.mdbefore activation. Devnets running this build will activate it on their own once masternodes signal it.Checklist: