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

Commit 3f8fef2

Browse files
committed
Explain why auth/state necessary here
1 parent 8f8c1a0 commit 3f8fef2

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

synapse/events/builder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ async def build(
132132
auth_event_ids = self._event_auth_handler.compute_auth_events(
133133
self, state_ids
134134
)
135+
logger.info(
136+
"builder.build state_ids=%s auth_event_ids=%s",
137+
state_ids,
138+
auth_event_ids,
139+
)
135140

136141
format_version = self.room_version.event_format
137142
# The types of auth/prev events changes between event versions.

tests/handlers/test_federation_event.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,10 @@ async def get_event(destination: str, event_id: str, timeout=None):
10441044
prev_event_ids=[event_before.event_id],
10451045
# allow_no_prev_events=True,
10461046
# prev_event_ids=[],
1047-
auth_event_ids=historical_base_auth_event_ids,
1047+
# auth_event_ids=historical_base_auth_event_ids,
1048+
#
1049+
# Because we're creating all of these events without persisting them yet,
1050+
# we have to explicitly provide some auth_events. For member events, we do it this way.
10481051
state_event_ids=historical_state_event_ids,
10491052
depth=inherited_depth,
10501053
)
@@ -1072,11 +1075,13 @@ async def get_event(destination: str, event_id: str, timeout=None):
10721075
prev_event_ids=[maria_membership_event.event_id],
10731076
# allow_no_prev_events=True,
10741077
# prev_event_ids=[],
1078+
# Because we're creating all of these events without persisting them yet,
1079+
# we have to explicitly provide some auth_events
10751080
auth_event_ids=[
10761081
*historical_base_auth_event_ids,
10771082
as_membership_event.event_id,
10781083
],
1079-
state_event_ids=historical_state_event_ids,
1084+
# state_event_ids=historical_state_event_ids,
10801085
depth=inherited_depth,
10811086
)
10821087
)
@@ -1089,6 +1094,8 @@ async def get_event(destination: str, event_id: str, timeout=None):
10891094
type=EventTypes.Message,
10901095
content={"body": "Historical message", "msgtype": "m.text"},
10911096
prev_event_ids=[insertion_event.event_id],
1097+
# Because we're creating all of these events without persisting them yet,
1098+
# we have to explicitly provide some auth_events
10921099
auth_event_ids=[
10931100
*historical_base_auth_event_ids,
10941101
maria_membership_event.event_id,
@@ -1108,6 +1115,8 @@ async def get_event(destination: str, event_id: str, timeout=None):
11081115
EventContentFields.MSC2716_HISTORICAL: True,
11091116
},
11101117
prev_event_ids=[historical_message_event.event_id],
1118+
# Because we're creating all of these events without persisting them yet,
1119+
# we have to explicitly provide some auth_events
11111120
auth_event_ids=[
11121121
*historical_base_auth_event_ids,
11131122
as_membership_event.event_id,
@@ -1127,11 +1136,13 @@ async def get_event(destination: str, event_id: str, timeout=None):
11271136
EventContentFields.MSC2716_HISTORICAL: True,
11281137
},
11291138
prev_event_ids=[event_before.event_id],
1139+
# Because we're creating all of these events without persisting them yet,
1140+
# we have to explicitly provide some auth_events
11301141
auth_event_ids=[
11311142
*historical_base_auth_event_ids,
11321143
as_membership_event.event_id,
11331144
],
1134-
state_event_ids=historical_state_event_ids,
1145+
# state_event_ids=historical_state_event_ids,
11351146
depth=inherited_depth,
11361147
)
11371148
)

0 commit comments

Comments
 (0)