Repository navigation
solver: re-send the signed stage 1 instead of signing a second one in the same round - #178
Conversation
…cement; log a re-signed stage 1 (diagnostics) The stage 1 this node signs is kept with its round, sub-round and seat key and survives nextRound(true). When stage 1 is signed again for the same round and sub-round, an info line shows both timestamps and which content fields differ. The replacement of a round package by a fuller one is logged at info level. Nothing sent or computed changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the same round After a fuller round package of the same round replaced the first one, a confidant enters stage 1 again (SolverCore::nextRound(true)) and used to sign a second stage 1 with a new timestamp. The confidants could then hold different stage-1 copies of that seat, and so compute different block timestamps or see two hash-signature pairs of the seat at stage 2. Now, when this node already signed a stage 1 for the same round, sub-round and seat, it sends the stored signed message again, byte for byte. Its trusted candidates and packet hashes may lack the ones that came in later; these are only this node's votes for the next round. A new stage 1 is still signed when the stored one would be refused or would make the seat look faulty (cs::stageOneResend): the characteristic hash changed, the stored timestamp is not after the last block's, or it is more than DefaultTimeStampRange old (the own stage-2 window is measured from the own stamp). Only what this node sends changes; receivers verify the message as any stage 1. The stored stage 1 is cleared by nextRound(false) and at the start of every bootstrap round, and sent_stage1() still checks round, sub-round and seat key. The "stage1 signed again" line now gives the reason; the content comparison moved to cs::stageOneContentDiff. Unit tests cover the decision and that the resent bytes verify at a receiver in the same round and sub-round only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Private-network resultsAll networks: 7 nodes; the even nodes run the official node ( Fault and replay scenarios. These ran in Robustness run 42663079091. It was dispatched from the scratch branch
Column meanings.
Comparison with the earlier hook experiment (s1r-delay, same hook):
About the exclusions that remain. In the The fallback path.
🤖 Generated with Claude Code |
- the own signed stage 1 is stored before add_stage1(), which already runs the state's onStage1() handlers, so the store never depends on that order; - a stored stamp that cannot be parsed is its own reason, "unreadable", instead of "not-after-last-block"; unit tests updated, reason names tested; - docs: the two cases that still sign a second stage 1, as before (a writer-side replacement, which starts the round with updateRound = false, and a replacement inside a bootstrap round). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For the point release community.18.1.
What happens today
Sometimes a confidant receives a second round package for the round it is in, with more real trusted signatures than the first. It then replaces the first package and enters stage 1 again (
SolverCore::nextRound(true)). It signs a second stage 1 for the same round and sub-round, with a new timestamp. As a result, the other confidants can hold different stage-1 copies of that seat. A receiver keeps the later timestamp only if it gets both copies. The confidants then compute different block timestamps, or see two hash-signature pairs for the seat at stage 2. Either way, the seat or the block can fail the stage-3 check.On mainnet, the community.18 diagnostic lines on one operator's node showed exactly this:
The change
SolverCore::sentStageOne_). The lineCurrent Roundpackage of N will be replaced by new onemoves from debug to info level. When stage 1 is signed again, an info line gives both timestamps and the content fields that differ.stage1 resent unchanged). That message may lack the trusted candidates and packet hashes that came in later. These fields are only this node's votes for the next round, and the other confidants already hold and accept the stored message. A new stage 1 is still signed (stage1 signed again ..., reason <r>) when the stored one would be refused or would make the seat look faulty (cs::stageOneResend):hash-changed: the characteristic hash changed. It must match the majority's.not-after-last-block: the stored timestamp is not after the last block's, so receivers would refuse it.too-old: the stored timestamp is more thanDefaultTimeStampRange(30 s) old. This node's own stage-2 check measures the others' timestamps against its own, so their fresh timestamps could fall outside that window. This condition was not in the experiment. It cannot apply to a replacement that arrives within a normal round, and when it does apply it restores the previous behaviour.unreadable: the stored timestamp cannot be read as a number.nextRound(false)clears it, and so does the start of every bootstrap round: bootstrap tables also start rounds withupdateRound = true, so the code checksisBootstrapRound().sent_stage1()also checks the round, sub-round, seat index and the key at that index.docs/consensus-diagnostics.md, and a row indocs/CHANGES.md.Cases that still sign a second stage 1
In two cases the node still signs a second stage 1 for the same round, as before. These will be a follow-up:
moreTrustedbranch ofNode::getRoundTablehandles a node that holds its own round package. That path starts the round again withupdateRound = false, which clears the stored stage 1.What does not change
Node::getStageOneverifies it exactly as before. A receiver that already holds it ignores it inSolverCore::gotStageOne, because the timestamp is the same.stageOneStorage. Its semantics are unchanged. It is still cleared by everynextRound, and the node's own resent stage 1 enters it throughadd_stage1like any other. The node's own view of its seat is now the same as the view the other confidants hold.fatal ConveyerBase> Meta round currently in conveyerThe experiment logged this line once per replay. It comes from
Conveyer::setTable, whichperformRoundPackagecalls on every same-round replacement. The conveyer already holds that round's meta, so it keeps it and only logs the line. The line is older than this change: it dates from 165d17b and is in official 4a95aaa. It appears in the baseline-hook run too: 12 lines for 12 replays, against 51 lines for 51 replays with the fix. Its level is fatal, but it is only a log line and the node keeps running. In the hook experiment it comes from the hook's replay, which takes the same path as a natural replacement. It is neither caused nor changed by this PR.Tests
Unit (
tests/csnode/stageoneresend_tests.cpp, 9 tests):The local
nodetestsrun passed all 507 tests before the review follow-ups. After them, the 12StageOne*tests pass.Private networks: the results are in the comments below.
🤖 Generated with Claude Code