This improves the error messages sent to clients if they send bogus receipts and would have made my life much easier when I was debugging something.
For federation the best we do is check that the server is in the room and drop it if not (this is similar to what we do for typing, see #13830.
This essentially expands the validation added in #14632, and somewhat backs out https://github.com/matrix-org/synapse/commit/9f797a24a452a513628263b1b03172cee20a9856, but I still don't understand how that could ever happen. (Note that instead of raising an error if the event is unknown, we instead ignore the receipt. This should also help in situations where a room is purged, kind of like #15464.)
Sorry for the large diff -- one of the commits in the middle moves some tests around.
This improves the error messages sent to clients if they send bogus receipts and would have made my life much easier when I was debugging something.
For federation the best we do is check that the server is in the room and drop it if not (this is similar to what we do for typing, see #13830.
This essentially expands the validation added in #14632, and somewhat backs out https://github.com/matrix-org/synapse/commit/9f797a24a452a513628263b1b03172cee20a9856, but I still don't understand how that could ever happen. (Note that instead of raising an error if the event is unknown, we instead ignore the receipt. This should also help in situations where a room is purged, kind of like #15464.)
Sorry for the large diff -- one of the commits in the middle moves some tests around.