minor fixes

This commit is contained in:
romanman 2014-06-21 14:42:12 +01:00
parent 409d22a0a3
commit 1232311ab1
2 changed files with 8 additions and 4 deletions

View File

@ -80,8 +80,8 @@ public class VM {
program.spendGas(GasCost.CALL, OpCode.code(op).name()); program.spendGas(GasCost.CALL, OpCode.code(op).name());
break; break;
case SSTORE: case STOP: case SSTORE: case STOP:
// The ops that doesn't charged by step, or charge // The ops that doesn't charged by step, or
// in the following section // charged in the following section
break; break;
default: default:
program.spendGas(GasCost.STEP, OpCode.code(op).name()); program.spendGas(GasCost.STEP, OpCode.code(op).name());
@ -119,7 +119,6 @@ public class VM {
program.step(); program.step();
} break; } break;
case DIV:{ case DIV:{
DataWord word1 = program.stackPop(); DataWord word1 = program.stackPop();
DataWord word2 = program.stackPop(); DataWord word2 = program.stackPop();
word1.div(word2); word1.div(word2);
@ -127,7 +126,6 @@ public class VM {
program.step(); program.step();
} break; } break;
case SDIV:{ case SDIV:{
DataWord word1 = program.stackPop(); DataWord word1 = program.stackPop();
DataWord word2 = program.stackPop(); DataWord word2 = program.stackPop();
word1.sDiv(word2); word1.sDiv(word2);

View File

@ -12,6 +12,8 @@ import org.spongycastle.util.encoders.Hex;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.HashMap; import java.util.HashMap;
import static org.junit.Assert.assertEquals;
/** /**
* www.ethereumJ.com * www.ethereumJ.com
* *
@ -39,6 +41,8 @@ public class VMComplexTest {
stop stop
*/ */
int expectedGas = 438;
DataWord key1 = new DataWord(999); DataWord key1 = new DataWord(999);
DataWord value1 = new DataWord(3); DataWord value1 = new DataWord(3);
@ -91,6 +95,7 @@ public class VMComplexTest {
} }
System.out.println();
System.out.println("============ Results ============"); System.out.println("============ Results ============");
AccountState as = AccountState as =
new AccountState(WorldManager.instance.worldState.get( new AccountState(WorldManager.instance.worldState.get(
@ -100,6 +105,7 @@ public class VMComplexTest {
System.out.println("*** Contract Balance: " + as.getBalance()); System.out.println("*** Contract Balance: " + as.getBalance());
assertEquals(expectedGas, program.result.getGasUsed());