Skip to content

Commit

Permalink
fix(sidecar): send filtered delegations to mev-boost and not all of them
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 31, 2024
1 parent fc02ed4 commit ae6caf3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bolt-sidecar/src/client/constraints_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,22 @@ impl BuilderApi for ConstraintsClient {
return Err(BuilderApiError::FailedRegisteringValidators(error));
}

// If there are any delegations, propagate them to the relay
// If there are any delegations, propagate the one associated to the incoming registrations to the relay
if self.delegations.is_empty() {
return Ok(());
} else if let Err(err) = self.delegate(&self.delegations).await {
error!(?err, "Failed to propagate delegations during validator registration");
} else {
let validator_pubkeys =
registrations.iter().map(|r| r.message.public_key.clone()).collect::<HashSet<_>>();
let filtered_delegations = self
.delegations
.iter()
.filter(|d| validator_pubkeys.contains(&d.message.validator_pubkey))
.cloned()
.collect::<Vec<_>>();

if let Err(err) = self.delegate(&filtered_delegations).await {
error!(?err, "Failed to propagate delegations during validator registration");
}
}

Ok(())
Expand Down

0 comments on commit ae6caf3

Please sign in to comment.