summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-09-30 00:47:13 -0500
committerEric Eastwood <erice@element.io>2022-09-30 00:47:13 -0500
commit3f8fef2beb2195d2220b3af873daee94971d3e8a (patch)
tree7bf973497d10314d6125f2df95e4c46de5f4bd86
parentWIP: Connect state_chain to prev_event and the batch to the state_chain so ev... (diff)
downloadsynapse-3f8fef2beb2195d2220b3af873daee94971d3e8a.tar.xz
Explain why auth/state necessary here
-rw-r--r--synapse/events/builder.py5
-rw-r--r--tests/handlers/test_federation_event.py17
2 files changed, 19 insertions, 3 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index e2ee10dd3d..87a0331868 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -132,6 +132,11 @@ class EventBuilder:
             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.
diff --git a/tests/handlers/test_federation_event.py b/tests/handlers/test_federation_event.py
index eaa0c66553..f5abcb5c0f 100644
--- a/tests/handlers/test_federation_event.py
+++ b/tests/handlers/test_federation_event.py
@@ -1044,7 +1044,10 @@ class FederationEventHandlerTests(unittest.FederatingHomeserverTestCase):
                 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,
             )
@@ -1072,11 +1075,13 @@ class FederationEventHandlerTests(unittest.FederatingHomeserverTestCase):
                 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,
             )
         )
@@ -1089,6 +1094,8 @@ class FederationEventHandlerTests(unittest.FederatingHomeserverTestCase):
                 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,
@@ -1108,6 +1115,8 @@ class FederationEventHandlerTests(unittest.FederatingHomeserverTestCase):
                     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,
@@ -1127,11 +1136,13 @@ class FederationEventHandlerTests(unittest.FederatingHomeserverTestCase):
                     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,
             )
         )