194 Commits

Author SHA1 Message Date
Jason Volk
d3ed3194eb replace constant with function parameter for io-parallelism
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-24 13:52:53 +00:00
Jason Volk
307186ebdc optimize IO for iterative_auth_check and get_power_level_for_sender
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-24 13:52:53 +00:00
Jason Volk
1a550585bf state-res: parallelize fetches within some loops
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 23:56:43 +00:00
Jason Volk
9c84a3be3e state-res: fetch event_auth state events in parallel
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 23:05:10 +00:00
Jason Volk
c1f5f3f20b optimize PL deserialization
add generalized map_as_vec deserializer

Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 13:43:30 +00:00
Kévin Commaille
13a546056e chore: Remove unnecessary lifetimes 2024-11-29 17:45:04 -05:00
Charles Hall
bab06ed375 stateres: make separate O(n) instead of O(n^2)
This way my poor CPU only has to do ~600,000 iterations to resolve
Matrix HQ from scratch. The old algorithm required ~85,000,000,000.

As a treat, we can also drop the dependency on itertools.
2024-11-29 17:43:43 -05:00
Charles Hall
3a2ee354fc stateres: add tests for separate fn
This function has terrible perf so I want to try improving it, but I
need some examples to test against to make sure I don't break anything.
2024-11-29 17:36:48 -05:00
Charles Hall
e31b9dd3a4 state-res: refactor tiebreaking logic for clarity 2024-11-29 17:35:08 -05:00
strawberry
97e2fb6df1
state-res: fix allow knock -> leave on same state_key and sender
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-20 22:57:53 -05:00
strawberry
d1f635764e
state-res: fix incorrect knock join_rule checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-20 19:34:39 -05:00
strawberry
8c323cf6e6 clarify confusing knock event auth warning
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:07:47 -05:00
Charles Hall
aff5d8532f state-res: improve tracing spans and events
slight modifications, mainly just restricting these to
debug log level to prevent incurring the overhead of
the instruments, and tiny adjustments for async state res

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:07:42 -05:00
strawberry
cf31b8798f add more missing unspecced r0 endpoints, fix silly upload_signatures struct
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-19 19:00:37 -05:00
Kévin Commaille
f87f388280 events: Use Signatures in more places 2024-11-08 13:13:37 -05:00
Charles Hall
c3fb396352 state-res: improve tracing spans and events
* Make use of tracing's structured logging features
* Change some wording to align with the spec
2024-11-07 18:52:02 -05:00
Charles Hall
35e459d86e state-res: fix tiebreaking comparisons
`node` needs to be swapped with `parent` here, otherwise the
`power_level` and `age` in a `TieBreaker` inserted on the following line
are always equal, because both sides are the values for `node` rather
than a different value of `parent` on each iteration, and so the only
thing that could possibly be different is the `event_id` because that's
correctly set to `parent`. This is why I was observing tiebreaks always
being sorted by `event_id` and experiencing incorrectly resolved states.
2024-11-07 18:42:10 -05:00
Jason Volk
e7db44989d async state-res
Signed-off-by: Jason Volk <jason@zemos.net>
2024-09-24 22:58:36 +00:00
Jason Volk
d8d9d2030d Make state_res interface iterators +Send
Signed-off-by: Jason Volk <jason@zemos.net>
2024-09-21 00:46:57 +00:00
Jason Volk
5873bbd53e Make state-res Error +Send
Signed-off-by: Jason Volk <jason@zemos.net>
2024-09-21 00:37:55 +00:00
strawberry
e6e8462c05 Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-05-06 12:21:06 -04:00
Matthias Ahouansou
8ecbc47e55 state-res: perform extra redaction checks for v1 and v2 rooms rather than v3+ 2024-05-06 14:56:09 +02:00
Jason Volk
37ffec73c9 state-res: downgrade info! log messages to debug!
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-16 03:21:44 -07:00
Kévin Commaille
a8f1440698 state-res: Refactor Knock membership transition 2024-03-05 10:43:52 +01:00
Kévin Commaille
812625fab4 state-res: Disallow invite->knock membership transition
Due to a spec clarification that reverts the previous spec clarification
2024-02-28 10:34:52 +01:00
Kévin Commaille
05c88d6afc state-res: Fix new clippy warnings 2024-02-14 13:07:21 +01:00
Jonas Platte
984cbda962
identifiers: Don't require room IDs to contain a server name
Room IDs being splittable into localpart and servername does not have
much inherent value and there are proposals like MSC4051¹ that propose
changing the format. Relaxing the rules makes Ruma forwards-compatible
with those proposals. The server_name accessor is kept because it is
used by at least one downstream, but is updated to return an `Option`.

