Skip to content

Commit

Permalink
Merge pull request #592 from chainbound/lore/chore/logs
Browse files Browse the repository at this point in the history
fix(sidecar): don't send empty delegations and warn about it
  • Loading branch information
merklefruit authored Dec 17, 2024
2 parents 6d0f407 + e2a1aa4 commit 435fa2a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion bolt-sidecar/src/client/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ethereum_consensus::{
deneb::mainnet::SignedBlindedBeaconBlock, Fork,
};
use reqwest::Url;
use tracing::error;
use tracing::{error, span_enabled, trace, warn, Level};

use crate::{
api::{
Expand Down Expand Up @@ -141,6 +141,24 @@ impl BuilderApi for ConstraintsClient {
.cloned()
.collect::<Vec<_>>();

if filtered_delegations.is_empty() {
warn!("No delegations found for the incoming validator registrations");
// Works also with directives like `RUST_LOG=bolt_sidecar=trace`
if span_enabled!(Level::TRACE) {
let delegations_pubkeys = self
.delegations
.iter()
.map(|d| &d.message.validator_pubkey)
.collect::<HashSet<_>>();
let without_delegations = validator_pubkeys
.iter()
.filter(|p| !delegations_pubkeys.contains(*p))
.collect::<Vec<_>>();
trace!("validator public keys without delegations: {:?}", without_delegations);
}
return Ok(());
}

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

0 comments on commit 435fa2a

Please sign in to comment.