Skeleton for VM implementation and PUSH_N logic

This commit is contained in:
romanman 2014-06-01 19:06:54 +03:00
parent 6726c8dcf9
commit 79bc9bb28a
7 changed files with 869 additions and 2 deletions

View File

@ -24,7 +24,6 @@ public class SerpentToAssemblyCompiler extends SerpentBaseVisitor<String> {
private List<String> arraysIndex = new ArrayList<String>();
@Override
public String visitParse(@NotNull SerpentParser.ParseContext ctx) {

View File

@ -89,4 +89,11 @@ public class Utils {
}
return Double.parseDouble (version.substring (0, pos - 1));
}
public static String oneByteToHexString(byte value){
String retVal = Integer.toString(value, 16);
if (retVal.length() == 1) retVal = "0" + retVal;
return retVal;
}
}

View File

@ -160,6 +160,10 @@ public enum OpCode {
return type;
}
public byte val(){
return opcode;
}
public int asInt() {
return opcode;
}
@ -172,4 +176,8 @@ public enum OpCode {
public static byte byteVal(String code){
return stringToByteMap.get(code);
}
public static OpCode code(byte op){
return intToTypeMap.get(op);
}
}

View File

@ -0,0 +1,175 @@
package org.ethereum.vm;
import com.google.api.client.util.ByteStreams;
import io.netty.buffer.UnpooledDirectByteBuf;
import org.ethereum.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.*;
/**
* www.ethereumJ.com
* User: Roman Mandeleil
* Created on: 01/06/2014 10:45
*/
public class Program {
Logger logger = LoggerFactory.getLogger("VM");
Stack<DataWord> stack = new Stack<DataWord>();
Map<DataWord, DataWord> storage = new HashMap<DataWord, DataWord>();
ByteBuffer memory = null;
byte[] ops;
int pc = 0;
public Program(byte[] ops) {
if (ops == null) throw new RuntimeException("program can not run with ops: null");
this.ops = ops;
}
public byte getCurrentOp(){
return ops[pc];
}
public void stackPush(byte[] data){
DataWord stackWord = new DataWord(data);
stack.push(stackWord);
}
public void step(){
++pc;
}
public byte[] sweep(int n){
if (pc + n > ops.length) throw new RuntimeException("pc overflow sweep n: " + n + " pc: " + pc);
byte[] data = Arrays.copyOfRange(ops, pc, pc + n);
pc += n;
return data;
}
public void stackPull(){};
public void memorySave(byte[] addrB, byte[] value){
BigInteger address = new BigInteger(1, addrB);
int memSize = 0;
if (memory != null) memSize = memory.limit();
if (memSize < address.intValue()){
int sizeToAllocate = address.intValue() + (32 - address.intValue() % 32);
ByteBuffer tmpMem = ByteBuffer.allocate(sizeToAllocate);
if (memory != null) tmpMem.put(memory);
memory = tmpMem;
}
System.arraycopy(value, 0, memory.array(), address.intValue(), value.length);
}
public void memoryLoad(){};
public void storageSave(byte[] key, byte[] val){
DataWord keyWord = new DataWord(key);
DataWord valWord = new DataWord(val);
storage.put(keyWord, valWord);
}
public void storageLoad(){}
public void fullTrace(){
if (logger.isDebugEnabled()){
StringBuilder stackData = new StringBuilder();
for (int i = 0; i < stack.size(); ++i){
stackData.append(" ").append(stack.get(i));
if (i < stack.size() - 1) stackData.append("\n");
}
if (stackData.length() > 0) stackData.insert(0, "\n");
StringBuilder storageData = new StringBuilder();
for (DataWord key : storage.keySet()){
storageData.append(" ").append(key).append(" -> ").append(storage.get(key)).append("\n");
}
if (storageData.length() > 0) storageData.insert(0, "\n");
StringBuilder memoryData = new StringBuilder();
StringBuilder oneLine = new StringBuilder();
for (int i = 0; memory != null && i < memory.limit(); ++i){
byte value = memory.get(i);
oneLine.append(Utils.oneByteToHexString(value)).append(" ");
if ((i + 1) % 16 == 0) {
String tmp = String.format(" [%4s]-[%4s]", Integer.toString(i, 16),
Integer.toString(i - 15, 16)).replace(" ", "0");
memoryData.append(tmp).append(" ");
memoryData.append(oneLine.reverse());
if (i < memory.limit()) memoryData.append("\n");
oneLine.setLength(0);
}
}
if (memoryData.length() > 0) memoryData.insert(0, "\n");
StringBuilder opsString = new StringBuilder();
for (int i = 0; i < ops.length; ++i){
String tmpString = Integer.toString(ops[i] & 0xFF, 16);
tmpString = tmpString.length() == 1? "0" + tmpString : tmpString;
if (i != pc)
opsString.append(tmpString);
else
opsString.append(" >>").append(tmpString).append( "");
}
if (pc >= ops.length) opsString.append(" >>");
if (opsString.length() > 0) opsString.insert(0, "\n ");
logger.debug(" -- OPS -- {}", opsString);
logger.debug(" -- STACK -- {}", stackData);
logger.debug(" -- MEMORY -- {}", memoryData);
logger.debug(" -- STORAGE -- {}\n", storageData);
};
}
class DataWord {
byte[] data = new byte[32];
public DataWord(byte[] data){
if (data == null || data.length > 32)
throw new RuntimeException("bad push data: " + data);
System.arraycopy(data, 0, this.data, 32 - data.length, data.length);
}
public byte[] getData() {
return data;
}
public String toString(){
return Hex.toHexString(data);
}
}
}

