Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better description of the mainline of a PL event. #1107

Merged
merged 15 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
More explicitly define the mainline of a power event and the mainline ordering of other events.
For room versions 2 through 10: More explicitly define the mainline of a power event and the mainline ordering of other events.
15 changes: 8 additions & 7 deletions content/rooms/fragments/v2-state-res.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Starting with *i* = 0, repeatedly fetch *P*<sub>*i*+1</sub>, the
Increment *i* and repeat until *P<sub>i</sub>* has no `m.room.power_levels`
event in its `auth_events`.
The *mainline of P*<sub>0</sub> is the list of events
[*P*<sub>n</sub> , ... , *P*<sub>1</sub>, *P*<sub>0</sub>],
ordered from oldest to newest.
[*P*<sub>0</sub> , *P*<sub>1</sub>, ... , *P<sub>n</sub>*],
fetched in this way.

Let *e* = *e<sub>0</sub>* be another event (possibly another
`m.room.power_levels` event). We can compute a similar list of events
Expand All @@ -107,17 +107,18 @@ Now compare these two lists as follows.
* If such a *j* exists, then *e<sub>j</sub>* = *P<sub>i</sub>* for some unique
index *i* ≥ 0. Otherwise set *i* = ∞, where ∞ is a sentinel value greater
than any integer.
* In both cases, the *position of e in the mainline of P* is *i*.
* In both cases, the *mainline position* of *e* is *i*.

The *mainline ordering based on* *P* of a set of events is the ordering,
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
from smallest to largest, using the following comparison relation on
events: for events *x* and *y*, *x* &lt; *y* if

1. the position of *x* in the mainline of *P* is **greater** than
the position of *y* in the mainline of *P*; or
2. the positions of the events are the same, but *x*'s
1. the mainline position of *x* is **greater** than
the mainline position of *y* in the mainline of *P* (i.e. the auth chain of
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
*x* is based on an earlier event in the mainline than *y*); or
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
2. the mainline positions of the events are the same, but *x*'s
`origin_server_ts` is *less* than *y*'s `origin_server_ts`; or
3. the positions of the events are the same and the events have the
3. the mainline positions of the events are the same and the events have the
same `origin_server_ts`, but *x*'s `event_id` is *less* than *y*'s
`event_id`.

Expand Down