Skip to content

VC fallback broadcast runs in series #5232

@paulhauner

Description

@paulhauner

Description

The BeaconNodeFallback::broadcast function broadcasts in series when I think it would be more effective in parallel.

The issue with a series broadcast is that the last node in the BN list doesn't receive the message until waiting for the full round-trip of all other BNs.

This presents two immediate issues:

  1. It's likely that time-sensitive messages (like sync committees) will frequently arrive late to the last node in the BN list, creating spammy logs.
  2. If an BN early in the list times out then we're very likely to be too late for all other BNs. This is the case for blocks.

Steps to resolve

Instead of this sort of pattern:

for node in nodes {
  node.publish().await
}

We should adopt something like:

use tokio::task::JoinSet;

let mut set = JoinSet::new();

// Start executing the futures in parallel.
for node in nodes {
  set.spawn(node.publish())
}

// Process the results as they come in.
while let Some(response) = set.join_next().await {
  // handle `response`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    optimizationSomething to make Lighthouse run more efficiently.v5.3.0Q3 2024 release with database changes!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions