-
Notifications
You must be signed in to change notification settings - Fork 219
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
crypto: Add more logs when sharing keys #3274
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3274 +/- ##
==========================================
+ Coverage 83.62% 83.64% +0.01%
==========================================
Files 239 239
Lines 24705 24725 +20
==========================================
+ Hits 20660 20680 +20
Misses 4045 4045 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some nits to make it a bit neater, also please address the CI issues.
&self, | ||
already_shared_devices: &Vec<(ReadOnlyDevice, ShareState)>, | ||
withthelds: &Vec<(ReadOnlyDevice, WithheldCode)>, | ||
) -> Vec<(String, String, String)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Vec<(String, String, String)>
is quite the handful. Can we add a type with the desired Debug
implementation instead? Then The split_devices()
method can return that directly.
devices: BTreeMap<OwnedUserId, Vec<ReadOnlyDevice>>, | ||
outbound: &OutboundGroupSession, | ||
) -> (Vec<ReadOnlyDevice>, Vec<(ReadOnlyDevice, ShareState)>) { | ||
let split: (Vec<(ReadOnlyDevice, ShareState)>, Vec<(ReadOnlyDevice, ShareState)>) = devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let split: (Vec<(ReadOnlyDevice, ShareState)>, Vec<(ReadOnlyDevice, ShareState)>) = devices | |
let (to_share_with, shared_with): (_, Vec<_>) = devices |
}) | ||
.partition(|(_, state)| matches!(state, ShareState::NotShared)); | ||
|
||
(split.0.into_iter().map(|(d, _)| d).collect(), split.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(split.0.into_iter().map(|(d, _)| d).collect(), split.1) | |
(to_share_with.into_iter().map(|(d, _)| d).collect(), shared_with) |
@@ -810,6 +806,13 @@ impl GroupSessionManager { | |||
let unable_to_encrypt_devices = | |||
self.encrypt_for_devices(devices, &outbound, &mut changes).await?; | |||
|
|||
// This could be verbose, but usefull to debug why a room key wasn't shared. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// This could be verbose, but usefull to debug why a room key wasn't shared. | |
// This could be verbose, but useful to debug why a room key wasn't shared. |
This is now months old without any comment. If you want to move this along, please reopen. |
I have been investigating some rageshakes recently, and often we don't have enough log history to see when/if a key was correctly distributed to another device.
This is an attempt to not only log to whom a key is shared in the current round, but also to log the other devices that we already tried to distribute too.
It might be a bit verbose? Let me know what you think.
The log look like that:
Signed-off-by: