Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7a19995

Browse files
author
David Robertson
authored
Correct a misnamed argument in state res v2 (#13467)
In state res v2, we apply two passes of iterative auth checks. The first pass replays power events and events in their auth chains, but only those belonging to the full conflicted set. The source code as written suggests that we want only those belonging to the auth difference (which is a smaller set of events). At runtime we were doing the correct thing anyway, because the only callsite of `_reverse_topological_power_sort` passes in the `full_conflicted_set`. So this really is just a rename.
1 parent ab18441 commit 7a19995

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

changelog.d/13467.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Correct a misnamed argument in state res v2 internals.

synapse/state/v2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ async def _add_event_and_auth_chain_to_graph(
434434
event_id: str,
435435
event_map: Dict[str, EventBase],
436436
state_res_store: StateResolutionStore,
437-
auth_diff: Set[str],
437+
full_conflicted_set: Set[str],
438438
) -> None:
439439
"""Helper function for _reverse_topological_power_sort that add the event
440440
and its auth chain (that is in the auth diff) to the graph
@@ -445,7 +445,7 @@ async def _add_event_and_auth_chain_to_graph(
445445
event_id: Event to add to the graph
446446
event_map
447447
state_res_store
448-
auth_diff: Set of event IDs that are in the auth difference.
448+
full_conflicted_set: Set of event IDs that are in the full conflicted set.
449449
"""
450450

451451
state = [event_id]
@@ -455,7 +455,7 @@ async def _add_event_and_auth_chain_to_graph(
455455

456456
event = await _get_event(room_id, eid, event_map, state_res_store)
457457
for aid in event.auth_event_ids():
458-
if aid in auth_diff:
458+
if aid in full_conflicted_set:
459459
if aid not in graph:
460460
state.append(aid)
461461

@@ -468,7 +468,7 @@ async def _reverse_topological_power_sort(
468468
event_ids: Iterable[str],
469469
event_map: Dict[str, EventBase],
470470
state_res_store: StateResolutionStore,
471-
auth_diff: Set[str],
471+
full_conflicted_set: Set[str],
472472
) -> List[str]:
473473
"""Returns a list of the event_ids sorted by reverse topological ordering,
474474
and then by power level and origin_server_ts
@@ -479,7 +479,7 @@ async def _reverse_topological_power_sort(
479479
event_ids: The events to sort
480480
event_map
481481
state_res_store
482-
auth_diff: Set of event IDs that are in the auth difference.
482+
full_conflicted_set: Set of event IDs that are in the full conflicted set.
483483
484484
Returns:
485485
The sorted list
@@ -488,7 +488,7 @@ async def _reverse_topological_power_sort(
488488
graph: Dict[str, Set[str]] = {}
489489
for idx, event_id in enumerate(event_ids, start=1):
490490
await _add_event_and_auth_chain_to_graph(
491-
graph, room_id, event_id, event_map, state_res_store, auth_diff
491+
graph, room_id, event_id, event_map, state_res_store, full_conflicted_set
492492
)
493493

494494
# We await occasionally when we're working with large data sets to

0 commit comments

Comments
 (0)