matrix-org / matrix-org/matrix-js-sdk
`cryptoApi.isEncryptionEnabledInRoom` is slow in `decryption-failure-messages.spec.ts > decryption failure messages`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
When working on https://github.com/element-hq/element-web/pull/28278 to migrate to use `cryptoApi.isEncryptionEnabledInRoom`, the test [`decryption-failure-messages.spec.ts > decryption failure messages`](https://github.com/element-hq/element-web/blob/develop/playwright/e2e/crypto/decryption-failure-messages.spec.ts#L31) was in failure when https://github.com/element-hq/element-web/blob/de820e11fc2bc20eb608055205e1e44d11f2c740/playwright/e2e/crypto/decryption-failure-messages.spec.ts#L70-L72 is tested.
It's failing because the room is taking too much time to be displayed because `cryptoApi. isEncryptionEnabledInRoom` is taking up to 4sec to respond in this case.
`this.olmMachine.getRoomSettings(new RustSdkCryptoJs.RoomId(roomId));` call is causing this slowness:
https://github.com/matrix-org/matrix-js-sdk/blob/69647a33b6ed227e9cf433a8f20ee74cae59f59a/src/rust-crypto/rust-crypto.ts#L383-L391
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with playwright/e2e/crypto/decryption-failure-messages.spec.ts, especially the decryption failure messages test and the referenced lines, then inspect rust-crypto/rust-crypto.ts around lines 383-391 where getRoomSettings is called. Reproduce the test and investigate why cryptoApi.isEncryptionEnabledInRoom takes up to four seconds; done means the test no longer fails because the room is displayed too slowly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- performance, security, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100