[DS-3860] whole round snapshot consistency - #255
Conversation
|
👋 brunotm, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
cl-efornaciari
left a comment
There was a problem hiding this comment.
Deferred channel definitions: changes agreed in round N are persisted to c/defs immediately but only take effect at N+1, so Observation, StateTransition and Reports always operate on the exact definitions (and opts) the round's stream values were gathered under. This closes the v30-inherited inconsistency where a mid-round definition change could produce reports encoded under definitions/opts that the observations behind them did not match. The effective/pending two-set construction is clean, carrying channelStateSeqNr in the precursor keeps Reports self-sufficient (and wire-compat with the LLOOutcomeProtoV1 layout is preserved), and the test coverage of the new semantics — addition effective at N+1 / first reportable at N+2, deferred removal, opts tracking, SyncTo watermark gating — is thorough. Build + go vet + v31/protocol suites pass locally.
One concern I consider blocking, detailed inline: the shared OptsCache is now written by two paths at different seqNrs (channelCache.put from the store, Reports from the precursor) while being read mid-round by StateTransition (ProcessCalculatedStreams, isReportable) and Reports (reportableChannels, codecs). After a defs-change round, a late or overlapping Reports call can leave the cache pinned at an older seqNr indefinitely (the cache-hit path never re-syncs) or flip it mid-round — making StateTransition/Reports outputs depend on node-local interleaving, which conflicts with the ReportingPlugin determinism contract (memoization side effects must be unobservable). Concrete interleavings and suggested fixes inline.
Also one doc nit on applyChannelVotes.
4e5d987 to
ea2dc78
Compare
on v31 is possible to fully defer definitions updates to the next round as state doesn't have to be carried by the previous outcome.