Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor some Nominator & NetworkManager code #618

Merged
merged 3 commits into from
Mar 5, 2020

Conversation

AndrejMitrovic
Copy link
Contributor

This is the first part of fixing #606

While implementing the feature, I've realized there are leaky abstractions here. In fact SCP only requires two networking functionalities:

  • receive an SCP message
  • gossip it

The second part can be left to the NetworkManager, as it also deals with features such as node banning, receiving new network connections (to be done), etc.

@AndrejMitrovic AndrejMitrovic added the type-refactoring An improvement on existing code without visible functional change label Mar 4, 2020
@codecov
Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #618 into v0.x.x will increase coverage by <.01%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           v0.x.x     #618      +/-   ##
==========================================
+ Coverage   90.06%   90.07%   +<.01%     
==========================================
  Files          62       62              
  Lines        4571     4564       -7     
==========================================
- Hits         4117     4111       -6     
+ Misses        454      453       -1
Flag Coverage Δ
#integration 53.76% <88.23%> (+0.91%) ⬆️
#unittests 88.93% <94.11%> (ø) ⬆️
Impacted Files Coverage Δ
source/agora/node/Node.d 100% <100%> (+1.17%) ⬆️
source/agora/consensus/protocol/Nominator.d 86% <100%> (-0.12%) ⬇️
source/agora/network/NetworkManager.d 74.49% <75%> (-0.17%) ⬇️

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 f4ace13...2105ebb. Read the comment docs.

Copy link
Member

@TrustHenry TrustHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is Greate.
PR #504 will be resolved.

But I see another problem #504

@AndrejMitrovic
Copy link
Contributor Author

Really? That was not my intention, but I'm glad if it's true. 👀

@TrustHenry
Copy link
Member

TrustHenry commented Mar 4, 2020

Really? That was not my intention, but I'm glad if it's true. 👀

maybe Intermittent http error began to be invisible.

Copy link
Collaborator

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. Just rebase and feel free to self merge.

Clients should not expect any status code when issuing calls
to the receiveEnvelope() API.

The node itself may care whether its internal SCP class
considers the envelope valid or not, but it does not need
to signal back to the client whether it accepted the envelope.

This is because this API should be used in an asynchronous way.
Aftera client floods a given SCPEnvelope to the network,
it does not care about how that envelope is further processed
by each node.
The transaction is propagated to the entire network,
so the name of the function should reflect that.
The NetworkManager should be in charge of gossiping
any transactions and SCPEnvelopes.

This reduces complexity, and avoids delayed initialization
of the set of peers in the Nominator class.

Additionally, in the future this will enable easier
gossiping to clients which connected to us first,
see issue bosagora#606 for more info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-refactoring An improvement on existing code without visible functional change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants