Skip to content

Commit 08ca4f0

Browse files
fixed event decoding crash
1 parent 100aa72 commit 08ca4f0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/Echidna/Events.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import Data.Text (pack, Text)
1717
import Data.Tree (flatten)
1818
import Data.Tree.Zipper (fromForest, TreePos, Empty)
1919
import Data.Vector (fromList)
20+
import Data.Vector qualified as V
2021

2122
import EVM (traceForest)
22-
import EVM.ABI (Event(..), Indexed(..), decodeAbiValue, getAbi, AbiType(..), AbiValue(..))
23+
import EVM.ABI (Event(..), Indexed(..), decodeAbiValue, getAbiSeq, AbiType(..), AbiValue(..))
2324
import EVM.Dapp (DappContext(..), DappInfo(..))
2425
import EVM.Expr (maybeLitWordSimp)
2526
import EVM.Format (showValues, showError, contractNamePart)
@@ -91,10 +92,12 @@ extractEventValues dappInfo vm vm' =
9192
LogEntry _addr (ConcreteBuf bs) (sigHash : _) ->
9293
case Map.lookup (forceWord sigHash) dappInfo.eventMap of
9394
Just (Event _ _ params) ->
94-
[ (ty, val)
95-
| (_, ty, NotIndexed) <- params
96-
, Right (_, _, val) <- [ runGetOrFail (getAbi ty) (fromStrict bs) ]
97-
]
95+
let
96+
types = [ t | (_, t, NotIndexed) <- params ]
97+
in
98+
case runGetOrFail (getAbiSeq (length types) types) (fromStrict bs) of
99+
Right (_, _, vals) -> zip types (V.toList vals)
100+
_ -> []
98101
Nothing -> []
99102
_ -> []
100103

0 commit comments

Comments
 (0)