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

Improve neighbor message sending logic. #708

Open
Zurcusa opened this issue Jan 22, 2025 · 0 comments
Open

Improve neighbor message sending logic. #708

Zurcusa opened this issue Jan 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Zurcusa
Copy link
Collaborator

Zurcusa commented Jan 22, 2025

As per spec:

Neighbor messages are sent to all connected peers but they are not re-propagated on reception. A message should be sent whenever the values of the message change and at least every 5 minutes. The sender should take the recipient's state into account and avoid sending messages to peers that are using different voter sets or are in a different round. Messages received from a future voter set or round can be dropped and ignored.

Our current flow is as follows:

  • We send neighbor messages every 5 minutes (5 minute init delay) to all connected peers. - This complies with the spec regarding the 5 minutes rule, but we do not check which of our peers are actually in the same set and round as us. Also the 5 minute initial delay can be skipped. A more suitable approach would be to check if we are the head of the chain and then actually send scheduled messages.
  • Every time we receive a neighbor message we send one back to the sending peer - I am not sure why this was done as it does not comply to the spec in any way.

Desirable flow:
We send neighbor messages in the following scenarios:

  • When we finalize a block.
    • For light client, full node and authoring node not a part of the voter set this will happen when commit message.
    • For authoring node that is a part of the voter set this will happen when we finalize a block via the Atemp-to-Finalize
  • When we switch a setId.
    • For light client, full node and authoring node not a part of the voter set this will happen when we handle authority changes from incoming blocks.
    • For authoring node that is a part of babe producers this will happen when we handle authority changes from produced and incoming blocks.
  • When we switch a round.
    • For light client, full node and authoring node not a part of the voter set this will happen on commit message when it has a different roundId from ours.
    • For authoring node that is a part of the voter set this will happen when we play a new grandpa round.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants