Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Parse in synchronizers #370

Merged
merged 6 commits into from Oct 1, 2020

Conversation

scasplte2
Copy link
Contributor

@scasplte2 scasplte2 commented Sep 19, 2020

Issue

Currently messages received from a remote peer are parsed by the NetworkController before being sent to the respective handlers. However, the message parsing does not need to happen at the NetworkController stage and can instead be passed to appropriate handler (aka a Synchronzier). In the current setup there are two issues that may be addressed:

  1. At the NetworkController, only the message code contained in the message spec is used to identify the handler for a message. This message code is available when the PeerConnectionHandler forwards the message to NetworkController therefore NetworkController is parsing data needlessly.
  2. Parsing an incoming message may be a time intensive procedure (particularly for large chunks of modifiers), thus stalling the NetworkController which may in turn delay other NetworkController responsibilities such as peer connections or handling egress traffic from our local node.

Proposed solution

A Synchronizer trait has been created and implemented by NodeViewSynchronizer and PeerSychronizer. This trait defines a common definition for parsing a message received from a remote peer and handing the parsed data off to a specified function for processing. This also allows for us to get rid of the DataFromPeer class a use a single representation of message data for both ingress and egress traffic.

@scasplte2
Copy link
Contributor Author

Unsure why the remote Travis tests are failing (it appears to be a dependency issue) but local runs of

sbt "project examples" clean coverage test && sbt test && sbt "project examples" coverageReport coveralls

appear to successfully pass. Perhaps a maintainer could trigger the run again to test if it is a temporary issue.

@kushti
Copy link
Contributor

kushti commented Sep 22, 2020

Unsure why the remote Travis tests are failing (it appears to be a dependency issue) but local runs of

sbt "project examples" clean coverage test && sbt test && sbt "project examples" coverageReport coveralls

appear to successfully pass. Perhaps a maintainer could trigger the run again to test if it is a temporary issue.

Travis failed to resolve a dependency, for unclear reasons.

@coveralls
Copy link

coveralls commented Sep 27, 2020

Coverage Status

Coverage remained the same at 46.984% when pulling 5977408 on scasplte2:parse_in_synchronizer into 3f089e0 on ScorexFoundation:master.

@kushti kushti merged commit 1086cef into hyperledger-labs:master Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants