106 Commits

Author SHA1 Message Date
Jason Volk
7da56bf7f4 fix some tests
Signed-off-by: Jason Volk <jason@zemos.net>
2025-02-05 11:26:08 +00:00
Jason Volk
ac37db212a fix lints
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-01 22:20:39 +00:00
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
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
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
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
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
05c88d6afc state-res: Fix new clippy warnings 2024-02-14 13:07:21 +01: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
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
ca78825e94 events: rename RoomEventType to TimelineEventType 2023-01-03 10:36:13 +01: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
Jonas Platte
8912182c56
Increase usage of implicit named arguments in format strings 2022-06-03 10:06:28 +02:00
Jonas Platte
73c2963ebd
Enforce consistent semicolons after ()-typed expressions in blocks 2022-06-03 08:40:16 +02:00
Jonas Platte
6100a0fa12 Use new owned ID types in more places 2022-04-20 10:39:36 +02:00
Jonas Platte
d855ec33d6 identifiers: Update ToOwned implementations to use new types
… and a lot of changes that cascaded from that.
2022-04-20 10:39:36 +02:00
Jonas Platte
b3cea6b998
state-res: Use StateEventType over RoomEventType where applicable 2022-04-09 00:55:14 +02:00
Jonas Platte
7de3b4b649
events: Rework the event enum hierarchy 2022-04-05 14:29:17 +02:00
Jonas Platte
d87874314b
events: Add 'Original' prefix to unredacted types with a redacted form 2022-04-05 14:29:17 +02:00
Jonas Platte
ce785064a9
Use RoomEventType instead of EventType for PDUs and power levels 2022-03-16 12:20:17 +01:00
Kévin Commaille
bdcf07be87
common: Merge ruma-serde into ruma-common 2022-03-10 12:11:00 +01:00
Kévin Commaille
088d1872b7
common: Merge ruma-identifiers into ruma-common 2022-03-09 17:46:51 +00:00
gnieto
fca0f6a22b
Minor fix on join member auth rules
Previous code was not checking/enforcing rule 4.3.1
(https://spec.matrix.org/v1.2/rooms/v9/), which states that a room
member event (with a join membership) must be accepted only if it contains
a previous event which `state_key` is the room creator.

On top of that, it simplifies the public interface for `auth_rules`,
removing the need of (externally) compute `prev_event`, which, as a side
effect, should reduce the amount of times the previous event needs to be
fetched: It will only load it if the authorized event is a `m.room_member`
with a `Join` state.

Finally, I've splitted the join conditions so it's (hopefully) more
readable and apply auth rules in the same order as they
appear in the spec.
2022-03-08 08:27:47 +01:00
Kévin Commaille
c3f9a3cb70
common: Merge ruma-events into ruma-common 2022-03-04 11:45:07 +00:00
Jonathan de Jong
eeba51d4d6
state-res: Resolve FIXME comment 2022-02-02 14:27:59 +01:00
Jonathan de Jong
8348b97091
Improve Synapse compatibility w.r.t. power levels 2022-02-01 15:26:30 +01:00
Jonas Platte
7cf3abbaf0
state-res: Remove unnecessary cloning 2021-12-22 17:46:05 +01:00
Jonas Platte
6abfe3ff70
state-res: Remove unnecessary allow attribute 2021-12-22 17:45:50 +01:00
Jonas Platte
7e3b727d04
Fix / silence clippy lints 2021-12-09 15:50:42 +01:00
Jonas Platte
96374a7517
state-res: Rename RoomVersion::VERSION{num} to RoomVersion::V{num} 2021-12-04 18:59:39 +01:00
Jonas Platte
16f031fabb
state-res: Make the API generic over the event ID storage 2021-11-27 23:18:34 +01:00
Jonas Platte
a9c12f0909
state-res: Remove EventMap type alias 2021-11-27 22:44:34 +01:00
Jonas Platte
399bd7d82d
state-res: Rename generic parameter 2021-11-27 18:13:32 +01:00
Jonas Platte
9ed75241a6
state-res: Refactor lexicographical_topological_sort
Gets rid of unnecessary copying and makes things more explicit by using
a struct with named fields instead of a tuple for tie breaking.

Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>
2021-11-26 20:22:57 +01:00
Jonas Platte
6b76d7813e
identifiers: Shorten RoomVersionId variant names 2021-11-26 01:07:26 +01:00
Jonas Platte
3ce578f384
identifiers: Make UserId a DST 2021-11-26 00:40:40 +01:00
Jonas Platte
2d4dbfe42f
identifiers: Make RoomId a DST 2021-11-26 00:04:28 +01:00