Skip to content

change(network): Broadcast block submissions to all peers in the peer set - #9907

Merged
mergify[bot] merged 9 commits into
mainfrom
advertise-mined-blocks-to-all-ready-peers
Oct 6, 2025
Merged

change(network): Broadcast block submissions to all peers in the peer set#9907
mergify[bot] merged 9 commits into
mainfrom
advertise-mined-blocks-to-all-ready-peers

Conversation

@arya2

@arya2 arya2 commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Motivation

It would be nice to broadcast accepted block submissions to all ready peers.

Solution

  • Adds a AdvertiseBlockToAll variant to the zebra-network Request type
  • Handles the new request variant in the peer set by sending it to all ready peers
    • Factors logic for sending a request to multiple peers out of route_multiple()
    • Adds a broadcast_all() method which sends a request to every ready peer
  • Updates the gossip_best_tip_block_hashes() task to call the peer set with a AdvertiseBlockToAll request instead of AdvertiseBlock if the block hash/height being advertised were received from the mined block channel.

Related changes:

  • Corrects a doc comment on AdvertiseBlock (it routes to a third of ready peers, not half)
  • Updates error message from the submitblock RPC when the mined block channel is closed

PR Checklist

  • The PR name is suitable for the release notes.
  • The PR follows the contribution guidelines.
  • The library crate changelogs are up to date.
  • The solution is tested.
  • The documentation is up to date.

@oxarbitrage

Copy link
Copy Markdown
Contributor

Nice, this is part of #9721

@oxarbitrage

Copy link
Copy Markdown
Contributor

… to peers when submitted in quick succession
…AdvertiseBlockToAll` requests to unready peers once they become ready, and updates block hash gossip task to avoid advertising block submissions to some peers twice.
…ers that were unready at the time of the last call to `broadcast_all()`
@arya2
arya2 force-pushed the advertise-mined-blocks-to-all-ready-peers branch from f2d8ded to 7dc3178 Compare September 23, 2025 02:13
…rs()` method and calls it again after calling `broadcast_all_queued()` if `ready_services` is empty.
@arya2

arya2 commented Sep 23, 2025

Copy link
Copy Markdown
Contributor Author

We might want to test this by removing:

https://github.com/ZcashFoundation/zebra/blob/main/zebra-rpc/qa/rpc-tests/addnode.py#L73-L79

I replaced that with a single call to generate(10), it should only broadcast most of those to 1 peer as the rest will be unready and the peerset only sends the last AdvertiseBlockToAll request to unready peers once they become ready, but the 1 peer that receives each advertised block will then advertise to all of its peers.

We could make queued_broadcast_all_request a vector and always send every block submission to every peer, but that doesn't seem useful on Mainnet.

Comment thread zebra-network/src/peer_set/set.rs Outdated
Comment thread zebrad/src/components/sync/gossip.rs
Comment thread zebra-network/src/peer_set/set.rs
Comment thread zebrad/src/components/sync/gossip.rs
Comment thread zebrad/src/components/sync/gossip.rs
Comment thread zebra-rpc/src/methods/types/submit_block.rs Outdated
Comment thread zebrad/src/components/sync/gossip.rs
@arya2

arya2 commented Sep 23, 2025

Copy link
Copy Markdown
Contributor Author

@gustavovalverde any idea why the deploy nodes job is being skipped?

@gustavovalverde

Copy link
Copy Markdown
Member

@gustavovalverde any idea why the deploy nodes job is being skipped?

@arya2 We recently decided to move it to the main branch only. I also recently merged a fix to avoid the success job from failing. If you'd like to run the stateful tests in this PR you can add the run-stateful-tests label to it.

@oxarbitrage oxarbitrage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good. This will also close #9721 if merged as the other task was done in #9917

Comment thread zebrad/src/components/inbound/tests/real_peer_set.rs Outdated
Comment thread zebra-rpc/src/methods/types/submit_block.rs Outdated
Comment thread zebrad/src/components/sync/gossip.rs
Comment thread zebrad/src/components/sync/gossip.rs
Comment thread zebra-network/src/peer_set/set.rs
@arya2 arya2 changed the title change(network): Broadcast block submissions to all ready peers change(network): Broadcast block submissions to all peers in the peer set Oct 2, 2025
@arya2
arya2 marked this pull request as ready for review October 3, 2025 03:53
@arya2
arya2 requested review from a team as code owners October 3, 2025 03:53
@arya2
arya2 requested review from upbqdn and removed request for a team October 3, 2025 03:53

@oxarbitrage oxarbitrage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@mergify mergify Bot added the queued label Oct 6, 2025
mergify Bot added a commit that referenced this pull request Oct 6, 2025
@mergify
mergify Bot merged commit c6eea49 into main Oct 6, 2025
87 checks passed
@mergify
mergify Bot deleted the advertise-mined-blocks-to-all-ready-peers branch October 6, 2025 20:38
@mergify mergify Bot removed the queued label Oct 6, 2025
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.

3 participants