Use ? debug formatting for block roots in beacon_chain.rs (#2890)

## Issue Addressed

NA

## Proposed Changes

Ensures full roots are printed, rather than shortened versions like `0x935b…d376`.

For example, it would be nice if we could do API queries based upon the roots shown in the `Beacon chain re-org` event:

```
Jan 05 12:36:52.224 WARN Beacon chain re-org                     reorg_distance: 2, new_slot: 2073184, new_head: 0x8a97…2dec, new_head_parent: 0xa985…7688, previous_slot: 2073183, previous_head: 0x935b…d376, service: beacon
Jan 05 13:35:05.832 WARN Beacon chain re-org                     reorg_distance: 1, new_slot: 2073475, new_head: 0x9207…c6b9, new_head_parent: 0xb2ce…839b, previous_slot: 2073474, previous_head: 0x8066…92f7, service: beacon
```

## Additional Info

We should eventually fix this project-wide, however this is a short-term patch.
This commit is contained in:
Paul Hauner 2022-01-06 05:16:50 +00:00
parent fac117667b
commit f6b5b1a8be

View File

@ -3072,7 +3072,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
trace!(
self.log,
"Produced beacon block";
"parent" => %block.parent_root(),
"parent" => ?block.parent_root(),
"attestations" => block.body().attestations().len(),
"slot" => block.slot()
);
@ -3178,10 +3178,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
warn!(
self.log,
"Beacon chain re-org";
"previous_head" => %current_head.block_root,
"previous_head" => ?current_head.block_root,
"previous_slot" => current_head.slot,
"new_head_parent" => %new_head.beacon_block.parent_root(),
"new_head" => %beacon_block_root,
"new_head_parent" => ?new_head.beacon_block.parent_root(),
"new_head" => ?beacon_block_root,
"new_slot" => new_head.beacon_block.slot(),
"reorg_distance" => reorg_distance,
);
@ -3189,11 +3189,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
debug!(
self.log,
"Head beacon block";
"justified_root" => %new_head.beacon_state.current_justified_checkpoint().root,
"justified_root" => ?new_head.beacon_state.current_justified_checkpoint().root,
"justified_epoch" => new_head.beacon_state.current_justified_checkpoint().epoch,
"finalized_root" => %new_head.beacon_state.finalized_checkpoint().root,
"finalized_root" => ?new_head.beacon_state.finalized_checkpoint().root,
"finalized_epoch" => new_head.beacon_state.finalized_checkpoint().epoch,
"root" => %beacon_block_root,
"root" => ?beacon_block_root,
"slot" => new_head.beacon_block.slot(),
);
};