Skip to content

Commit 09b6153

Browse files
committed
make gas calculation efficient
1 parent 94ac867 commit 09b6153

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hevm/src/EVM.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ executePrecompile preCompileAddr gasCap inOffset inSize outOffset outSize xs =
14461446
(lenb, lene, lenm) = parseModexpLength input'
14471447

14481448
output = ConcreteBuffer $
1449-
if (isZero 96 lenb input' && not (isZero (96 + lenb) lene input')) || isZero (96 + lenb + lene) lenm input'
1449+
if isZero (96 + lenb + lene) lenm input'
14501450
then truncpadlit (num lenm) (asBE (0 :: Int))
14511451
else
14521452
let
@@ -2756,7 +2756,7 @@ concreteModexpGasFee input = max 200 ((multiplicationComplexity * iterCount) `di
27562756
where (lenb, lene, lenm) = parseModexpLength input
27572757
ez = isZero (96 + lenb) lene input
27582758
e' = w256 $ word $ LS.toStrict $
2759-
lazySlice (96 + lenb) lene input
2759+
lazySlice (96 + lenb) (min 32 lene) input
27602760
nwords :: Integer
27612761
nwords = ceilDiv (num $ max lenb lenm) 8
27622762
multiplicationComplexity = nwords * nwords

0 commit comments

Comments
 (0)