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 | Add support for verified identities change detection. #3795

Merged
merged 12 commits into from
Aug 8, 2024

Conversation

BillCarsonFr
Copy link
Member

Fixes #1129

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@BillCarsonFr BillCarsonFr force-pushed the valere/invisible_crypto/verification_pin branch from 3218831 to 7ff2f75 Compare August 2, 2024 10:33
@BillCarsonFr BillCarsonFr marked this pull request as ready for review August 2, 2024 10:55
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner August 2, 2024 10:55
@BillCarsonFr BillCarsonFr requested review from andybalaam and removed request for a team August 2, 2024 10:55
Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

This looks good for the parts I understand, but I need some support from someone with more crypto knowledge, especially for 53b0484 . @poljar sorry to ask, but can you take a look?

crates/matrix-sdk-crypto/src/identities/user.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-crypto/src/identities/user.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-crypto/src/identities/user.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-crypto/src/identities/user.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-crypto/src/identities/user.rs Outdated Show resolved Hide resolved
@@ -2023,4 +2023,269 @@ pub(crate) mod tests {

Copy link
Member

Choose a reason for hiding this comment

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

This commit: "crypto: Verified identity changes TDD" - I would say that the tests for something could be in the same commit as the code itself, so no need for a separate commit here.

If you want a separate commit I suggest "crypto: Tests for verified_latch" or similar.

crates/matrix-sdk-crypto/src/identities/manager.rs Outdated Show resolved Hide resolved

pub struct VerificationLatchTestData {}

#[allow(dead_code)]
Copy link
Member

Choose a reason for hiding this comment

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

Would #[cfg(test)] work? If so, it's better than allowing dead code.

Copy link
Member Author

Choose a reason for hiding this comment

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

No it's not, if I add it then the crypto crate won't compile. If I understand well the test config doesn't propagate to other crates, so the annotated code here won't be accessible. I thinking that's why there is the testing cfg? Not sure how to make it work

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that is why the testing feature exists. It's painful, but better than #[allow(dead_code)]. There is an example in crates/matrix-sdk-crypto/src/lib.rs in the module called testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are other #[allow(dead_code)] in this file unrelated to the current changes. Will do a follow-up PR to remove them

own_user_identity.is_identity_signed(&identity).is_ok()
});
if is_verified {
identity.mark_as_verified_once();
Copy link
Member

Choose a reason for hiding this comment

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

Wait, do the tests in the previous commit fail without this? I would like those tests to be in the same commit that makes them pass, or a later one.

Copy link
Member

Choose a reason for hiding this comment

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

Now I see why you called the commit "TDD" - because the tests were written before the code! That is awesome during development, but we don't want commits in the history that fail tests because it is much harder to git bisect to find what caused a problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

So now, as I can't force push, I have to wait the end of the review, then reset all to re-order the changes and then force push?
Won't all of this squashed at the end?

Copy link
Member

Choose a reason for hiding this comment

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

No, we don't squash when we merge: after review, we force push a sensible set of commits, then merge with "Rebase and merge".

@andybalaam andybalaam requested a review from poljar August 2, 2024 11:32
Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 99.16667% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.15%. Comparing base (57963dc) to head (1b05380).

Files Patch % Lines
crates/matrix-sdk-crypto/src/identities/user.rs 97.56% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3795      +/-   ##
==========================================
+ Coverage   84.07%   84.15%   +0.07%     
==========================================
  Files         263      263              
  Lines       27471    27584     +113     
==========================================
+ Hits        23097    23212     +115     
+ Misses       4374     4372       -2     

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

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Left some questions we should discuss.

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Alright, I still feel like this might produce performance issues and the whole thing might not work out as we expect it, but I don't have concrete advice which will solve this.

@BillCarsonFr BillCarsonFr force-pushed the valere/invisible_crypto/verification_pin branch from 66d6e45 to e715223 Compare August 7, 2024 11:48
@BillCarsonFr BillCarsonFr force-pushed the valere/invisible_crypto/verification_pin branch from e715223 to 1b05380 Compare August 7, 2024 13:06
@richvdh richvdh dismissed andybalaam’s stale review August 8, 2024 08:39

comments addressed, I hope

@richvdh richvdh merged commit f3fe06b into main Aug 8, 2024
40 checks passed
@richvdh richvdh deleted the valere/invisible_crypto/verification_pin branch August 8, 2024 10:10
@poljar
Copy link
Contributor

poljar commented Aug 8, 2024

comments addressed, I hope

Err, at least this wasn't addressed: #3795 (comment)

@richvdh
Copy link
Member

richvdh commented Aug 15, 2024

Argh. @poljar, @andybalaam, @BillCarsonFr: please remember to document changes in the changelog, especially if they are going to cause breaking changes to the cryptostore such that old apps won't run with new stores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants