More resilient snapshots and some de/commit fixes.#2533
Open
More resilient snapshots and some de/commit fixes.#2533
Conversation
Contributor
v0d1ch
commented
Mar 5, 2026
- CHANGELOG updated or not needed
- Documentation updated or not needed
- Haddocks updated or not needed
- No new TODOs introduced or explained herafter
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
It was green for the wrong reason. Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
When DecommitFinalized bumps the version while a snapshot request is already in-flight, nodes reject the stale request with a version mismatch error and the head gets permanently stuck. Add three tests that fail against the current code and will pass once the fix is in: - stale ReqSn with old version should be ignored, not rejected - DecommitFinalized should reset seenSnapshot to the confirmed number - BehaviorSpec end-to-end scenario where the race causes a deadlock Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Replace the immediate per-ReqTx snapshot trigger with a timer-driven
model: the periodic timer (TimerInput/onOpenTimer) batches pending work
into ReqSn requests, while AckSn confirmation still chains consecutive
snapshots for throughput.
- Remove maybeRequestSnapshot from onOpenNetworkReqTx
- Drop stale/duplicate ReqSn and AckSn silently (noop) instead of
waiting or erroring; remove the now-unused WaitOn* variants
- Reset localUTxO/localTxs/allTxs to confirmed state on version bump
when a snapshot was in-flight, so the timer can build a fresh ReqSn
- onOpenTimer re-broadcasts ReqSn + own AckSn when stuck in SeenSnapshot
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
3146382 to
766de0c
Compare
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
Transaction cost differencesNo cost or size differences found |
- snapshotInFlight: allow leader to process its own ReqSn echo by
changing RequestedSnapshot{} -> True to RequestedSnapshot{requested}
-> sn /= requested. The old behaviour prevented the leader from ever
signing its own broadcast, causing a permanent liveness deadlock.
- onOpenTimer: compute nextSn as max(confSn, latestSeenSnapshotNumber)
+ 1 instead of confSn + 1. seenSnapshot and confirmedSnapshot can
diverge when DecommitFinalized/CommitFinalized resets seenSnapshot via
toLastSeenSnapshot while confirmedSnapshot is still behind. The old
calculation made nextSn too small, causing snapshotInFlight to
incorrectly block fresh snapshot requests.
- requireReqSn: return noop for version mismatches, too-old snapshots,
and overlapping requests instead of Error. The timer will retry with
the correct version, so these are expected races not protocol
violations.
- Update tests to reflect timer-driven batching: ReqTx no longer
immediately triggers ReqSn, all pending txs batch into one snapshot
per timer tick, and TxInvalid precedes SnapshotConfirmed by ~10s.
Signed-off-by: Sasha Bogicevic <sasha.bogicevic@iohk.io>
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.