From 74d3127970a2bac89f54684c51e94c22afc07ccf Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Mon, 12 Aug 2024 04:08:34 +0100 Subject: [PATCH] review: WithHash -> CustomFmt --- trace_decoder/src/decoding.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trace_decoder/src/decoding.rs b/trace_decoder/src/decoding.rs index 9bc2daf21..21cf7aaf7 100644 --- a/trace_decoder/src/decoding.rs +++ b/trace_decoder/src/decoding.rs @@ -147,7 +147,7 @@ fn update_beacon_block_root_contract_storage( false => { storage_trie.insert(slot, val.clone()).context(format!( "at slot {} with value {}", - WithHash(U512::from_big_endian(slot.bytes_be().as_slice())), + CustomFmt(U512::from_big_endian(slot.bytes_be().as_slice())), U512::from_big_endian(val.as_slice()) ))?; @@ -191,7 +191,7 @@ fn update_beacon_block_root_contract_storage( .insert(addr_nibbles, updated_account_bytes.to_vec()) .context(format!( "at slot {}", - WithHash(U512::from_big_endian(addr_nibbles.bytes_be().as_slice())) + CustomFmt(U512::from_big_endian(addr_nibbles.bytes_be().as_slice())) ))?; Ok(()) @@ -294,7 +294,7 @@ fn apply_deltas_to_trie_state( match val == &ZERO_STORAGE_SLOT_VAL_RLPED { false => storage_trie.insert(slot, val.clone()).context(format!( "at slot {} with value {}", - WithHash(U512::from_big_endian(slot.bytes_be().as_slice())), + CustomFmt(U512::from_big_endian(slot.bytes_be().as_slice())), U512::from_big_endian(val.as_slice()) ))?, true => { @@ -657,9 +657,9 @@ fn eth_to_gwei(eth: U256) -> U256 { const ZERO_STORAGE_SLOT_VAL_RLPED: [u8; 1] = [128]; /// Formatting aid for error context. -struct WithHash(U512); +struct CustomFmt(T); -impl fmt::Display for WithHash { +impl fmt::Display for CustomFmt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut buf = [0u8; 64]; self.0.to_big_endian(&mut buf);