From a216aba714595eb6f54851b534c29f7626413656 Mon Sep 17 00:00:00 2001 From: romanman Date: Sun, 14 Dec 2014 11:51:08 +0100 Subject: [PATCH] tiny fix --- ethereumj-core/src/main/java/org/ethereum/vm/GasCost.java | 2 ++ ethereumj-core/src/main/java/org/ethereum/vm/VM.java | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/GasCost.java b/ethereumj-core/src/main/java/org/ethereum/vm/GasCost.java index 1ada0196..44b12073 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/GasCost.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/GasCost.java @@ -14,6 +14,8 @@ public class GasCost { public static int BALANCE = 20; /** Cost 10 gas */ public static int SHA3 = 10; + /** Cost 10 gas */ + public static int SHA3_WORD = 10; /** Cost 20 gas */ public static int SLOAD = 20; /** Cost 0 gas */ diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java index 11a4a4a9..bd92314b 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java @@ -135,13 +135,9 @@ public class VM { case SHA3: gasCost = GasCost.SHA3; newMemSize = memNeeded(stack.peek(), stack.get(stack.size()-2)); - DataWord size = stack.get(stack.size()-2); long chunkUsed = (size.longValue() + 31) / 32; - gasCost += chunkUsed * GasCost.SHA3; - - //todo: calc how much bytes for sha3(): sha3 / 32 * 10 - + gasCost += chunkUsed * GasCost.SHA3_WORD; break; case CALLDATACOPY: copySize = stack.get(stack.size()-3).longValue();