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

New web-sockets connector #5170

Merged
merged 17 commits into from May 18, 2023
Merged

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Apr 11, 2023

Reasoning behind the pull request

  • Refactored the WebSocket connector

Proposed changes

Testing procedure

  • Verify that all data are indexed in the Elasticseach cluster

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Patch coverage: 60.33% and no project coverage change.

Comparison is base (3b17089) 70.82% compared to head (3df9a57) 70.82%.

❗ Current head 3df9a57 differs from pull request most recent head a58411d. Consider uploading reports for the commit a58411d to get more accurate results

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feat/outport-refactor    #5170   +/-   ##
======================================================
  Coverage                  70.82%   70.82%           
======================================================
  Files                        675      677    +2     
  Lines                      87850    87941   +91     
======================================================
+ Hits                       62218    62284   +66     
- Misses                     20940    20960   +20     
- Partials                    4692     4697    +5     
Impacted Files Coverage Δ
facade/initial/initialNodeFacade.go 73.33% <0.00%> (-1.00%) ⬇️
facade/nodeFacade.go 78.35% <0.00%> (-0.49%) ⬇️
factory/network/networkComponents.go 0.00% <0.00%> (ø)
factory/network/networkComponentsHandler.go 0.00% <0.00%> (ø)
factory/status/statusComponents.go 0.00% <0.00%> (ø)
node/node.go 66.19% <0.00%> (-0.19%) ⬇️
outport/factory/outportFactory.go 88.63% <50.00%> (+5.65%) ⬆️
outport/host/driver.go 81.81% <81.81%> (ø)
outport/factory/hostDriverFactory.go 89.47% <89.47%> (ø)
api/groups/nodeGroup.go 89.36% <100.00%> (+0.67%) ⬆️
... and 2 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@miiu96 miiu96 marked this pull request as ready for review May 11, 2023 07:28
@miiu96 miiu96 changed the title New web-sockets connector [WIP] New web-sockets connector May 11, 2023
@iulianpascalau iulianpascalau self-requested a review May 11, 2023 07:32
# This flag shall only be used for observer nodes
Enabled = false
URL = "localhost:22111"
# This flag will start the WebSocket connector as server or client
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "ServerMode = false/true" ?

Copy link
Contributor

Choose a reason for hiding this comment

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

or Mode = "server"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed in Mode

URL = "localhost:22111"
# This flag will start the WebSocket connector as server or client
IsServer = false
# The url of the WebSocket client/server
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should clarify that this URL is used when using the driver in client mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be used in both cases because the URL is needed also for the server when it starts.

WithAcknowledge = true
# Currently, only "json" is supported. In the future, "gogo protobuf" could also be supported
MarshallerType = "json"
# The number of seconds when the client will try again to send the data
RetryDurationInSec = 5
BlockingAckOnError = false
Copy link
Contributor

Choose a reason for hiding this comment

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

add a descriptive comment on what this does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added


var log = logger.GetOrCreate("outport/factory/hostdriver")

func CreateHostDriver(args ArgsHostDriverFactory) (outport.Driver, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing comments in the whole file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@@ -0,0 +1 @@
package factory
Copy link
Contributor

Choose a reason for hiding this comment

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

missing unit tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}, nil
}

func (o *hostDriver) SaveBlock(outportBlock *outport.OutportBlock) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added


err = o.senderHost.Send(marshalledPayload, topic)
if err != nil {
o.log.Error("cannot send on route", "topic", topic, "error", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this still can happen while closing the node, I would filter out log.Error prints only if they are not of type closed error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

# This flag shall only be used for observer nodes
Enabled = false
URL = "localhost:22111"
# This flag will start the WebSocket connector as server or client
Copy link
Contributor

Choose a reason for hiding this comment

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

or Mode = "server"

log core.Logger
}

func NewHostDriver(args ArgsHostDriver) (*hostDriver, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

bogdan-rosianu
bogdan-rosianu previously approved these changes May 12, 2023
# This flag will start the WebSocket connector as server or client
IsServer = false
# The url of the WebSocket client/server
# This flag will start the WebSocket connector as server or client( can be "client" or "server")
Copy link
Contributor

Choose a reason for hiding this comment

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

typo:

as server or client (can be "client"

wrong spacing near the ( character

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

cmd/node/config/external.toml Outdated Show resolved Hide resolved
outport/host/driver.go Outdated Show resolved Hide resolved
gabi-vuls
gabi-vuls previously approved these changes May 18, 2023
Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

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

System test passed
@@ Log scanner @@

integrate-new-ws-client-server

================================================================================

  • Known Warnings 10
  • New Warnings 3
  • Known Errors 0
  • New Errors 0
  • Panics 0
    ================================================================================
  • block hash does not match 6548
  • wrong nonce in block 2528
  • miniblocks does not match 0
  • num miniblocks does not match 0
  • miniblock hash does not match 0
  • block bodies does not match 0
  • receipts hash missmatch 0
    ================================================================================
  • No jailed nodes on the testnet
    ================================================================================

bogdan-rosianu
bogdan-rosianu previously approved these changes May 18, 2023
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

just the spacing comment

@miiu96 miiu96 dismissed stale reviews from bogdan-rosianu and gabi-vuls via a58411d May 18, 2023 09:46
@miiu96 miiu96 merged commit 20bf440 into feat/outport-refactor May 18, 2023
4 checks passed
@miiu96 miiu96 deleted the integrate-new-ws-client-server branch May 18, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants