Conversation
… reaching 50% of nodes. Need to add debug logs and fix the happy path
|
Re various tasks, done the following:
Re structure:
|
There was a problem hiding this comment.
I feel slightly strongly about some names in here, let me know if you can make those changes.
Overall, here are my thoughts:
In terms of implementation correctness for the networking part, you are now very familiar with most of my comments and they will be addressed in #86 and #54 and some others perhaps, but I think this makes for a very good prototype overall, as the code remedies itself, so to say.
On the other hand, when it comes to abstraction, I think I was not at ease initially with the two abstractions TransportLayerConn and Network.
As I read through, I think it makes for a good base abstraction and separates things well, decoupling logic from networking, so kudos for that.
Tests were good to read through, my issue was that I had to go look for those prepare and test functions outside of the context of the test case, but you can't complain as that DRYs code well enough. Only that I think it would be more semantic to name things to signify important stages of the test: Setup Run Teardown.
The best part of this PR is the rain tree implementation, names are verbose but everything is very clear.
Good work on this @Olshansk I think this is heading a good direction.
p2p/pre2p/types/network.go
Outdated
| type TransportLayerConn interface { | ||
| IsListener() bool | ||
| Read() ([]byte, error) | ||
| Write([]byte) error | ||
| Close() error | ||
| } |
There was a problem hiding this comment.
| type TransportLayerConn interface { | |
| IsListener() bool | |
| Read() ([]byte, error) | |
| Write([]byte) error | |
| Close() error | |
| } | |
| type Transport interface { | |
| IsListener() bool | |
| IsDialer() bool | |
| Accept() (net.Conn, error) | |
| Dial(...) (net.Conn, error) | |
| Close() error | |
| } |
There was a problem hiding this comment.
This is a suggestion, I think the name can definitely change, in terms of interface methods and behavior, I am not sure we can do it before #86 so we can keep it as is until then.
There was a problem hiding this comment.
-
I'm open to changing
TransportLayerConntoTransport, but can you get a 2nd opinion from someone or a reference showing it's the way to go? -
Do you think it's a good idea to start adding unused interface functions here before we have a need for them?
There was a problem hiding this comment.
-
Does it need a reference? I think it's obvious enough in my opinion and we should just rename it. We are dealing with a networking layer, that is transport, and this is a sufficient semantic queue to infer other things such as: a transport produces connections, a transport listens or dials, etc... But, since you are interested in references, I remember a nice little microservices go framework that used similar naming. Please check it at this link.
-
No, I think we can reserve this as a TODO until we execute [Pre2P] Refine the P2P module listening and IO behaviour #86
There was a problem hiding this comment.
Renamed TransportLayerConn to Transport and pushed.
|
Legend for my response on review comments
Some feedback review:
Next steps and open questions remaining:
|
|
@derrandz @andrewnguyen22 I believe I've addressed all the comments, so please re-review/approve if everything looks good to merge. |
|
Hey @Olshansk I've created #93 for the changelog task and tagged it as good starter task for the community as we've discussed before in this conversation. Since that conversation is linked as an origin document to the issue, referencing this issue on the PR will leave good trace-ability. |

Pocket Network's RainTree implementation as described here atop of the Pre2P module.
Changes
General
ValidatorJsonCompatibleWrapperbecause the protobuf structure cannot be imported from a json Genesis fileNode Configs
UseRainTreeandConnectionTypeoptions toPre2PConfigtcpconnection andRainTreeby defaultDevelopment Configs
node.consensusnode to enable Delve debugging (tested with VSCode but not Goland)Pre2P
pre2p/handlers.goin place to reduce # filespre2pto a generalTransportLayerConnto enable injecting an override for testing purposesstdnetwork, which is replaced byraintreebut can be toggled backRainTree
Networkinterface, which is a substitute for the previousstd networkTesting
Pre2P tests
All tests
LocalNet
Follow the instructions in docs/development/README.md
TODOs
TODO - After review
TODO - Did not finish
raintTreeNetworkspecific methods inaddrbook_utilstofunctionsthat are not tied to a struct instanceaddrbook_utils.goTODO - Future commits
typesGenesis.GetNodeStatewhich is a poor overall designTODOtypes left throughout the codestdnetworkaltogether and simplify code by embeddingBraintreein placeuber-go/digoruber-go/fxto use a proper dependency injection network