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

Add v2 state resolution algorithm #3786

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions changelog.d/3786.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add initial implementation of new state resolution algorithm
2 changes: 1 addition & 1 deletion synapse/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def auth_types_for_event(event):
auth_types = []

auth_types.append((EventTypes.PowerLevels, "", ))
auth_types.append((EventTypes.Member, event.user_id, ))
auth_types.append((EventTypes.Member, event.sender, ))
auth_types.append((EventTypes.Create, "", ))

if event.type == EventTypes.Member:
Expand Down
1 change: 1 addition & 0 deletions synapse/python_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"prometheus_client": ["prometheus_client"],
"attrs": ["attr"],
"netaddr>=0.7.18": ["netaddr"],
"networkx>=2.0": ["networkx>=2.0"]
}

CONDITIONAL_REQUIREMENTS = {
Expand Down
8 changes: 6 additions & 2 deletions synapse/state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from synapse.api.constants import EventTypes, RoomVersions
from synapse.events.snapshot import EventContext
from synapse.state import v1
from synapse.state import v1, v2
from synapse.util.async_helpers import Linearizer
from synapse.util.caches import get_cache_factor_for
from synapse.util.caches.expiringcache import ExpiringCache
Expand Down Expand Up @@ -616,10 +616,14 @@ def resolve_events_with_factory(room_version, state_sets, event_map, state_map_f
Deferred[dict[(str, str), str]]:
a map from (type, state_key) to event_id.
"""
if room_version in (RoomVersions.V1, RoomVersions.VDH_TEST,):
if room_version == RoomVersions.V1:
return v1.resolve_events_with_factory(
state_sets, event_map, state_map_factory,
)
elif room_version == RoomVersions.VDH_TEST:
return v2.resolve_events_with_factory(
state_sets, event_map, state_map_factory,
)
else:
# This should only happen if we added a version but forgot to add it to
# the list above.
Expand Down
Loading