Repository navigation
Fix state resolution v2.1 for room version 12 - #472
Open
mtrossbach wants to merge 1 commit into
Open
mtrossbach wants to merge 1 commit into
mtrossbach wants to merge 1 commit into
Conversation
…2New Three defects in the v2.1 path: - authAndApplyEvents' fallback to an event's auth events added the event itself to the auth provider in place of the matching auth event, so every conflicted event checked before the partial state held its key failed auth. v2.1 starts the iterative auth checks from an empty state map, so this dropped every conflicted non-control event. - In room version 12 the create event stands in no event's auth_events and v2.1 applies no unconflicted state first, so resolvedCreate was never set: getPowerLevelFromAuthEvents panicked on the first conflicted control event, and every auth check lacked the create event. The resolver now holds the room's create event from the start. - calculateFullAuthChainAndConflictedSubgraph printed every conflicted subgraph to stdout, and inserted a nil PDU for a conflicted origin that was missing from the auth events. Tests build a room version 12 room and resolve a conflicted topic, an event present in one state set alone, conflicted power levels and join rules, and a power level change its sender may not make. Signed-off-by: Markus Troßbach <markus@trossbach.net>
mtrossbach
added a commit
to siegelkern/gomatrixserverlib
that referenced
this pull request
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.
addFromAuthEventsIfNotRejectedadds the matching auth event, not the event under check.ResolveStateConflictsV2Newholds the room's create event from the start (taken from the authevents, else from the state sets), as
ReverseTopologicalOrderingdoes since Ensure the create event is cached prior to sorting #459: it takes partin every auth check and in the power level of a privileged creator, and under v2.1 it is otherwise
absent until the unconflicted state is reapplied at the end. The create event is unique to the
room, so this changes nothing under v2.
(such an origin is a conflicted event, which the full conflicted set holds already).
Tests (
stateresolutionv2_1_test.go) build signed room version 12 events and check that aconflicted topic resolves by mainline order, that an event present in one state set alone survives,
that conflicted power levels and join rules resolve without a panic, that a power level change its
sender may not make is dropped, and that nothing is written to stdout.
Fixes #471
Pull Request Checklist
Signed-off-by: Markus Troßbach markus@trossbach.net