Skip to content

p2p: support new msg broadcast features; #3043

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

galaio
Copy link
Contributor

@galaio galaio commented Apr 22, 2025

Description

This PR aims to implement the msg broadcast mechanism of bnb-chain/BEPs#563.

For Message Propagation

Some connection features will be enabled between validators to optimize network congestion and reduce message latency.

  • Transaction: it will not be propagated between validators.
  • Block: it will directly broadcast to all other connected validators in this network.
  • Vote: same as block.

It will make a more stable network between validators. It also allows adding more normal nodes in DirectBroadcastList.

Example

You should set the config as below:

[Node]
EnableBroadcastFeature = true

[Node.P2P]
DirectBroadcastList =["nodeid1", "nodeid2"]

Changes

Notable changes:

  • p2p: support new msg broadcast features;
  • ...

@galaio galaio requested review from MatusKysel, buddh0 and zzzckck April 22, 2025 14:12
p2p: support new msg broadcast features;

p2p: add more logs;
@@ -764,6 +778,13 @@ func (h *handler) BroadcastBlock(block *types.Block, propagate bool) {
transfer = peers[:]
} else {
transfer = peers[:int(math.Sqrt(float64(len(peers))))]
// add more direct broadcast peers
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe too much peers to broadcast...

Copy link
Contributor Author

@galaio galaio Apr 23, 2025

Choose a reason for hiding this comment

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

It's ok, we use the flood broadcast mechanism for validator network, the maximum number of nodes that can be broadcast simultaneously is 200, which depends on MaxNodeIDs*NumOfValidator.

By the way, if the remote know the block, it won't broadcast too.

@buddh0
Copy link
Collaborator

buddh0 commented Apr 23, 2025

need a better var name than EnableBroadcastFeature,
‘EnableEnhancedBroadcast’ ?

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.

2 participants