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

crypto: Replace the implementation of get_verification_state with SenderDataFinder #3772

Merged
merged 6 commits into from
Jul 30, 2024

Conversation

andybalaam
Copy link
Member

@andybalaam andybalaam commented Jul 29, 2024

Replace the implementation of get_verification_state with SenderDataFinder, since they are now equivalent.

Part of #3751

As part of developing this PR, I created (and then removed) this commit: 282320f which proves that for every case, converting from SenderDataFinder's result into a VerificationState and an Option<DeviceId> produces the same result as the old get_verification_state code, so we can safely replace it.

@andybalaam andybalaam changed the title crypto: Do not provide device ID to EncryptionInfo when device is not the owner crypto: Replace the implementation of get_verification_state with SenderDataFinder Jul 29, 2024
@andybalaam andybalaam force-pushed the andybalaam/lazily-populate-sender-data branch from 0d9cf72 to 282320f Compare July 29, 2024 16:24
@andybalaam
Copy link
Member Author

Pasting the patch for 282320f in case it ever disappears.

This code was temporary code to validate the SenderDataFinder and get_verification_state were equivalent.

validate-that-SenderData-produces-the-same-resul.patch.txt

@andybalaam andybalaam force-pushed the andybalaam/lazily-populate-sender-data branch from 282320f to 285f3ff Compare July 30, 2024 10:21
@andybalaam andybalaam marked this pull request as ready for review July 30, 2024 10:21
@andybalaam andybalaam requested a review from a team as a code owner July 30, 2024 10:21
@andybalaam andybalaam requested review from poljar and removed request for a team July 30, 2024 10:21
Copy link
Contributor

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

I'm not sure I follow every change, but it overall LGTM.

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 62.90323% with 23 lines in your changes missing coverage. Please review.

Project coverage is 84.01%. Comparing base (f51eebb) to head (fedd813).
Report is 6 commits behind head on main.

Files Patch % Lines
...rypto/src/olm/group_sessions/sender_data_finder.rs 47.50% 21 Missing ⚠️
crates/matrix-sdk-crypto/src/error.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3772      +/-   ##
==========================================
- Coverage   84.09%   84.01%   -0.08%     
==========================================
  Files         259      259              
  Lines       27109    27145      +36     
==========================================
+ Hits        22797    22806       +9     
- Misses       4312     4339      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

)
}
}
SenderData::UnknownDevice { owner_check_failed: true, .. } => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Shame that we can't put this into a From implementation, would cement down the fact that these two are parts of the same coin.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I considered that, and in a future PR I moved it into a function, but it's (SenderData, is_imported) -> (VerificationState, DeviceId) so it doesn't quite fit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I saw that is_imported messes everything up 😢.

@andybalaam andybalaam force-pushed the andybalaam/lazily-populate-sender-data branch from 89bcd6c to fedd813 Compare July 30, 2024 12:36
@andybalaam andybalaam enabled auto-merge (rebase) July 30, 2024 12:38
@andybalaam andybalaam merged commit f88c6df into main Jul 30, 2024
40 checks passed
@andybalaam andybalaam deleted the andybalaam/lazily-populate-sender-data branch July 30, 2024 12:50
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.

3 participants