Add some debug logs for checkpoint sync (#3281)

## 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
This commit is contained in:
Paul Hauner 2022-06-23 05:19:20 +00:00
parent 7af5742081
commit 748658e32c

View File

@ -276,6 +276,8 @@ where
BeaconNodeHttpClient::new(url, Timeouts::set_all(CHECKPOINT_SYNC_HTTP_TIMEOUT)); BeaconNodeHttpClient::new(url, Timeouts::set_all(CHECKPOINT_SYNC_HTTP_TIMEOUT));
let slots_per_epoch = TEthSpec::slots_per_epoch(); let slots_per_epoch = TEthSpec::slots_per_epoch();
debug!(context.log(), "Downloading finalized block");
// Find a suitable finalized block on an epoch boundary. // Find a suitable finalized block on an epoch boundary.
let mut block = remote let mut block = remote
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Finalized, &spec) .get_beacon_blocks_ssz::<TEthSpec>(BlockId::Finalized, &spec)
@ -290,6 +292,8 @@ where
})? })?
.ok_or("Finalized block missing from remote, it returned 404")?; .ok_or("Finalized block missing from remote, it returned 404")?;
debug!(context.log(), "Downloaded finalized block");
let mut block_slot = block.slot(); let mut block_slot = block.slot();
while block.slot() % slots_per_epoch != 0 { while block.slot() % slots_per_epoch != 0 {
@ -301,6 +305,12 @@ where
"block_slot" => block_slot, "block_slot" => block_slot,
); );
debug!(
context.log(),
"Searching for aligned checkpoint block";
"block_slot" => block_slot
);
if let Some(found_block) = remote if let Some(found_block) = remote
.get_beacon_blocks_ssz::<TEthSpec>(BlockId::Slot(block_slot), &spec) .get_beacon_blocks_ssz::<TEthSpec>(BlockId::Slot(block_slot), &spec)
.await .await
@ -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(); let state_root = block.state_root();
debug!(
context.log(),
"Downloading finalized state";
"state_root" => ?state_root
);
let state = remote let state = remote
.get_debug_beacon_states_ssz::<TEthSpec>(StateId::Root(state_root), &spec) .get_debug_beacon_states_ssz::<TEthSpec>(StateId::Root(state_root), &spec)
.await .await
@ -326,6 +348,8 @@ where
format!("Checkpoint state missing from remote: {:?}", state_root) 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) let genesis_state = BeaconState::from_ssz_bytes(&genesis_state_bytes, &spec)
.map_err(|e| format!("Unable to parse genesis state SSZ: {:?}", e))?; .map_err(|e| format!("Unable to parse genesis state SSZ: {:?}", e))?;