From d4010ad278406da05ece41355eb3b20ddeeb4b1b Mon Sep 17 00:00:00 2001 From: Sam Alws Date: Tue, 11 Apr 2023 13:35:37 -0400 Subject: [PATCH] fix srcMapCodePos --- CHANGELOG.md | 1 + src/EVM/Debug.hs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af1005dcf..0c398472c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - The `prank` cheatcode now transfers value from the correct address +- Fixed an off-by-one error in `EVM.Debug.srcMapCodePos` ## [0.50.4] - 2023-03-17 diff --git a/src/EVM/Debug.hs b/src/EVM/Debug.hs index 504bdd3aa..513cc3723 100644 --- a/src/EVM/Debug.hs +++ b/src/EVM/Debug.hs @@ -47,7 +47,7 @@ srcMapCodePos :: SourceCache -> SrcMap -> Maybe (Text, Int) srcMapCodePos cache sm = fmap (second f) $ cache.files ^? ix sm.file where - f v = ByteString.count 0xa (ByteString.take (sm.offset - 1) v) + 1 + f v = ByteString.count 0xa (ByteString.take sm.offset v) + 1 srcMapCode :: SourceCache -> SrcMap -> Maybe ByteString srcMapCode cache sm =