From f6b5b1a8be46ce21503ac2e91934438ded687321 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 6 Jan 2022 05:16:50 +0000 Subject: [PATCH] Use `?` debug formatting for block roots in beacon_chain.rs (#2890) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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. --- beacon_node/beacon_chain/src/beacon_chain.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index eed4e4fb4..6edcb7d6c 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -3072,7 +3072,7 @@ impl BeaconChain { 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 BeaconChain { 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 BeaconChain { 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(), ); };