Skip to content

Commit

Permalink
Merge pull request #1037 from DMRobertson/dmr/state-res-bold-defs
Browse files Browse the repository at this point in the history
Stateres v2: Use bold to introduce definitions.
  • Loading branch information
turt2live committed May 2, 2022
2 parents 6146806 + 05da3dc commit d8bab31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/room_versions/newsfragments/1037.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Improve readability of definitions in the state resolution v2 algorithm.

14 changes: 7 additions & 7 deletions content/rooms/fragments/v2-state-res.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@ The state resolution algorithm for version 2 rooms uses the following
definitions, given the set of room states
{*S*<sub>1</sub>, *S*<sub>2</sub>, …}:

Power events
**Power events.**
A *power event* is a state event with type `m.room.power_levels` or
`m.room.join_rules`, or a state event with type `m.room.member` where
the `membership` is `leave` or `ban` and the `sender` does not match the
`state_key`. The idea behind this is that power events are events that
might remove someone's ability to do something in the room.

Unconflicted state map and conflicted state set
**Unconflicted state map and conflicted state set.**
The *unconflicted state map* is the state where the value of each key
exists and is the same in each state *S*<sub>*i*</sub>. The *conflicted
state set* is the set of all other state events. Note that the
unconflicted state map only has one event per `(event_type, state_key)`,
whereas the conflicted state set may have multiple events.

Auth difference
**Auth difference.**
The *auth difference* is calculated by first calculating the full auth
chain for each state *S*<sub>*i*</sub>, that is the union of the auth
chains for each event in *S*<sub>*i*</sub>, and then taking every event
that doesn't appear in every auth chain. If *C*<sub>*i*</sub> is the
full auth chain of *S*<sub>*i*</sub>, then the auth difference is
 ∪ *C*<sub>*i*</sub> −  ∩ *C*<sub>*i*</sub>.

Full conflicted set
**Full conflicted set.**
The *full conflicted set* is the union of the conflicted state set and
the auth difference.

Reverse topological power ordering
**Reverse topological power ordering.**
The *reverse topological power ordering* of a set of events is the
lexicographically smallest topological ordering based on the DAG formed
by auth events. The reverse topological power ordering is ordered from
Expand All @@ -71,7 +71,7 @@ events using Kahn's algorithm for topological sorting, and at each step
selecting, among all the candidate vertices, the smallest vertex using
the above comparison relation.

Mainline ordering
**Mainline ordering.**
Given an `m.room.power_levels` event *P*, the *mainline of* *P* is the
list of events generated by starting with *P* and recursively taking the
`m.room.power_levels` events from the `auth_events`, ordered such that
Expand All @@ -96,7 +96,7 @@ events: for events *x* and *y*, *x* &lt; *y* if
same `origin_server_ts`, but *x*'s `event_id` is *less* than *y*'s
`event_id`.

Iterative auth checks
**Iterative auth checks.**
The *iterative auth checks algorithm* takes as input an initial room
state and a sorted list of state events, and constructs a new room state
by iterating through the event list and applying the state event to the
Expand Down

0 comments on commit d8bab31

Please sign in to comment.