Commit graph

1216 commits

Author SHA1 Message Date
Matthew Hodgson ed9e3fc385 use reverse topo ordering to find latest extrem 2020-09-27 00:42:06 +01:00
Matthew Hodgson fd90849802 fix comment 2020-09-27 00:31:56 +01:00
Matthew Hodgson 1e6e23dab1 switch SS /peek to use SendEventWithRewrite 2020-09-27 00:31:52 +01:00
Matthew Hodgson 927a62a7f0 add fixme 2020-09-27 00:31:25 +01:00
Matthew Hodgson 2b4353eeca fix SendEventWithRewrite not to bail if handed a non-state event 2020-09-27 00:31:15 +01:00
Matthew Hodgson 75c3f2df8d merge master 2020-09-26 23:27:39 +01:00
Neil Alexander 63af00d5d5
Update gomatrixserverlib to matrix-org/gomatrixserverlib#225 2020-09-25 17:53:16 +01:00
Neil Alexander 6275669e65
Set default room version to v6 (#1438) 2020-09-25 12:59:57 +01:00
Neil Alexander 145db37d89
Allow configuring old verify keys (#1443)
* Allow configuring old verify keys

* Update sample config

* Update sample config

* Fix config population

* Key ID formatting validity of old_verify_keys

* Update comment
2020-09-25 10:58:53 +01:00
Neil Alexander 6fbf89a166
Return the correct error codes for v6 invite JSON violations (#1440)
* Return the correct error codes for v6 invite JSON violations

* Update sytest-whitelist
2020-09-24 17:16:59 +01:00
Neil Alexander 3013ade84f
Reject make_join for empty rooms (#1439)
* Sanity-check room version on RS event input

* Update gomatrixserverlib

* Reject make_join when no room members are left

* Revert some changes from wrong branch

* Distinguish between room not existing and room being abandoned on this server

* nolint
2020-09-24 16:18:13 +01:00
Sam a6700331ce
Update all usages of tx.Stmt to sqlutil.TxStmt (#1423)
* Replace all usages of txn.Stmt with sqlutil.TxStmt

Signed-off-by: Sam Day <me@samcday.com>

* Fix sign off link in PR template.

Signed-off-by: Sam Day <me@samcday.com>

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-09-24 11:10:14 +01:00
Neil Alexander 60524f4b99
Update gomatrixserverlib to matrix-org/gomatrixserverlib#223 2020-09-23 12:47:16 +01:00
Neil Alexander de8b39065e
Enforce valid key IDs (#1437)
* Enforce valid key IDs

* Don't use key_id from dendrite.yaml as it is in matrix_key.pem
2020-09-23 11:07:57 +01:00
Matthew Hodgson 0ab4bc9e8e document the peek send stream race better 2020-09-23 00:11:58 +01:00
Matthew Hodgson 3202c7e76f go fmt 2020-09-23 00:08:23 +01:00
Matthew Hodgson 20e2cb4b7e track latestevent on /peek 2020-09-22 23:42:19 +01:00
Neil Alexander f908f8baab
Update gomatrixserverlib 2020-09-22 16:41:46 +01:00
Neil Alexander a854e3aa18
Fix backoff bug 2020-09-22 14:53:36 +01:00
Neil Alexander a14b29b526
Initial notary support (#1436)
* Initial work on notary support

* Somewhat working (but not properly filtered) notary support, other tweaks

* Update gomatrixserverlib
2020-09-22 14:40:54 +01:00
Neil Alexander a7563ede3d
Process federated joins in background context (#1434)
* Return early from federated room join

* Synchronous perform-join as long as possible

* Don't allow multiple federated joins to the same room by the same user
2020-09-22 11:05:45 +01:00
Neil Alexander 45de9dc1c0
Use room version cache in Events() 2020-09-21 16:49:37 +01:00
Neil Alexander a06c18bb56
Soft-fail (#1364)
* Initial work on soft-fail

* Fix state block retrieval

* Copy-pasta QueryLatestEventsAndState code

* Fix state lookup

* Clean up

* Fix up failing sytest

* Linting

* Update previous events SQLite insert query

* Update SQLite InsertPreviousEvent properly

* Hopefully fix the event references updates

Co-authored-by: Kegan Dougal <kegan@matrix.org>
2020-09-21 14:55:46 +01:00
Neil Alexander 880b164490
Refactor backoff again (#1431)
* Tweak backoffs

* Refactor backoff some more, remove BackoffIfRequired as it adds unnecessary complexity

* Ignore 404s
2020-09-21 13:30:37 +01:00
Matthew Hodgson 41b9b663a5 Merge branch 'master' into matthew/peeking-over-fed 2020-09-19 17:28:12 +01:00
Kegsay 18231f25b4
Implement rejected events (#1426)
* WIP Event rejection

* Still send back errors for rejected events

Instead, discard them at the federationapi /send layer rather than
re-implementing checks at the clientapi/PerformJoin layer.

* Implement rejected events

Critically, rejected events CAN cause state resolution to happen
as it can merge forks in the DAG. This is fine, _provided_ we
do not add the rejected event when performing state resolution,
which is what this PR does. It also fixes the error handling
when NotAllowed happens, as we were checking too early and needlessly
handling NotAllowed in more than one place.

* Update test to match reality

* Modify InputRoomEvents to no longer return an error

Errors do not serialise across HTTP boundaries in polylith mode,
so instead set fields on the InputRoomEventsResponse. Add `Err()`
function to make the API shape basically the same.

* Remove redundant returns; linting

* Update blacklist
2020-09-16 13:00:52 +01:00
Kegan Dougal ba6c7c4a5c Disable prometheus to unbreak tests 2020-09-15 16:15:34 +01:00
Neil Alexander 965f068d1a
Handle state with input event as new events (#1415)
* SendEventWithState events as new

* Use cumulative state IDs for final event

* Error wrapping in calculateAndSetState

* Handle overwriting same event type and state key

* Hacky way to spot historical events

* Don't exclude from sync

* Don't generate output events when rewriting forward extremities

* Update output event check

* Historical output events

* Define output room event type

* Notify key changes on state

* Don't send our membership event twice

* Deduplicate state entries

* Tweaks

* Remove unnecessary nolint

* Fix current state upsert in sync API

* Send auth events as outliers, state events as rewrite

* Sync API don't consume state events

* Process events actually

* Improve outlier check

* Fix local room check

* Remove extra room check, it seems to break the whole damn world

* Fix federated join check

* Fix nil pointer exception

* Better comments on DeduplicateStateEntries

* Reflow forced federated joins

* Don't force federated join for possibly even local invites

* Comment SendEventWithState better

* Rewrite room state in sync API storage

* Add TODO

* Clean up all room data when receiving create event

* Don't generate output events for rewrites, but instead notify that state is rewritten on the final new event

* Rename to PurgeRoom

* Exclude backfilled messages from /sync

* Split out rewriting state from updating state from state res

Co-authored-by: Kegan Dougal <kegan@matrix.org>
2020-09-15 11:17:46 +01:00
Kegsay 8dc9506210
Don't use more than 999 variables in SQLite querys. (#1425)
* Don't use more than 999 variables in SQLite querys.

Solve this problem in a more general and reusable way.
Also fix #1369
Add some unit tests.

Signed-off-by: Henrik Sölver <henrik.solver@gmail.com>

* Don't rely on testify for basic assertions

* Readability improvements and linting

Co-authored-by: Henrik Sölver <henrik.solver@gmail.com>
2020-09-14 16:39:38 +01:00
Matthew Hodgson 32f898d668 fix api.SendEventWithState with no event 2020-09-13 03:32:01 +01:00
Matthew Hodgson a160c074e8 setup inbound peeks db correctly 2020-09-13 03:31:11 +01:00
Matthew Hodgson 3caae7913b rename FSAPI's PerformPeek as PerformOutboundPeek 2020-09-13 00:14:24 +01:00
Matthew Hodgson 8f203febc1 rename ambiguous RemotePeek as InboundPeek 2020-09-13 00:04:02 +01:00
Matthew Hodgson 71732f2c28 add inbound peeks table and hook it up 2020-09-12 23:54:46 +01:00
Matthew Hodgson 0dc422cdd8 flesh out federation doc 2020-09-12 23:53:46 +01:00
Matthew Hodgson 36e32f14e6 add perform_handle_remote_peek.go 2020-09-12 23:01:43 +01:00
Matthew Hodgson 59e2be7113 rename remote_peeks_table as outbound_peeks_table 2020-09-12 23:01:06 +01:00
Matthew Hodgson 4e96e62923 rename RemotePeeks as OutboundPeeks 2020-09-12 22:59:25 +01:00
Matthew Hodgson 0ae0d11446 reimplement SS /peek to prod the RS to tell the FS about the peek 2020-09-12 22:45:00 +01:00
Matthew Hodgson 803647be56 handle SS /peek 2020-09-12 01:24:28 +01:00
Matthew Hodgson c6a2604edc support returning current state from QueryStateAndAuthChain 2020-09-12 01:23:57 +01:00
Matthew Hodgson fff18454b1 todo for authenticating state returned by /peek 2020-09-12 01:23:32 +01:00
Matthew Hodgson f8bb4487df fix sql thinko 2020-09-12 00:24:22 +01:00
Matthew Hodgson 410ac724a6 reinstate federated peeks in the roomserver (doh) 2020-09-12 00:23:57 +01:00
Matthew Hodgson df29509e7e fix build & lint 2020-09-11 22:39:50 +01:00
Matthew Hodgson a5c0521c3f fix build & lint 2020-09-11 22:31:56 +01:00
Matthew Hodgson 65e59a1af9 support SendEventWithState with optional event 2020-09-11 22:31:32 +01:00
Matthew Hodgson 4ef6a3c759 clean up bad merge 2020-09-11 21:06:51 +01:00
Matthew Hodgson baee97bff7 (almost) make it build 2020-09-11 21:04:33 +01:00
Matthew Hodgson f236e8290d Merge branch 'master' into matthew/peeking-over-fed 2020-09-11 19:44:40 +01:00