View File

@ -0,0 +1,209 @@
package org.ethereum.vm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.ethereum.vm.OpCode.PUSH1;
/**
* www.ethereumJ.com
* User: Roman Mandeleil
* Created on: 01/06/2014 10:44
*/
public class VM {
Logger logger = LoggerFactory.getLogger("VM");
public void step(Program program){
byte op = program.getCurrentOp();
switch (OpCode.code(op)){
/**
* Stop and Arithmetic Operations
*/
case STOP:
break;
case ADD:
break;
case MUL:
break;
case SUB:
break;
case DIV:
break;
case SDIV:
break;
case MOD:
break;
case SMOD:
break;
case EXP:
break;
case NEG:
break;
case LT:
break;
case SLT:
break;
case SGT:
break;
case GT:
break;
case EQ:
break;
case NOT:
break;
/**
* Bitwise Logic Operations
*/
case AND:
break;
case OR:
break;
case XOR:
break;
case BYTE:
break;
/**
* SHA3
*/
case SHA3:
break;
/**
* Environmental Information
*/
case ADDRESS:
break;
case BALANCE:
break;
case ORIGIN:
break;
case CALLER:
break;
case CALLVALUE:
break;
case CALLDATALOAD:
break;
case CALLDATASIZE:
break;
case CALLDATACOPY:
break;
case CODESIZE:
break;
case CODECOPY:
break;
case GASPRICE:
break;
/**
* Block Information
*/
case PREVHASH:
break;
case COINBASE:
break;
case TIMESTAMP:
break;
case NUMBER:
break;
case DIFFICULTY:
break;
case GASLIMIT:
break;
case POP:
break;
case DUP:
break;
case SWAP:
break;
case MLOAD:
break;
case MSTORE:
break;
case MSTORE8:
break;
case SLOAD:
break;
case SSTORE:
break;
case JUMP:
break;
case JUMPI:
break;
case PC:
break;
case MEMSIZE:
break;
case GAS:
break;
case PUSH1:
case PUSH2:
case PUSH3:
case PUSH4:
case PUSH5:
case PUSH6:
case PUSH7:
case PUSH8:
case PUSH9:
case PUSH10:
case PUSH11:
case PUSH12:
case PUSH13:
case PUSH14:
case PUSH15:
case PUSH16:
case PUSH17:
case PUSH18:
case PUSH19:
case PUSH20:
case PUSH21:
case PUSH22:
case PUSH23:
case PUSH24:
case PUSH25:
case PUSH26:
case PUSH27:
case PUSH28:
case PUSH29:
case PUSH30:
case PUSH31:
case PUSH32:
logger.debug("Op: {}" ,OpCode.code(op).name());
program.step();
int nPush = op - PUSH1.val() + 1;
byte[] data = program.sweep(nPush);
program.stackPush(data);
program.fullTrace();
break;
default:
}
}
}

View File

@ -11,3 +11,4 @@ log4j.appender.stdout.layout.ConversionPattern= %d{HH:mm:ss} [%c{1}] %m%n
log4j.logger.org.ethereum.net.peerdiscovery = WARN
log4j.logger.java.nio = WARN
log4j.logger.io.netty = WARN
log4j.logger.org.ethereum.vm = DEBUG

View File

