-
Notifications
You must be signed in to change notification settings - Fork 33
[Pre2P] Refine the P2P module listening and IO behaviour #86
Copy link
Copy link
Closed
Labels
coreCore infrastructure - protocol relatedCore infrastructure - protocol relatedp2pP2P specific changesP2P specific changes
Milestone
Description
Objective
Implement and test RainTree's redundancy layer on top of the Pre2P module.
Origin Document
The Pocket Network V1 P2P Specification, supported by this explanation of RainTree is partially implemented in the pre2p/raintree branch atop the Pre2P module at the time of creating this issue.
While #80 is close to being done, #85 was opened to implement the redundancy layer.
Per offline discussions within the core team, we have decided to migrate Pre2P module to be the primary P2P module but transfer all the IO learnings from P2P` atop of it. The existing implementation can be found here: milestone/v1-prototype...integration/module/p2p-simplified-over-9000.
However, there are some major missing components which need to be added per a message from @derrandz:
Listening and IO behavior in Pre2P has consequences:
1. We accept connections sequentially, and we handle them in the same way, no async handling (not suitable for our use case)
2. We read off of connections with the expectation that the sender/writer will immediately close once he's done sending/that the sender is doing fire and dump style of communication (not connection pooling logic atm)
These observations mean:
we won't be able to achieve graceful shutdown with open connections, nor accept incoming connections concurrently or achieve ACK and waiting on ACKs behavior. (and make e2e tests difficult to write)
You can say that those were the main difference between P2P (albeit the approaches are different), as p2p does the following:
1. P2P Pools connections as default behavior and allows for graceful shutdowns.
2. P2P offers functionality to fire and forget with the Write method if you don't need the "connection pool". Send will pool or use a pooled connection. (e.g: the broadcast relies on Write)
The highlighted points are crucial behaviors that the p2p module has to have to allow for handshakes, sending messages and expecting ACKs (or syncing in the future)
Goals
Deliverables
- Non-tangible deliverables
- Transfer learnings from the initial
P2Pimplementation toPre2P - Identify and describe missing gaps in the
Pre2Pimplementation when it comms IO and connection pooling in this PR
- Transfer learnings from the initial
- List out the features which need to be transferred offered (e.g. P2P pooling, async message handling) and the difficulty of adding it to
Pre2P - Implement the list of features above
- Update the
README.md(to be added in thepre2p/raintreesoon) describing the added / modified code layout ofPre2P modulewith the new modifications
Testing Methodology
- Use
make test_pre2pto run existing tests - Update the test suite in
raintree_utils_test.goand addraintree_redundancy_layer_test.goint he same package with new tests - [Optional] Use
LocalNetas described indocs/development/README.md - [Optional] Using
Telemetry(if ready) to validate the results from (2)
Non-goals
- Scaling LocalNet to many nodes
- Resolving tech debt or optimizing existing code
- Replacing P2P with Pre2P
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreCore infrastructure - protocol relatedCore infrastructure - protocol relatedp2pP2P specific changesP2P specific changes
Type
Projects
Status
Done