Skip to content

Commit

Permalink
make gas calculation efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
MrChico committed Apr 29, 2021
1 parent 94ac867 commit 09b6153
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hevm/src/EVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ executePrecompile preCompileAddr gasCap inOffset inSize outOffset outSize xs =
(lenb, lene, lenm) = parseModexpLength input'

output = ConcreteBuffer $
if (isZero 96 lenb input' && not (isZero (96 + lenb) lene input')) || isZero (96 + lenb + lene) lenm input'
if isZero (96 + lenb + lene) lenm input'
then truncpadlit (num lenm) (asBE (0 :: Int))
else
let
Expand Down Expand Up @@ -2756,7 +2756,7 @@ concreteModexpGasFee input = max 200 ((multiplicationComplexity * iterCount) `di
where (lenb, lene, lenm) = parseModexpLength input
ez = isZero (96 + lenb) lene input
e' = w256 $ word $ LS.toStrict $
lazySlice (96 + lenb) lene input
lazySlice (96 + lenb) (min 32 lene) input
nwords :: Integer
nwords = ceilDiv (num $ max lenb lenm) 8
multiplicationComplexity = nwords * nwords
Expand Down

0 comments on commit 09b6153

Please sign in to comment.