Settle on GasCost for classname

This commit is contained in:
nicksavers 2014-06-07 16:37:20 +02:00
parent dcd69f26ea
commit eb46749f53
2 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ package org.ethereum.vm;
* computation engine; its price is set by the Transaction and miners are free to * computation engine; its price is set by the Transaction and miners are free to
* ignore Transactions whose Gas price is too low. * ignore Transactions whose Gas price is too low.
*/ */
public class Gas { public class GasCost {
public static int STEP = 1; public static int STEP = 1;
public static int STOP = 0; public static int STOP = 0;

View File

@ -34,23 +34,23 @@ public class VM {
switch (OpCode.code(op)) { switch (OpCode.code(op)) {
case SHA3: case SHA3:
program.spendGas(Gas.SHA3); program.spendGas(GasCost.SHA3);
break; break;
case SLOAD: case SLOAD:
program.spendGas(Gas.SLOAD); program.spendGas(GasCost.SLOAD);
break; break;
case SSTORE: case SSTORE:
// todo: calc gas in the execution // todo: calc gas in the execution
// todo: according to the size // todo: according to the size
break; break;
case BALANCE: case BALANCE:
program.spendGas(Gas.BALANCE); program.spendGas(GasCost.BALANCE);
break; break;
case CREATE: case CREATE:
program.spendGas(Gas.CREATE); program.spendGas(GasCost.CREATE);
break; break;
case CALL: case CALL:
program.spendGas(Gas.CALL); program.spendGas(GasCost.CALL);
break; break;
case MSTORE8: case MSTORE8:
case MSTORE: case MSTORE:
@ -58,7 +58,7 @@ public class VM {
// todo: according to the size // todo: according to the size
break; break;
default: default:
program.spendGas(Gas.STEP); program.spendGas(GasCost.STEP);
break; break;
} }
@ -472,11 +472,11 @@ public class VM {
DataWord oldValue = program.storageLoad(addr); DataWord oldValue = program.storageLoad(addr);
program.storageSave(addr, value); program.storageSave(addr, value);
if (oldValue == null && !value.isZero()){ if (oldValue == null && !value.isZero()){
program.spendGas(Gas.SSTORE * 2); program.spendGas(GasCost.SSTORE * 2);
} else if (oldValue != null && value.isZero()){ } else if (oldValue != null && value.isZero()){
program.spendGas(Gas.SSTORE * 0); program.spendGas(GasCost.SSTORE * 0);
} else } else
program.spendGas(Gas.SSTORE); program.spendGas(GasCost.SSTORE);
program.step(); program.step();
} }
@ -554,7 +554,7 @@ public class VM {
// memory gas calc // memory gas calc
int newMemSize = program.getMemSize(); int newMemSize = program.getMemSize();
program.spendGas(Gas.MEMORY * (newMemSize - oldMemSize) /32); program.spendGas(GasCost.MEMORY * (newMemSize - oldMemSize) /32);
} }
program.fullTrace(); program.fullTrace();
} catch (RuntimeException e) { } catch (RuntimeException e) {