Commit Graph

143 Commits

Author SHA1 Message Date
Michael Goldenberg
3bac5d250d refactor(benchmarks): remove reference to matrix-sdk/rustls-tls feature flag
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-04-07 09:44:33 -04:00
Damir Jelić
16c1b9b57f chore: Bump rand 2026-03-31 16:57:50 +02:00
mgoldenberg
b65e450813 Support TLS v1.3 on all platforms (#6053)
**Note:** _this pull request has a companion pull request in the
[`complement-crypto`](https://github.com/matrix-org/complement-crypto/pull/229)
repository, which must be merged in conjunction with this one._

_Before merging, this should be tested in conjunction with the Element X
iOS client to ensure that TLS v1.3 is working properly._ @stefanceriu
has agreed to work on this.

## Overview

The primary change in this pull request upgrades the `reqwest`
dependency to its latest version, which defaults to using `rustls` with
support for `rustls-platform-verifier` instead of `native-tls` (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
The benefit here is that `rustls` supports TLS v1.3 on all platforms,
whereas [`native-tls` does
not](https://github.com/sfackler/rust-native-tls/pull/278).

Additionally, this pull request makes `rustls` the default TLS
implementation in all the crates in this repository.

This will be particularly helpful with element-hq/element-x-ios#786.

## Changes

- `reqwest` bumped to `0.13.1`
- The API for adding/replacing certificates has changed a bit, so this
required some updating in `HttpSettings::make_client`
- `oauth2-reqwest` added in favor of `oauth2/reqwest` 
    - This is required in order to be compatible with `reqwest^0.13`
- _**`oauth2-reqwest` is currently in alpha release, so it probably
makes sense to let this stabilize a bit.**_ For details, see
https://github.com/ramosbugs/oauth2-rs/issues/333#issuecomment-3906712203.
- `getrandom` bumped to `0.3.4`
    - This is required in order to be compatible with `oauth2@5.1.0`
- `proptest` bumped to `1.9.0`
    - This is required in order to be compatible with `getrandom@0.3.4` 
- Make `rustls` the default TLS implementation

## Questions

### Mirror feature flag names?

A number of feature flags have been replaced in the dependencies above.

1. _**`reqwest/rustls-tls` => `reqwest/rustls`**_ - this is simply a
name change, but is semantically identical (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
2. _**`getrandom/js` => `getrandom/wasm_js`**_ - the semantics here have
changed slightly, but it seems to just make it easier to enable the
`wasm_js` backend (see
[`getrandom@0.3.4`](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md#major-change-to-wasm_js-backend)).

At any rate, I have updated references to these flags in each of the
various `Cargo.toml` files, but have not changed the names of our
exposed features to mimic those in the dependencies.

Any thoughts or preferences on whether to mirror those names? That
would, of course, result in a breaking change.

### Default to using `rustls`? Deprecate `native-tls`?

Now that the dependencies have all been bumped, we can use `rustls` on
all platforms. Should this be the new default given that `native-tls`
will very likely never support TLS v1.3 on Apple devices? And should
`native-tls` be deprecated as a result?

**UPDATE:** _The consensus here seems to be that we should default to
using `rustls`, but that `native-tls` should still be available._

---
Fixes #5800.


- [ ] Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>

---------

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-03-10 13:38:18 +01:00
Kévin Commaille
7c16d673fb benchmarks: Use realistic Matrix IDs in timeline
We rely on the EventFactory to generate a hash of the events for the
event IDs, and we use the appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Kévin Commaille
e9fbbb52d5 benchmarks: Use realistic Matrix IDs in store_bench
Use the appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Kévin Commaille
c05df39132 benchmarks: Use realistic Matrix IDs in room_list
We rely on the EventFactory to generate a hash of the events for the
event IDs, and we use the appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Kévin Commaille
d572d201c9 benchmarks: Use realistic Matrix IDs in room_bench
We generate an arbitrary hash for the event IDs, and we use the
appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Kévin Commaille
39aa777b9b benchmarks: Use realistic Matrix IDs in linked_chunk
We rely on the EventFactory to generate a hash of the events for the
event IDs, and we use the appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Kévin Commaille
f0ae0e53f9 benchmarks: Use realistic Matrix IDs in event_cache
We rely on the EventFactory to generate a hash of the events for the
event IDs, and we use the appropriate length for room IDs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Benjamin Bouvier
8dbb6e5c1d refactor(event cache): rename Gap::prev_token to token
As it is now used for both a previous batch token (backwards pagination)
or a next batch token (forwards pagination).
2026-03-04 12:13:22 +01:00
Kévin Commaille
747b5db764 refactor: Remove unnecessary clones with .to_owned()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-02-23 14:29:55 +01:00
Kévin Commaille
5d18820120 refactor: Use owned_*_id! macros rather than *_id!().to_owned()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-02-23 14:29:55 +01:00
Jorge Martín
54e4cb2d10 refactor: Rename CrossProcessStoreConfig into CrossProcessLockConfig, move it into matrix_sdk_common::cross_process_lock and use it inside CrossProcessLock instead of the previous lock_holder: Option<String> 2026-02-19 17:04:57 +01:00
Jorge Martín
287049c719 refactor: Rename CrossProcessStoreMode to CrossProcessStoreConfig 2026-02-19 17:04:57 +01:00
Jorge Martín
50b1e3baf2 refactor: Use the new APIs everywhere 2026-02-19 17:04:57 +01:00
Benjamin Bouvier
347d348bf4 fix(bench): add a sender to the room encryption event 2026-02-16 10:53:31 +01:00
Benjamin Bouvier
622825f099 refactor(test): remove StateTestEvent::Encryption 2026-02-16 10:26:11 +01:00
Benjamin Bouvier
7fbb2ddae1 test: add a new method for the state pinned events in the event factory 2026-02-10 18:41:15 +01:00
Benjamin Bouvier
17840e52f5 refactor(timeline): start removing unused stuff in the timeline code
Now that this logic has moved to the event cache, it's not required in
the timeline anymore.
2026-02-05 16:43:25 +01:00
Ivan Enderlin
dc680b8594 chore: benchmarks uses the workspace-defined tokio. 2026-02-05 09:02:29 +01:00
Ivan Enderlin
fbff1ee99a bench: Bump codspeed-criterion-compat to 4.2.1. 2026-01-15 12:50:25 +01:00
Doug
59604713e8 chore: Re-use the existing track_read_receipts setting to hide receipts on state events.
# Conflicts:
#	bindings/matrix-sdk-ffi/CHANGELOG.md
2025-12-02 15:36:34 +01:00
Ivan Enderlin
1cf0601ba3 refactor(sdk) Introduce RoomEventCacheStateLock and read/write guards.
This patch extracts fields from `RoomEventCacheState` and move them
into `RoomEventCacheStateLock`. This lock provides 2 methods: `read`
and `write`, respectively to acquire a read-only lock, and a write-only
lock, represented by the `RoomEventCacheStateLockReadGuard` and the
`RoomEventCacheStateLockWriteGuard` types.

All “public” methods on `RoomEventCacheState` now are facade to the read
and write guards.

This refactoring makes the code to compile with the last change in
`EventCacheStore::lock`, which now returns a `EventCacheStoreLockState`.
The next step is to re-load `RoomEventCacheStateLock` when the lock is
dirty! But before doing that, we need this new mechanism to centralise
the management of the store lock.
2025-11-25 15:41:27 +01:00
Ivan Enderlin
ec5c31a19d chore(bench): Add the room_list benchmark.
This patch adds the `room_list` benchmark. The goal is to measure
the time it takes to create a room list, to sort it, to filter and to
“display” it.
2025-09-18 15:38:16 +02:00
Damir Jelić
1e30916754 chore: Bump most of our deps 2025-09-01 16:33:10 +02:00
Benjamin Bouvier
001dadffe1 bench: add a benchmark for finding related events (#5578)
Does what it says on the tin. Split from the performance fix, so we can
get some initial numbers on the CI bench runs too.

Part of investigating
https://github.com/matrix-org/matrix-rust-sdk/issues/5572
2025-08-26 15:57:06 +02:00
Benjamin Bouvier
838f607b32 refactor(benchmark): slightly change the benchmark to make it not use iter_custom
Instead of creating a fresh client every single time, this creates a
single client with a single event cache store, that's cleared between
runs of the benchmark.

So the tradeoff is:
- we don't have to create a new client anymore, which means no more
async setup code, which means we can avoid using `iter_custom`; a
benefit of this is that this can be benchmarked on CI now.
- but we're also measuring the time it takes to clear the database,
which isn't trivial in itself.
2025-08-21 15:19:26 +02:00
Benjamin Bouvier
6965004812 fix(benchmark): make the event cache benchmark compute what it's supposed to 2025-08-21 15:19:26 +02:00
Damir Jelić
5ad477ac96 tests: Rename some more benchmarks 2025-08-01 11:33:08 +02:00
Damir Jelić
975432565d tests: Enable timers for the runtime of the store bench 2025-08-01 11:33:08 +02:00
Damir Jelić
46b0113765 tests: Rename some crypto benchmarks
This is mostly due to codspeed not showing the group name, so we're
repeating this info in the benchmark ID.
2025-08-01 11:33:08 +02:00
Damir Jelić
09eff8c6bd ci: Lower the amount of events we benchmark against on the CI 2025-08-01 11:33:08 +02:00
Benjamin Bouvier
b645c1101f refactor(test): avoid proliferation of builder submethods in the MockClientBuilder
Instead of having one static method duplicating an underlying
`ClientBuilder` method, we can pass the builder directly to a closure,
that will replace it. Call sites are a bit more verbose, but that would
avoid having to add duplicate `MockClientBuilder` methods for each
`ClientBuilder` method.
2025-07-30 11:56:31 +02:00
Damir Jelić
d40f04e32c chore: Remove the criterion function in the benchmarks
It's now equivalent to Criterion::default().
2025-07-24 17:11:03 +02:00
Damir Jelić
d8294a0788 Fix the compilation of the crypto bench 2025-07-24 17:09:59 +02:00
Damir Jelić
06a4476e7f ci: Disable a benchmark that panics on the CI 2025-07-24 16:48:28 +02:00
Damir Jelić
06bf487512 chore: Attempt to get rid of a crash on CI where the runtime isn't used for a drop 2025-07-24 15:40:41 +02:00
Damir Jelić
d75d7973b2 ci: Enable benchmarks on the CI 2025-07-24 13:37:45 +02:00
Damir Jelić
cfe3adce48 chore: Bump criterion 2025-07-24 13:37:45 +02:00
Damir Jelić
b478ae65f7 tests: Remove pprof 2025-07-24 13:37:45 +02:00
Benjamin Bouvier
d6fe654814 bench: add a benchmark for measuring the time it takes to handle a sync update in the event cache 2025-07-23 11:21:09 +02:00
Ivan Enderlin
165ec9db1b bench: Add a benchmark for EventCacheStore::load_all_chunks_metadata. 2025-07-21 10:31:44 +02:00
Jonas Platte
8aa6f97f7c chore: Upgrade benchmarks to Rust Edition 2024 2025-07-15 08:39:27 +02:00
Stefan Ceriu
b44a1e46c4 feat(base): ignore threaded messages when computing room read receipts and client wide threads feature flag
With the UI crate now sending threaded read receipts we need to start considering them when computing unread counts. As a first step before the participation model, threaded messages will be ignored when computing room unread counts.
2025-07-04 11:42:35 +03:00
Benjamin Bouvier
ebcb74a86d refactor!(event cache): introduce LinkedChunkId in the backends (#5182)
In a "soon" future, threads have their own linked chunk. All our code
has been written with the fact that a linked chunk belong to *a room* in
mind, so it needs some biggish update. Fortunately, most of the changes
are mechanical, so they should be rather easy to review.

Part of #4869, namely #5122.
2025-06-09 13:26:46 +00:00
Jonas Platte
8eec683793 refactor: Use inline format arguments more
Automated with cargo clippy --fix --workspace --all-targets.
2025-05-29 13:19:59 +02:00
Jonas Platte
3aa356dcd6 chore: Use shorter syntax for workspace inheritance where possible 2025-05-23 10:23:36 +02:00
Jonas Platte
491f7cd529 chore: Clean up Cargo.toml formatting 2025-05-23 10:23:36 +02:00
Stefan Ceriu
195ee35eea change(ffi): move the utd hook from the sync service to the client 2025-05-21 16:38:20 +03:00
Stefan Ceriu
f2ca0697af chore(ui): remove the timeline's builder method and make the builder's constructor public 2025-05-21 16:38:20 +03:00