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

Ap/join network sync improvement zend 616 #586

Merged
merged 9 commits into from
Aug 9, 2023

Conversation

a-petrini
Copy link
Contributor

@a-petrini a-petrini commented Aug 1, 2023

This PR changes the logic behind the connection of two zend nodes in the test framework. In particular, we introduced a check that explicitly waits for the two nodes to exchange their respective verack messages before continuing with the test. This prevents racing conditions such as requesting data to a node before the connection takes place.

For this purpose, we enriched the getpeerinfo() RPC command with two new fields: bytessent_per_msg and bytesrecv_per_msg, two dictionaries which collect the amount of sent and received data, divided by message category.

This PR also modifies a few tests that were sporadically failing because of that racing condition.

Finally, we fixed mempool_coinbase_spends test which lacked proper synchronization between the two nodes.

Copy link
Contributor

@titusen titusen left a comment

Choose a reason for hiding this comment

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

Nice cleanup. LGTM, thanks.

@a-petrini a-petrini force-pushed the ap/join_network_sync_improvement_ZEND-616 branch from 281ba35 to d17c746 Compare August 3, 2023 13:19
Copy link
Contributor

@JackPiri JackPiri left a comment

Choose a reason for hiding this comment

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

The PR is fine to me, it should definitely solve our sync errors during test and that's great.
I left few minor comments; probably only the one related to PushMessage in main.cpp really to be addressed, the others can be skipped.

@a-petrini a-petrini force-pushed the ap/join_network_sync_improvement_ZEND-616 branch 2 times, most recently from 5acd8a5 to 7dda8a4 Compare August 8, 2023 08:00
Copy link
Contributor

@drgora drgora left a comment

Choose a reason for hiding this comment

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

I left a couple of minuscule comments, feel free to ignore. Looks good to me, thanks!

@a-petrini a-petrini force-pushed the ap/join_network_sync_improvement_ZEND-616 branch from f2c361b to 0aad1dc Compare August 9, 2023 10:49
All net messages strings / const char* have been replaced with equivalent instances
uniquely defined in NetMsgType namespace
This commit adds maps mapSendBytesPerMsgType and mapRecvBytesPerMsgType in CNode
class, to keep track of how many messages o f a specific kind and how many bytes
for each message type a peer exchanges.
…sage

This commit updates getpeerinfo rpc command by adding fields bytessent_per_msg and
bytesrecv_per_msg that contains the amount of data (in bytes) exchaned with a peer,
divided by message type
This commit changes the logic of Python test framework's connect_nodes() function.
It now waits for the two peers to receive the 'verack' version before exiting, preventing
race conditions such as two nodes exchanging messages before the actual connection handshake
has been completed
@a-petrini a-petrini force-pushed the ap/join_network_sync_improvement_ZEND-616 branch from 0aad1dc to c6112c5 Compare August 9, 2023 10:52
@ptagl ptagl merged commit 506d566 into main Aug 9, 2023
@ptagl ptagl deleted the ap/join_network_sync_improvement_ZEND-616 branch August 9, 2023 13:26
a-petrini added a commit that referenced this pull request Aug 30, 2023
Python tests of this PR relies on changes introduced in PR #586, which is not included
in this release. This commit fixes the issue temporarily.
a-petrini added a commit that referenced this pull request Aug 30, 2023
Python tests of this PR relies on changes introduced in PR #586, which is not included
in this release. This commit fixes the issue temporarily.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants