Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send to-device event list, not wrapper, to engine #283

Merged
merged 2 commits into from Dec 7, 2022
Merged

Send to-device event list, not wrapper, to engine #283

merged 2 commits into from Dec 7, 2022

Conversation

AndrewFerr
Copy link
Contributor

As of matrix-org/matrix-rust-sdk@a443e7277, the JSON-encoded toDeviceEvents passed to OlmMachine.receiveSyncChanges must be the list of events themselves, instead of a wrapper object that contains the event list.

Signed-off-by: Andrew Ferrazzutti andrewf@element.io

Checklist

  • Tests written for all new code
  • Linter has been satisfied
  • Sign-off given on the changes (see CONTRIBUTING.md)

This fixes the mysterious crypto error of invalid type: map, expected a sequence that started happening after updating to beta.3 of the Rust SDK.

The reason behind the crash is that CryptoClient.updateSyncData was sending a JSON-encoded wrapper object around a list of to-devices message, which has the form {"events":[...]}. This used to be valid, but matrix-org/matrix-rust-sdk@a443e7277 changed the expected format to just the event list, instead of an object containing the list. An example of the new format in use can be found in tests/machine.test.js.

This fixes crashes for both bots & appservices, as even the latter calls CryptoClient.updateSyncData despite "sync-ish" things typically being used only by bots.

Note that bots may still crash in CryptoClient.updateSyncData without #272.

As of matrix-org/matrix-rust-sdk@a443e7277, the JSON-encoded
`toDeviceEvents` passed to OlmMachine.receiveSyncChanges must be the
list of events themselves, instead of a wrapper object that contains the
event list.

Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
Copy link
Owner

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@turt2live turt2live merged commit a4d9b03 into turt2live:main Dec 7, 2022
@AndrewFerr AndrewFerr deleted the af/fix-to-device-msg-list-type branch December 7, 2022 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants