Tribler / kotlin-ipv8

P2P communication library for Android
59 stars 27 forks source link

Eva improvements #71

Closed KoningR closed 1 year ago

KoningR commented 1 year ago

This PR introduces 3 improvements to EVA:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 76.47% and project coverage change: +0.04 :tada:

Comparison is base (0623f77) 58.32% compared to head (7f45901) 58.36%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #71 +/- ## ============================================ + Coverage 58.32% 58.36% +0.04% - Complexity 697 699 +2 ============================================ Files 107 107 Lines 4487 4487 Branches 634 634 ============================================ + Hits 2617 2619 +2 + Misses 1538 1534 -4 - Partials 332 334 +2 ``` | [Impacted Files](https://codecov.io/gh/Tribler/kotlin-ipv8/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler) | Coverage Δ | | |---|---|---| | [.../java/nl/tudelft/ipv8/messaging/eva/EVAProtocol.kt](https://codecov.io/gh/Tribler/kotlin-ipv8/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler#diff-aXB2OC9zcmMvbWFpbi9qYXZhL25sL3R1ZGVsZnQvaXB2OC9tZXNzYWdpbmcvZXZhL0VWQVByb3RvY29sLmt0) | `69.41% <72.54%> (ø)` | | | [ipv8/src/main/java/nl/tudelft/ipv8/Community.kt](https://codecov.io/gh/Tribler/kotlin-ipv8/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler#diff-aXB2OC9zcmMvbWFpbi9qYXZhL25sL3R1ZGVsZnQvaXB2OC9Db21tdW5pdHkua3Q=) | `74.80% <75.00%> (+0.79%)` | :arrow_up: | | [...ain/java/nl/tudelft/ipv8/messaging/eva/Transfer.kt](https://codecov.io/gh/Tribler/kotlin-ipv8/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler#diff-aXB2OC9zcmMvbWFpbi9qYXZhL25sL3R1ZGVsZnQvaXB2OC9tZXNzYWdpbmcvZXZhL1RyYW5zZmVyLmt0) | `96.90% <100.00%> (ø)` | | ... and [4 files with indirect coverage changes](https://codecov.io/gh/Tribler/kotlin-ipv8/pull/71/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Tribler)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

rmadhwal commented 1 year ago

I took a look at the changes and I'm curious if this change could cause issues if two incompatible EvaProtocols try to communicate with each other. i.e. one has encryption enabled and one doesn't ?

Maybe the network packet should indicate that the contents are encrypted so in the decryption step regardless of if the EvaProtocol uses encryption on its messages, an encrypted message can be decrypted ?

Also using "Synchronized" with coroutines is considered an antipattern, if you could make a test to replicate the race condition perhaps you might want to use a coroutine Mutex instead or channels which would suspend instead of blocking the coroutine :)

github-actions[bot] commented 1 year ago
File Coverage [80.14%] :green_apple:
Transfer.kt 87.79% :green_apple:
Community.kt 84.34% :green_apple:
EVAProtocol.kt 75.43% :x:
Total Project Coverage 63% :green_apple:
github-actions[bot] commented 1 year ago
File Coverage [80.14%] :green_apple:
Transfer.kt 87.79% :green_apple:
Community.kt 84.34% :green_apple:
EVAProtocol.kt 75.43% :x:
Total Project Coverage 62.98% :green_apple:
KoningR commented 1 year ago

@InvictusRMC and I discussed and decided to remove additional encryption options within the EVA protocol. Furthermore, the @Synchronized call is now replaced by a mutex.

github-actions[bot] commented 1 year ago
File Coverage [79.9%] :x:
Transfer.kt 87.79% :green_apple:
Community.kt 83.62% :green_apple:
EVAProtocol.kt 75.43% :x:
Total Project Coverage 62.95% :green_apple:
github-actions[bot] commented 1 year ago
File Coverage [80.14%] :green_apple:
Transfer.kt 87.79% :green_apple:
Community.kt 84.34% :green_apple:
EVAProtocol.kt 75.43% :x:
Total Project Coverage 62.97% :green_apple:
github-actions[bot] commented 1 year ago
File Coverage [79.87%] :x:
Transfer.kt 87.79% :green_apple:
Community.kt 83.51% :green_apple:
EVAProtocol.kt 75.43% :x:
Total Project Coverage 62.8% :green_apple: