Skip to content

Commit

Permalink
Add some debug logs for checkpoint sync (#3281)
Browse files Browse the repository at this point in the history
## Issue Addressed

NA

## Proposed Changes

I used these logs when debugging a spurious failure with Infura and thought they might be nice to have around permanently.

There's no changes to functionality in this PR, just some additional `debug!` logs.

## Additional Info

NA
  • Loading branch information
paulhauner committed Jun 23, 2022
1 parent 7af5742 commit 748658e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions beacon_node/client/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ where
BeaconNodeHttpClient::new(url, Timeouts::set_all(CHECKPOINT_SYNC_HTTP_TIMEOUT));
let slots_per_epoch = TEthSpec::slots_per_epoch();

debug!(context.log(), "Downloading finalized block");

// Find a suitable finalized block on an epoch boundary.
let mut block = remote
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Finalized, &spec)
Expand All @@ -290,6 +292,8 @@ where
})?
.ok_or("Finalized block missing from remote, it returned 404")?;

debug!(context.log(), "Downloaded finalized block");

let mut block_slot = block.slot();

while block.slot() % slots_per_epoch != 0 {
Expand All @@ -301,6 +305,12 @@ where
"block_slot" => block_slot,
);

debug!(
context.log(),
"Searching for aligned checkpoint block";
"block_slot" => block_slot
);

if let Some(found_block) = remote
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Slot(block_slot), &spec)
.await
Expand All @@ -312,7 +322,19 @@ where
}
}

debug!(
context.log(),
"Downloaded aligned finalized block";
"block_root" => ?block.canonical_root(),
"block_slot" => block.slot(),
);

let state_root = block.state_root();
debug!(
context.log(),
"Downloading finalized state";
"state_root" => ?state_root
);
let state = remote
.get_debug_beacon_states_ssz::<TEthSpec>(StateId::Root(state_root), &spec)
.await
Expand All @@ -326,6 +348,8 @@ where
format!("Checkpoint state missing from remote: {:?}", state_root)
})?;

debug!(context.log(), "Downloaded finalized state");

let genesis_state = BeaconState::from_ssz_bytes(&genesis_state_bytes, &spec)
.map_err(|e| format!("Unable to parse genesis state SSZ: {:?}", e))?;

Expand Down

0 comments on commit 748658e

Please sign in to comment.