From 25ce65dada8035a24ce8ccab30bf9e3b9fc37b44 Mon Sep 17 00:00:00 2001 From: jmcardon Date: Tue, 24 Sep 2024 18:40:16 -0400 Subject: [PATCH] Fix off by one error in gas payer --- src/Chainweb/Pact5/TransactionExec.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Chainweb/Pact5/TransactionExec.hs b/src/Chainweb/Pact5/TransactionExec.hs index 1b13344e1..72bf48280 100644 --- a/src/Chainweb/Pact5/TransactionExec.hs +++ b/src/Chainweb/Pact5/TransactionExec.hs @@ -726,7 +726,9 @@ enrichedMsgBodyForGasPayer cmd = case (_pPayload $ _cmdPayload cmd) of -- Drop until the start line, and take (endLine - startLine). Note: -- Span info locations are absolute, so `endLine` is not relative to start line, but -- relative to the whole file. - lineSpan = take (endLine - startLine) $ drop startLine code + -- + -- Note: we take `end - start + 1` since end is inclusive. + lineSpan = take (endLine - startLine + 1) $ drop startLine code in T.concat (over _head (T.drop startCol) . over _last (T.take endCol) $ lineSpan) Continuation cont -> PObject $ Map.fromList