¹ https://github.com/matrix-org/matrix-spec-proposals/pull/4051
2023-09-28 16:43:16 +02:00
Jonas Platte
31331f3165
Bring back ruma-events
Co-authored-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-08-28 10:23:54 +02:00
Jonas Platte
8e10064364 Enforce import grouping
Includes a few manual changes to make rustfmt behave a bit better.
2023-08-22 12:31:49 +02:00
Kévin Commaille
afd8f2f652 state-res: Add RoomVersion::V11
According to MSC3820
2023-08-14 17:23:17 +02:00
Kévin Commaille
bcae4e5799 chore: Use .is_some_and(…) instead of .map_or(false, …) 2023-08-14 16:17:25 +02:00
Kévin Commaille
1701d9a803 events: Make creator field of RoomCreateEventContent optional and RedactedRoomreateEventContent a typedef
According to MSC2175
2023-08-14 15:33:39 +02:00
Jonas Platte
3dac70ead9
Remove most unreachable visibility modifiers 2023-07-19 14:32:14 +02:00
Kévin Commaille
c77f08024a chore: Fix new clippy lints 2023-07-04 11:55:25 +02:00
Ivan Enderlin
66f417c3f2 chore: Make Clippy happy. 2023-04-06 14:51:25 +02:00
Kévin Commaille
f159776f52 chore: Make all applicable spec links use the latest spec instead of a specific version 2023-02-12 12:39:24 +01:00
Kévin Commaille
ca78825e94 events: rename RoomEventType to TimelineEventType 2023-01-03 10:36:13 +01:00
Kévin Commaille
045861441a doc: Update Matrix spec links to v1.4 2022-10-21 10:41:20 +02:00
Kévin Commaille
279c9d0fa6 state-res: Allow invite->knock membership transition
According to spec clarification
2022-10-10 17:29:08 +02:00
Nyaaori
68eecf71af state-res: Fix third party invite validation 2022-10-10 17:20:58 +02:00
Jonas Platte
a11c27e7e1
state-res: Update docs 2022-09-22 11:49:17 +02:00
Jonas Platte
66ff4dbaad Raise MSRV to 1.62 2022-09-20 13:49:16 +02:00
Kévin Commaille
df821ab753 state-res: Enforce integer PLs for room v10 on custom types
According to MSC3667
2022-06-27 13:19:25 +02:00
Kévin Commaille
da462adab1 state-res: Stabilize deserializing stringified integers for PLs
Removes the `compat` feature.
2022-06-27 13:19:25 +02:00
Kévin Commaille
ca3ca023a4 state-res: Remove unnecessary serde attributes 2022-06-27 13:19:25 +02:00
Kévin Commaille
b38efe75c3 state-res: Fix default invite power level
According to matrix-org/matrix-spec#1021
2022-06-27 13:19:25 +02:00
Kévin Commaille
ef072654da state-res: Add knock_restricted join rule
According to MSC3787
2022-06-25 18:22:32 +02:00
Kévin Commaille
e683d28afe state-res: Enforce integer power levels for room v10
According to MSC3667
2022-06-25 18:22:32 +02:00
Kévin Commaille
2fcb7315b4 state-res: Add RoomVersion::V10 2022-06-25 18:22:32 +02:00
Kévin Commaille
324c8b09e0
state-res: Add m.federate to the authorization rules 2022-06-25 18:11:57 +02:00