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

Commit

Permalink
Explain why auth/state necessary here
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Sep 30, 2022
1 parent 8f8c1a0 commit 3f8fef2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions synapse/events/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ async def build(
auth_event_ids = self._event_auth_handler.compute_auth_events(
self, state_ids
)
logger.info(
"builder.build state_ids=%s auth_event_ids=%s",
state_ids,
auth_event_ids,
)

format_version = self.room_version.event_format
# The types of auth/prev events changes between event versions.
Expand Down
17 changes: 14 additions & 3 deletions tests/handlers/test_federation_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,10 @@ async def get_event(destination: str, event_id: str, timeout=None):
prev_event_ids=[event_before.event_id],
# allow_no_prev_events=True,
# prev_event_ids=[],
auth_event_ids=historical_base_auth_event_ids,
# auth_event_ids=historical_base_auth_event_ids,
#
# Because we're creating all of these events without persisting them yet,
# we have to explicitly provide some auth_events. For member events, we do it this way.
state_event_ids=historical_state_event_ids,
depth=inherited_depth,
)
Expand Down Expand Up @@ -1072,11 +1075,13 @@ async def get_event(destination: str, event_id: str, timeout=None):
prev_event_ids=[maria_membership_event.event_id],
# allow_no_prev_events=True,
# prev_event_ids=[],
# Because we're creating all of these events without persisting them yet,
# we have to explicitly provide some auth_events
auth_event_ids=[
*historical_base_auth_event_ids,
as_membership_event.event_id,
],
state_event_ids=historical_state_event_ids,
# state_event_ids=historical_state_event_ids,
depth=inherited_depth,
)
)
Expand All @@ -1089,6 +1094,8 @@ async def get_event(destination: str, event_id: str, timeout=None):
type=EventTypes.Message,
content={"body": "Historical message", "msgtype": "m.text"},
prev_event_ids=[insertion_event.event_id],
# Because we're creating all of these events without persisting them yet,
# we have to explicitly provide some auth_events
auth_event_ids=[
*historical_base_auth_event_ids,
maria_membership_event.event_id,
Expand All @@ -1108,6 +1115,8 @@ async def get_event(destination: str, event_id: str, timeout=None):
EventContentFields.MSC2716_HISTORICAL: True,
},
prev_event_ids=[historical_message_event.event_id],
# Because we're creating all of these events without persisting them yet,
# we have to explicitly provide some auth_events
auth_event_ids=[
*historical_base_auth_event_ids,
as_membership_event.event_id,
Expand All @@ -1127,11 +1136,13 @@ async def get_event(destination: str, event_id: str, timeout=None):
EventContentFields.MSC2716_HISTORICAL: True,
},
prev_event_ids=[event_before.event_id],
# Because we're creating all of these events without persisting them yet,
# we have to explicitly provide some auth_events
auth_event_ids=[
*historical_base_auth_event_ids,
as_membership_event.event_id,
],
state_event_ids=historical_state_event_ids,
# state_event_ids=historical_state_event_ids,
depth=inherited_depth,
)
)
Expand Down

0 comments on commit 3f8fef2

Please sign in to comment.