From 7807107bfa241f01d9ca0e841599ae661f02a340 Mon Sep 17 00:00:00 2001 From: ggrieco-tob Date: Mon, 18 Sep 2023 18:53:10 +0200 Subject: [PATCH] make sure hex output is padded properly --- lib/Echidna/ABI.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Echidna/ABI.hs b/lib/Echidna/ABI.hs index f4b174dd2..e3532150a 100644 --- a/lib/Echidna/ABI.hs +++ b/lib/Echidna/ABI.hs @@ -20,6 +20,7 @@ import Data.List (intercalate) import Data.List.NonEmpty (NonEmpty) import Data.List.NonEmpty qualified as NE import Data.Maybe (fromMaybe, catMaybes) +import Text.Printf (printf) import Data.Text (Text) import Data.Text qualified as T import Data.Text.Encoding (encodeUtf8) @@ -71,7 +72,7 @@ ppAbiValue = \case AbiInt _ n -> show n AbiAddress n -> "0x" <> showHex n "" AbiBool b -> if b then "true" else "false" - AbiBytes 32 b -> "0x" <> BS.foldr showHex "" b + AbiBytes 32 b -> "0x" <> (BS.foldr (\x -> (<>) (printf "%02x" x)) "" b) AbiBytes _ b -> show b AbiBytesDynamic b -> show b AbiString s -> show s