|
|
@ -30,11 +30,22 @@ the `membership` is `leave` or `ban` and the `sender` does not match the
|
|
|
|
might remove someone's ability to do something in the room.
|
|
|
|
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
|
|
|
|
The keys of the state maps *S<sub>i</sub>* are 2-tuples of strings of the form
|
|
|
|
exists and is the same in each state *S*<sub>*i*</sub>. The *conflicted
|
|
|
|
*K* = `(event_type, state_key)`. The values *V* are state events.
|
|
|
|
state set* is the set of all other state events. Note that the
|
|
|
|
The key-value pairs (*K*, *V*) across all state maps *S<sub>i</sub>* can be
|
|
|
|
unconflicted state map only has one event per `(event_type, state_key)`,
|
|
|
|
divided into two collections.
|
|
|
|
whereas the conflicted state set may have multiple events.
|
|
|
|
If a given key *K* is present in every *S<sub>i</sub>* with the same value *V*
|
|
|
|
|
|
|
|
in each state map, then the pair (*K*, *V*) belongs to the *unconflicted state map*.
|
|
|
|
|
|
|
|
Otherwise (*K*, *V*) belongs to the *conflicted state set*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that the unconflicted state map only has one event for each key *K*,
|
|
|
|
|
|
|
|
whereas the conflicted state set may associate multiple events to the same key.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Auth chain.**
|
|
|
|
|
|
|
|
The *auth chain* of an event *E* is the set containing all of *E*'s auth events,
|
|
|
|
|
|
|
|
all of *their* auth events, and so on recursively, stretching back to the
|
|
|
|
|
|
|
|
start of the room. Put differently, these are the events reachable by walking
|
|
|
|
|
|
|
|
the graph induced by an event's `auth_events` links.
|
|
|
|
|
|
|
|
|
|
|
|
**Auth difference.**
|
|
|
|
**Auth difference.**
|
|
|
|
The *auth difference* is calculated by first calculating the full auth
|
|
|
|
The *auth difference* is calculated by first calculating the full auth
|
|
|
@ -111,9 +122,9 @@ the auth event is not rejected.
|
|
|
|
|
|
|
|
|
|
|
|
The *resolution* of a set of states is obtained as follows:
|
|
|
|
The *resolution* of a set of states is obtained as follows:
|
|
|
|
|
|
|
|
|
|
|
|
1. Take all *power events* and any events in their auth chains,
|
|
|
|
1. Select all *power events* that appear in the *full conflicted set*. Compute
|
|
|
|
recursively, that appear in the *full conflicted set* and order them
|
|
|
|
the union of their auth chains, including the power events themselves.
|
|
|
|
by the *reverse topological power ordering*.
|
|
|
|
Sort the union using the *reverse topological power ordering*.
|
|
|
|
2. Apply the *iterative auth checks algorithm*, starting from the
|
|
|
|
2. Apply the *iterative auth checks algorithm*, starting from the
|
|
|
|
*unconflicted state map*, to the list of events from the previous
|
|
|
|
*unconflicted state map*, to the list of events from the previous
|
|
|
|
step to get a partially resolved state.
|
|
|
|
step to get a partially resolved state.
|
|
|
|