peer-talk icon indicating copy to clipboard operation
peer-talk copied to clipboard

Replace protobuf-net with offical protobuf library

Open hanabi1224 opened this issue 5 years ago • 12 comments

This is a draft PR only, I can totally remove protobuf-net dependency if there're no concerns.

hanabi1224 avatar Jun 12 '19 01:06 hanabi1224

This looks great. Didn't know it could be so easy. Yes please continue with this PR.

Also net-ipfs-engine needs these changes.

Welcome to the team. I need all the help I can get.

richardschneider avatar Jun 12 '19 02:06 richardschneider

Codecov Report

Merging #37 into master will increase coverage by 0.32%. The diff coverage is 78.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage    76.9%   77.22%   +0.32%     
==========================================
  Files          51       51              
  Lines        2693     2692       -1     
==========================================
+ Hits         2071     2079       +8     
+ Misses        622      613       -9
Impacted Files Coverage Δ
src/Cryptography/EphermalKey.cs 57.69% <ø> (ø) :arrow_up:
src/Cryptography/StretchedKey.cs 87.93% <ø> (ø) :arrow_up:
src/SecureCommunication/Secio1.cs 2.88% <0%> (ø) :arrow_up:
src/Cryptography/Key.cs 0% <0%> (ø) :arrow_up:
src/PubSub/PublishedMessage.cs 100% <100%> (ø) :arrow_up:
src/Protocols/Identify1.cs 98% <100%> (ø) :arrow_up:
src/Cryptography/CtrStreamCipher.cs 86.36% <100%> (ø) :arrow_up:
src/PubSub/NotificationService.cs 100% <100%> (ø) :arrow_up:
src/ExtendedMessageEntensions.cs 100% <100%> (ø)
src/Cryptography/PreSharedKey.cs 100% <100%> (ø) :arrow_up:
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 26ade4d...a375fba. Read the comment docs.

codecov-io avatar Jun 12 '19 06:06 codecov-io

You work fast! It will take me some time to do a review.

I noticed you did a merge to the master. I like using rebase, so that other commits are not polluting the PR.

I know it is a religious war, but I prefer var x = new X(...) instead of X x = new X(...). Since this is a large code base, let's follow my rules.

Will start review in an hour, it's my diner time (18:20 in NZ)

richardschneider avatar Jun 12 '19 06:06 richardschneider

@richardschneider Done

hanabi1224 avatar Jun 12 '19 08:06 hanabi1224

@richardschneider u can use 'squash merge' to avoid polluting commit history, all commits will be merged into a single one. IMO Commit history during PR is not helpful, better to keep PR as small as possible and always square merge into master (this PR is large tho but still I don't think my commit history is helpful)

hanabi1224 avatar Jun 12 '19 08:06 hanabi1224

I do not like the changes to the unit test. The objects should behave exactly the same as before this PR and no external names should be changed. This is a biggie!

richardschneider avatar Jun 12 '19 09:06 richardschneider

@richardschneider There should not be any logic change in UT, all changes I've made are to switch from old protobuf-net DS to google-protobuf DS (otherwise it won't build : ()

hanabi1224 avatar Jun 12 '19 09:06 hanabi1224

@richardschneider Regarding all the style changes, only the _ prefix thing is what I did manually, others are all because I happen to run vs2019 code formatter (ctrl + K + E ) : (

In my experience, the easiest way to enforce formatting is to use tools like dotnet-format (unfortunately whose default ruleset has _ prefix thing and may not be what you would like )

hanabi1224 avatar Jun 12 '19 11:06 hanabi1224

@hanabi1224 I really want your changes. It's a good direction for this library.

However, PeerTalk test coverage is poor (my fault) so I'm spending a lot of time looking at all the changes.

richardschneider avatar Jun 16 '19 03:06 richardschneider

Because testing is poor in peer-talk, I built the package with your changes and then included it in net-ipfs-engine.

The secio changes caused connection with go-ipfs to failed. I'll start investigating and will get back to you.

richardschneider avatar Jun 18 '19 00:06 richardschneider

The secio protocol requires fixed 32 big endian length in many places. The code is using varint32. I've tried to note all the cases in my review.

Basically, need a big endian version of WriteDelimitedTo and ParseDelimitedFrom

richardschneider avatar Jun 18 '19 01:06 richardschneider

It will be great if you'd like to add more tests to cover the cases found in this PR. : )

hanabi1224 avatar Jun 18 '19 17:06 hanabi1224