Clarify the limits of prev_events and auth_events

Fixes https://github.com/matrix-org/matrix-doc/issues/2307

These restrictions are due to a Synapse change which never made it to the spec prior to the MSC process. This is therefore documenting an omission.

Synapse's numbers are verified here: 207b1737ee/synapse/handlers/federation.py (L1183-L1213)

... and Synapse's handling of the backfill endpoint is described here: 207b1737ee/synapse/handlers/federation.py (L829-L837)

This also includes a mention that https://github.com/matrix-org/matrix-doc/pull/1594 should render the `auth_events` limitation unnecessary. 

No changes are required to the the "checks on receipt of a PDU" section of the server-server spec as it starts with "must be a valid event", to which an event is invalid if it contains too many prev or auth events.
This commit is contained in:
Travis Ralston 2020-05-12 19:02:39 -06:00
parent 3556b8457f
commit 42ae5c966a
4 changed files with 26 additions and 0 deletions

View file

@ -63,6 +63,14 @@ paths:
description: |- description: |-
A transaction containing the PDUs that preceded the given event(s), including the given A transaction containing the PDUs that preceded the given event(s), including the given
event(s), up to the given limit. event(s), up to the given limit.
.. Note::
Though the PDU definitions require that ``prev_events`` and ``auth_events`` be limited
in number, the response of backfill MUST NOT be validated on these specific restrictions.
Due to historical reasons, it is possible that events which were previously accepted
would now be rejected by these limitations. The events should be rejected per usual by
the ``/send``, ``/get_missing_events``, and remaining endpoints.
schema: schema:
$ref: "definitions/unlimited_pdu_transaction.yaml" $ref: "definitions/unlimited_pdu_transaction.yaml"
"/get_missing_events/{roomId}": "/get_missing_events/{roomId}":

View file

@ -32,6 +32,10 @@ allOf:
description: |- description: |-
Event IDs for the authorization events that would Event IDs for the authorization events that would
allow this event to be in the room. allow this event to be in the room.
Must contain less than or equal to 10 events. Note that if the relevant
auth event selection rules are used, this restriction should never be
encountered.
example: ["$base64EncodedHash", "$AnotherEvent"] example: ["$base64EncodedHash", "$AnotherEvent"]
prev_events: prev_events:
type: array type: array
@ -41,6 +45,8 @@ allOf:
description: |- description: |-
Event IDs for the most recent events in the room Event IDs for the most recent events in the room
that the homeserver was aware of when it made this event. that the homeserver was aware of when it made this event.
Must contain less than or equal to 20 events.
example: ["$base64EncodedHash", "$AnotherEvent"] example: ["$base64EncodedHash", "$AnotherEvent"]
hashes: hashes:
type: object type: object

View file

@ -32,6 +32,10 @@ allOf:
description: |- description: |-
Event IDs for the authorization events that would Event IDs for the authorization events that would
allow this event to be in the room. allow this event to be in the room.
Must contain less than or equal to 10 events. Note that if the relevant
auth event selection rules are used, this restriction should never be
encountered.
example: ["$URLsafe-base64EncodedHash", "$Another_Event"] example: ["$URLsafe-base64EncodedHash", "$Another_Event"]
prev_events: prev_events:
type: array type: array
@ -41,6 +45,8 @@ allOf:
description: |- description: |-
Event IDs for the most recent events in the room Event IDs for the most recent events in the room
that the homeserver was aware of when it made this event. that the homeserver was aware of when it made this event.
Must contain less than or equal to 20 events.
example: ["$URLsafe-base64EncodedHash", "$Another_Event"] example: ["$URLsafe-base64EncodedHash", "$Another_Event"]
required: required:
- auth_events - auth_events

View file

@ -53,6 +53,8 @@ properties:
description: |- description: |-
Event IDs and reference hashes for the most recent events in the room Event IDs and reference hashes for the most recent events in the room
that the homeserver was aware of when it made this event. that the homeserver was aware of when it made this event.
Must contain less than or equal to 20 events.
items: items:
type: array type: array
maxItems: 2 maxItems: 2
@ -84,6 +86,10 @@ properties:
description: |- description: |-
Event IDs and reference hashes for the authorization events that would Event IDs and reference hashes for the authorization events that would
allow this event to be in the room. allow this event to be in the room.
Must contain less than or equal to 10 events. Note that if the relevant
auth event selection rules are used, this restriction should never be
encountered.
items: items:
type: array type: array
maxItems: 2 maxItems: 2