@ -0,0 +1,468 @@
package org.ethereum.vm;
import org.junit.Assert;
import org.junit.Test;
import org.spongycastle.util.encoders.Hex;
import static org.junit.Assert.fail;
/**
* www.ethereumJ.com
* User: Roman Mandeleil
* Created on: 01/06/2014 11:05
*/
public class VMTest {
@Test // PUSH1 OP
public void testPUSH1(){
VM vm = new VM();
Program program = new Program(Hex.decode("60A0"));
String expected = "00000000000000000000000000000000000000000000000000000000000000A0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH2 OP
public void testPUSH2(){
VM vm = new VM();
Program program = new Program(Hex.decode("61A0B0"));
String expected = "000000000000000000000000000000000000000000000000000000000000A0B0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH3 OP
public void testPUSH3(){
VM vm = new VM();
Program program = new Program(Hex.decode("62A0B0C0"));
String expected = "0000000000000000000000000000000000000000000000000000000000A0B0C0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH4 OP
public void testPUSH4(){
VM vm = new VM();
Program program = new Program(Hex.decode("63A0B0C0D0"));
String expected = "00000000000000000000000000000000000000000000000000000000A0B0C0D0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH5 OP
public void testPUSH5(){
VM vm = new VM();
Program program = new Program(Hex.decode("64A0B0C0D0E0"));
String expected = "000000000000000000000000000000000000000000000000000000A0B0C0D0E0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH6 OP
public void testPUSH6(){
VM vm = new VM();
Program program = new Program(Hex.decode("65A0B0C0D0E0F0"));
String expected = "0000000000000000000000000000000000000000000000000000A0B0C0D0E0F0";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH7 OP
public void testPUSH7(){
VM vm = new VM();
Program program = new Program(Hex.decode("66A0B0C0D0E0F0A1"));
String expected = "00000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH8 OP
public void testPUSH8(){
VM vm = new VM();
Program program = new Program(Hex.decode("67A0B0C0D0E0F0A1B1"));
String expected = "000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH9 OP
public void testPUSH9(){
VM vm = new VM();
Program program = new Program(Hex.decode("68A0B0C0D0E0F0A1B1C1"));
String expected = "0000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH10 OP
public void testPUSH10(){
VM vm = new VM();
Program program = new Program(Hex.decode("69A0B0C0D0E0F0A1B1C1D1"));
String expected = "00000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH11 OP
public void testPUSH11(){
VM vm = new VM();
Program program = new Program(Hex.decode("6AA0B0C0D0E0F0A1B1C1D1E1"));
String expected = "000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH12 OP
public void testPUSH12(){
VM vm = new VM();
Program program = new Program(Hex.decode("6BA0B0C0D0E0F0A1B1C1D1E1F1"));
String expected = "0000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH13 OP
public void testPUSH13(){
VM vm = new VM();
Program program = new Program(Hex.decode("6CA0B0C0D0E0F0A1B1C1D1E1F1A2"));
String expected = "00000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH14 OP
public void testPUSH14(){
VM vm = new VM();
Program program = new Program(Hex.decode("6DA0B0C0D0E0F0A1B1C1D1E1F1A2B2"));
String expected = "000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH15 OP
public void testPUSH15(){
VM vm = new VM();
Program program = new Program(Hex.decode("6EA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2"));
String expected = "0000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH16 OP
public void testPUSH16(){
VM vm = new VM();
Program program = new Program(Hex.decode("6FA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2"));
String expected = "00000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH17 OP
public void testPUSH17(){
VM vm = new VM();
Program program = new Program(Hex.decode("70A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2"));
String expected = "000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH18 OP
public void testPUSH18(){
VM vm = new VM();
Program program = new Program(Hex.decode("71A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2"));
String expected = "0000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH19 OP
public void testPUSH19(){
VM vm = new VM();
Program program = new Program(Hex.decode("72A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3"));
String expected = "00000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH20 OP
public void testPUSH20(){
VM vm = new VM();
Program program = new Program(Hex.decode("73A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3"));
String expected = "000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH21 OP
public void testPUSH21(){
VM vm = new VM();
Program program = new Program(Hex.decode("74A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3"));
String expected = "0000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH22 OP
public void testPUSH22(){
VM vm = new VM();
Program program = new Program(Hex.decode("75A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3"));
String expected = "00000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH23 OP
public void testPUSH23(){
VM vm = new VM();
Program program = new Program(Hex.decode("76A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3"));
String expected = "000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH24 OP
public void testPUSH24(){
VM vm = new VM();
Program program = new Program(Hex.decode("77A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3"));
String expected = "0000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH25 OP
public void testPUSH25(){
VM vm = new VM();
Program program = new Program(Hex.decode("78A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4"));
String expected = "00000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH26 OP
public void testPUSH26(){
VM vm = new VM();
Program program = new Program(Hex.decode("79A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4"));
String expected = "000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH27 OP
public void testPUSH27(){
VM vm = new VM();
Program program = new Program(Hex.decode("7AA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4"));
String expected = "0000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH28 OP
public void testPUSH28(){
VM vm = new VM();
Program program = new Program(Hex.decode("7BA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4"));
String expected = "00000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH29 OP
public void testPUSH29(){
VM vm = new VM();
Program program = new Program(Hex.decode("7CA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4"));
String expected = "000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH30 OP
public void testPUSH30(){
VM vm = new VM();
Program program = new Program(Hex.decode("7DA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4"));
String expected = "0000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH31 OP
public void testPUSH31(){
VM vm = new VM();
Program program = new Program(Hex.decode("7EA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1"));
String expected = "00A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSH32 OP
public void testPUSH32(){
VM vm = new VM();
Program program = new Program(Hex.decode("7FA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"));
String expected = "A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1";
program.fullTrace();
vm.step(program);
Assert.assertEquals(expected, Hex.toHexString(program.stack.get(0).data).toUpperCase() );
}
@Test // PUSHN OP mal data
public void testPUSHN_1(){
try {
VM vm = new VM();
Program program = new Program(Hex.decode("61AA"));
String expected = "A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1";
program.fullTrace();
vm.step(program);
} catch (RuntimeException e) {
return;
}
fail();
}
@Test // PUSHN OP mal data
public void testPUSHN_2(){
try {
VM vm = new VM();
Program program = new Program(Hex.decode("7fAABB"));
String expected = "A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1";
program.fullTrace();
vm.step(program);
} catch (RuntimeException e) {
return;
}
fail();
}
}