Merge pull request #169 from negedzuregal/vm_tests

Vm tests
This commit is contained in:
skype me: roman.mandeleil 2014-12-03 11:21:47 +01:00
commit 492f31ba4c
30 changed files with 564 additions and 13412 deletions

View File

@ -46,6 +46,9 @@ public class SystemProperties {
private static Boolean DEFAULT_VM_TRACE = false;
private static String DEFAULT_VM_TRACE_DIR = "dmp";
private static int DEFAULT_PEER_LISTEN_PORT = 30303;
/* Testing */
private static Boolean DEFAULT_VMTEST_LOAD_LOCAL = false;
private static List<String> DEFAULT_PROTOCOL_LIST = Arrays.asList("eth", "shh");
@ -279,6 +282,16 @@ public class SystemProperties {
}
}
/*
*
* Testing
*
*/
public boolean vmTestLoadLocal() {
if (prop.isEmpty() || !prop.containsKey("GitHubTests.VMTest.loadLocal")) return DEFAULT_VMTEST_LOAD_LOCAL;
return Boolean.parseBoolean(prop.getProperty("GitHubTests.VMTest.loadLocal"));
}
public static void main(String args[]) {
SystemProperties systemProperties = new SystemProperties();
systemProperties.print();

View File

@ -1,7 +1,10 @@
package org.ethereum.core;
import org.ethereum.util.ByteUtil;
import org.spongycastle.util.encoders.Hex;
import java.nio.ByteBuffer;
/**
* www.etherj.com
*
@ -19,55 +22,31 @@ public class Bloom {
public Bloom(byte[] data){
}
public static Bloom create(byte[] toBloom){
int mov1 = (toBloom[0] & 1) * 256 + (toBloom[1] & 255);
int mov2 = (toBloom[2] & 1) * 256 + (toBloom[3] & 255);
int mov3 = (toBloom[4] & 1) * 256 + (toBloom[5] & 255);
public static Bloom create(byte[] toBloom) {
int mov1 = ((255 & toBloom[0 + 1]) + 256 * ((255 & toBloom[0]) & 1));
int mov2 = ((255 & toBloom[2 + 1]) + 256 * ((255 & toBloom[2]) & 1));
int mov3 = ((255 & toBloom[4 + 1]) + 256 * ((255 & toBloom[4]) & 1));
byte[] data = new byte[64];
Bloom bloom = new Bloom(data);
bloom.setBit(mov1, 1);
bloom.setBit(mov2, 1);
bloom.setBit(mov3, 1);
ByteUtil.setBit(data, mov1, 1);
ByteUtil.setBit(data, mov2, 1);
ByteUtil.setBit(data, mov3, 1);
return bloom;
}
public void or(Bloom bloom){
for (int i = 0; i < data.length; ++i){
data[i] |= bloom.data[i];
}
}
public void setBit(int pos, int val) {
if (data.length * 8 < pos )
throw new Error("outside bloom limit, pos: " + pos);
int posByte = (pos - 1) / 8;
int posBit = (pos - 1) % 8;
byte oldByte = data[posByte];
oldByte = (byte) (((0xFF7F >> (( posBit + 1)) & oldByte) & 0x00FF));
byte newByte = (byte) ((val << ( 8 - ( posBit + 1))) | oldByte);
data[posByte] = newByte;
public byte[] getData() {
return data;
}
public int getBit(int pos) {
if (data.length - 1 < pos )
throw new Error("outside bloom limit, pos: " + pos);
int posByte = pos / 8;
int posBit = pos % 8;
byte valByte = data[posByte];
int valInt = valByte >> (8 - (posBit + 1)) & 0x0001;
return valInt;
}
@Override
public String toString() {
return Hex.toHexString(data);

View File

@ -3,27 +3,35 @@ package org.ethereum.jsontestsuite;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import org.ethereum.config.SystemProperties;
public class JSONReader {
public static String loadJSON(String filename) {
// return getFromLocal(filename);
String json = getFromUrl("https://raw.githubusercontent.com/ethereum/tests/develop/" + filename);
String json = "";
if(!SystemProperties.CONFIG.vmTestLoadLocal())
json = getFromUrl("https://raw.githubusercontent.com/ethereum/tests/develop/" + filename);
return json == "" ? json = getFromLocal(filename) : json;
}
public static String getFromLocal(String filename) {
System.out.println("Loading local file: " + filename);
try {
URL vmtest = ClassLoader.getSystemResource("jsontestsuite/" + filename);
File vmTestFile = new File(vmtest.toURI());
if(System.getProperty("ETHEREUM_TEST_PATH") == null) {
System.out.println("ETHEREUM_TEST_PATH is not passed as a VM argument, please make sure you pass it with the correct path");
return "";
}
System.out.println("From: " + System.getProperty("ETHEREUM_TEST_PATH"));
File vmTestFile = new File(System.getProperty("ETHEREUM_TEST_PATH") + filename);
return new String(Files.readAllBytes(vmTestFile.toPath()));
} catch (URISyntaxException | IOException e) {
} catch (IOException e) {
e.printStackTrace();
}
return "";
@ -39,8 +47,11 @@ public class JSONReader {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(3000);
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
conn.setDoOutput(true);
conn.connect();
InputStream in = conn.getInputStream();
rd = new BufferedReader(new InputStreamReader(in));
System.out.println("Loading remote file: " + urlToRead);
while ((line = rd.readLine()) != null) {
result += line;
}

View File

@ -0,0 +1,55 @@
package org.ethereum.jsontestsuite;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.ethereum.vm.LogInfo;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.spongycastle.util.encoders.Hex;
public class Logs {
Map<byte[], LogInfo> logs;
public Logs(JSONObject jLogs) {
logs = new HashMap<byte[], LogInfo>();
Set keys = jLogs.keySet();
for(Object k: keys.toArray()) {
byte[] key = Hex.decode((String)k);
JSONObject values = (JSONObject)jLogs.get(k);
byte[] address = Hex.decode((String)values.get("address"));
byte[] data = Hex.decode(((String)values.get("data")).substring(2));
List<byte[]> topics = new ArrayList<byte[]>();
JSONArray jTopics = (JSONArray)values.get("topics");
for(Object t: jTopics.toArray()) {
byte[] topic = Hex.decode(((String)t));
topics.add(topic);
}
LogInfo li = new LogInfo(address, topics, data);
logs.put(key, li);
}
}
/**
* returns null if {@link org.ethereum.vm.LogInfo LogInfo} object was not found for the given key
* @param k
* @return
*/
public LogInfo getLogBloom(byte[] k) {
if(logs.containsKey(k))
return logs.get(k);
return null;
}
public Iterator<byte[]> getLogsRLPSHA3KeyIterator() {
return logs.keySet().iterator();
}
}

View File

@ -23,6 +23,9 @@ public class TestCase {
// "env": { ... },
private Env env;
//
private Logs logs;
// "exec": { ... },
private Exec exec;
@ -55,13 +58,26 @@ public class TestCase {
JSONObject envJSON = (JSONObject)testCaseJSONObj.get("env");
JSONObject execJSON = (JSONObject)testCaseJSONObj.get("exec");
JSONObject preJSON = (JSONObject)testCaseJSONObj.get("pre");
JSONObject postJSON = (JSONObject)testCaseJSONObj.get("post");
JSONArray callCreates = (JSONArray)testCaseJSONObj.get("callcreates");
JSONObject postJSON = new JSONObject();
if(testCaseJSONObj.containsKey("post")) // in cases where there is no post dictionary (when testing for exceptions for example)
postJSON = (JSONObject)testCaseJSONObj.get("post");
JSONArray callCreates = new JSONArray();
if(testCaseJSONObj.containsKey("callcreates"))
callCreates = (JSONArray)testCaseJSONObj.get("callcreates");
JSONObject logsJSON = new JSONObject();
if(testCaseJSONObj.containsKey("logs"))
logsJSON = (JSONObject)testCaseJSONObj.get("logs");
logs = new Logs(logsJSON);
String gasString = testCaseJSONObj.get("gas").toString();
String gasString = "0";
if(testCaseJSONObj.containsKey("gas"))
gasString = testCaseJSONObj.get("gas").toString();
this.gas = ByteUtil.bigIntegerToBytes(new BigInteger(gasString));
String outString = testCaseJSONObj.get("out").toString();
String outString = null;
if(testCaseJSONObj.containsKey("out"))
outString = testCaseJSONObj.get("out").toString();
if (outString != null && outString.length() > 2)
this.out = Hex.decode(outString.substring(2));
else
@ -106,6 +122,10 @@ public class TestCase {
public Exec getExec() {
return exec;
}
public Logs getLogs() {
return logs;
}
public byte[] getGas() {
return gas;

View File

@ -1,5 +1,6 @@
package org.ethereum.jsontestsuite;
import org.ethereum.crypto.HashUtil;
import org.ethereum.db.ByteArrayWrapper;
import org.ethereum.db.ContractDetails;
import org.ethereum.db.RepositoryImpl;
@ -69,6 +70,7 @@ public class TestRunner {
/* 2. Create ProgramInvoke - Env/Exec */
Env env = testCase.getEnv();
Exec exec = testCase.getExec();
Logs logs = testCase.getLogs();
byte[] address = exec.getAddress();
byte[] origin = exec.getOrigin();
@ -99,217 +101,274 @@ public class TestRunner {
/* 4. run VM */
VM vm = new VM();
Program program = new Program(exec.getCode(), programInvoke);
vm.play(program);
boolean vmDidThrowAnEception = false;
RuntimeException e = null;
try {
while(!program.isStopped())
vm.step(program);
}
catch (RuntimeException ex) {
vmDidThrowAnEception = true;
e = ex;
}
program.saveProgramTraceToFile(testCase.getName());
if(testCase.getPost().size() == 0) {
if(vmDidThrowAnEception != true) {
String output =
String.format("VM was expected to throw an exception");
logger.info(output);
results.add(output);
}
else
logger.info("VM did throw an exception: " + e.toString());
}
else {
if(vmDidThrowAnEception) {
String output =
String.format("VM threw an unexpected exception: " + e.toString());
logger.info(output);
results.add(output);
return results;
}
this.trace = program.getProgramTrace();
System.out.println("--------- POST --------");
/* 5. Assert Post values */
for (ByteArrayWrapper key : testCase.getPost().keySet()) {
AccountState accountState = testCase.getPost().get(key);
long expectedNonce = accountState.getNonceLong();
BigInteger expectedBalance = accountState.getBigIntegerBalance();
byte[] expectedCode = accountState.getCode();
boolean accountExist = (null != repository.getAccountState(key.getData()));
if (!accountExist) {
String output =
String.format("The expected account does not exist. key: [ %s ]",
Hex.toHexString(key.getData()));
logger.info(output);
results.add(output);
continue;
}
long actualNonce = repository.getNonce(key.getData()).longValue();
BigInteger actualBalance = repository.getBalance(key.getData());
byte[] actualCode = repository.getCode(key.getData());
if (actualCode == null) actualCode = "".getBytes();
if (expectedNonce != actualNonce) {
String output =
String.format("The nonce result is different. key: [ %s ], expectedNonce: [ %d ] is actualNonce: [ %d ] ",
Hex.toHexString(key.getData()), expectedNonce, actualNonce);
logger.info(output);
results.add(output);
}
if (!expectedBalance.equals(actualBalance)) {
String output =
String.format("The balance result is different. key: [ %s ], expectedBalance: [ %s ] is actualBalance: [ %s ] ",
Hex.toHexString(key.getData()), expectedBalance.toString(), actualBalance.toString());
logger.info(output);
results.add(output);
}
if (!Arrays.equals(expectedCode, actualCode)) {
String output =
String.format("The code result is different. account: [ %s ], expectedCode: [ %s ] is actualCode: [ %s ] ",
Hex.toHexString(key.getData()),
Hex.toHexString(expectedCode),
Hex.toHexString(actualCode));
logger.info(output);
results.add(output);
}
// assert storage
Map<ByteArrayWrapper, ByteArrayWrapper> storage = accountState.getStorage();
for (ByteArrayWrapper storageKey : storage.keySet()) {
byte[] expectedStValue = storage.get(storageKey).getData();
ContractDetails contractDetails =
program.getResult().getRepository().getContractDetails(accountState.getAddress());
if (contractDetails == null) {
String output =
String.format("Storage raw doesn't exist: key [ %s ], expectedValue: [ %s ]",
Hex.toHexString(storageKey.getData()),
Hex.toHexString(expectedStValue)
);
logger.info(output);
results.add(output);
continue;
}
Map<DataWord, DataWord> testStorage = contractDetails.getStorage();
DataWord actualValue = testStorage.get(new DataWord(storageKey.getData()));
this.trace = program.getProgramTrace();
System.out.println("--------- POST --------");
/* 5. Assert Post values */
for (ByteArrayWrapper key : testCase.getPost().keySet()) {
AccountState accountState = testCase.getPost().get(key);
long expectedNonce = accountState.getNonceLong();
BigInteger expectedBalance = accountState.getBigIntegerBalance();
byte[] expectedCode = accountState.getCode();
boolean accountExist = (null != repository.getAccountState(key.getData()));
if (!accountExist) {
String output =
String.format("The expected account does not exist. key: [ %s ]",
Hex.toHexString(key.getData()));
logger.info(output);
results.add(output);
continue;
}
long actualNonce = repository.getNonce(key.getData()).longValue();
BigInteger actualBalance = repository.getBalance(key.getData());
byte[] actualCode = repository.getCode(key.getData());
if (actualCode == null) actualCode = "".getBytes();
if (expectedNonce != actualNonce) {
String output =
String.format("The nonce result is different. key: [ %s ], expectedNonce: [ %d ] is actualNonce: [ %d ] ",
Hex.toHexString(key.getData()), expectedNonce, actualNonce);
logger.info(output);
results.add(output);
}
if (!expectedBalance.equals(actualBalance)) {
String output =
String.format("The balance result is different. key: [ %s ], expectedBalance: [ %s ] is actualBalance: [ %s ] ",
Hex.toHexString(key.getData()), expectedBalance.toString(), actualBalance.toString());
logger.info(output);
results.add(output);
}
if (!Arrays.equals(expectedCode, actualCode)) {
String output =
String.format("The code result is different. account: [ %s ], expectedCode: [ %s ] is actualCode: [ %s ] ",
Hex.toHexString(key.getData()),
Hex.toHexString(expectedCode),
Hex.toHexString(actualCode));
logger.info(output);
results.add(output);
}
// assert storage
Map<ByteArrayWrapper, ByteArrayWrapper> storage = accountState.getStorage();
for (ByteArrayWrapper storageKey : storage.keySet()) {
byte[] expectedStValue = storage.get(storageKey).getData();
ContractDetails contractDetails =
program.getResult().getRepository().getContractDetails(accountState.getAddress());
if (contractDetails == null) {
String output =
String.format("Storage raw doesn't exist: key [ %s ], expectedValue: [ %s ]",
Hex.toHexString(storageKey.getData()),
Hex.toHexString(expectedStValue)
);
logger.info(output);
results.add(output);
continue;
}
Map<DataWord, DataWord> testStorage = contractDetails.getStorage();
DataWord actualValue = testStorage.get(new DataWord(storageKey.getData()));
if (actualValue == null ||
!Arrays.equals(expectedStValue, actualValue.getNoLeadZeroesData())) {
String output =
String.format("Storage value different: key [ %s ], expectedValue: [ %s ], actualValue: [ %s ]",
Hex.toHexString(storageKey.getData()),
Hex.toHexString(expectedStValue),
actualValue == null ? "" : Hex.toHexString(actualValue.getNoLeadZeroesData()));
logger.info(output);
results.add(output);
}
}
}
// TODO: assert that you have no extra accounts in the repository
// TODO: -> basically the deleted by suicide should be deleted
// TODO: -> and no unexpected created
List<org.ethereum.vm.CallCreate> resultCallCreates =
program.getResult().getCallCreateList();
// assert call creates
for (int i = 0; i < testCase.getCallCreateList().size(); ++i) {
org.ethereum.vm.CallCreate resultCallCreate = null;
if (resultCallCreates != null && resultCallCreates.size() > i) {
resultCallCreate = resultCallCreates.get(i);
}
CallCreate expectedCallCreate = testCase.getCallCreateList().get(i);
if (resultCallCreate == null && expectedCallCreate != null) {
String output =
String.format("Missing call/create invoke: to: [ %s ], data: [ %s ], gas: [ %s ], value: [ %s ]",
Hex.toHexString(expectedCallCreate.getDestination()),
Hex.toHexString(expectedCallCreate.getData()),
Hex.toHexString(expectedCallCreate.getGasLimit()),
Hex.toHexString(expectedCallCreate.getValue()));
logger.info(output);
results.add(output);
continue;
}
boolean assertDestination = Arrays.equals(
expectedCallCreate.getDestination(),
resultCallCreate.getDestination());
if (!assertDestination) {
String output =
String.format("Call/Create destination is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getDestination()),
Hex.toHexString(resultCallCreate.getDestination()));
logger.info(output);
results.add(output);
}
boolean assertData = Arrays.equals(
expectedCallCreate.getData(),
resultCallCreate.getData());
if (!assertData) {
String output =
String.format("Call/Create data is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getData()),
Hex.toHexString(resultCallCreate.getData()));
logger.info(output);
results.add(output);
}
boolean assertGasLimit = Arrays.equals(
expectedCallCreate.getGasLimit(),
resultCallCreate.getGasLimit());
if (!assertGasLimit) {
String output =
String.format("Call/Create gasLimit is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getGasLimit()),
Hex.toHexString(resultCallCreate.getGasLimit()));
logger.info(output);
results.add(output);
}
boolean assertValue = Arrays.equals(
expectedCallCreate.getValue(),
resultCallCreate.getValue());
if (!assertValue) {
String output =
String.format("Call/Create value is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getValue()),
Hex.toHexString(resultCallCreate.getValue()));
logger.info(output);
results.add(output);
}
}
// assert out
byte[] expectedHReturn = testCase.getOut();
byte[] actualHReturn = ByteUtil.EMPTY_BYTE_ARRAY;
if (program.getResult().getHReturn() != null) {
actualHReturn = program.getResult().getHReturn().array();
}
if (!Arrays.equals(expectedHReturn, actualHReturn)) {
String output =
String.format("HReturn is different. Expected hReturn: [ %s ], actual hReturn: [ %s ]",
Hex.toHexString(expectedHReturn),
Hex.toHexString(actualHReturn));
logger.info(output);
results.add(output);
}
// assert gas
BigInteger expectedGas = new BigInteger(testCase.getGas());
BigInteger actualGas = new BigInteger(gas).subtract(BigInteger.valueOf(program.getResult().getGasUsed()));
if (!expectedGas.equals(actualGas)) {
String output =
String.format("Gas remaining is different. Expected gas remaining: [ %s ], actual gas remaining: [ %s ]",
expectedGas.toString() ,
actualGas.toString());
logger.info(output);
results.add(output);
}
if (actualValue == null ||
!Arrays.equals(expectedStValue, actualValue.getNoLeadZeroesData())) {
String output =
String.format("Storage value different: key [ %s ], expectedValue: [ %s ], actualValue: [ %s ]",
Hex.toHexString(storageKey.getData()),
Hex.toHexString(expectedStValue),
actualValue == null ? "" : Hex.toHexString(actualValue.getNoLeadZeroesData()));
logger.info(output);
results.add(output);
}
}
/* asset logs */
List<LogInfo> logResult = program.getResult().getLogInfoList();
Iterator<byte[]> itr = logs.getLogsRLPSHA3KeyIterator();
while(itr.hasNext()) {
byte[] expectedLogKey = itr.next();
System.out.println("Expected key " + Hex.toHexString(expectedLogKey));
LogInfo expectedLogInfo = logs.getLogBloom(expectedLogKey);
boolean found = false;
for(LogInfo resultLogInfo:logResult) {
byte[] resultKey = resultLogInfo.getBloom().getData();
System.out.println("returned key " + Hex.toHexString(resultKey));
if(Arrays.equals(expectedLogKey, resultKey)) {
found = true;
}
}
if(!found) {
String output =
String.format("Expected log [ %s ]", expectedLogInfo.toString());
logger.info(output);
results.add(output);
}
}
}
// TODO: assert that you have no extra accounts in the repository
// TODO: -> basically the deleted by suicide should be deleted
// TODO: -> and no unexpected created
List<org.ethereum.vm.CallCreate> resultCallCreates =
program.getResult().getCallCreateList();
// assert call creates
for (int i = 0; i < testCase.getCallCreateList().size(); ++i) {
org.ethereum.vm.CallCreate resultCallCreate = null;
if (resultCallCreates != null && resultCallCreates.size() > i) {
resultCallCreate = resultCallCreates.get(i);
}
CallCreate expectedCallCreate = testCase.getCallCreateList().get(i);
if (resultCallCreate == null && expectedCallCreate != null) {
String output =
String.format("Missing call/create invoke: to: [ %s ], data: [ %s ], gas: [ %s ], value: [ %s ]",
Hex.toHexString(expectedCallCreate.getDestination()),
Hex.toHexString(expectedCallCreate.getData()),
Hex.toHexString(expectedCallCreate.getGasLimit()),
Hex.toHexString(expectedCallCreate.getValue()));
logger.info(output);
results.add(output);
continue;
}
boolean assertDestination = Arrays.equals(
expectedCallCreate.getDestination(),
resultCallCreate.getDestination());
if (!assertDestination) {
String output =
String.format("Call/Create destination is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getDestination()),
Hex.toHexString(resultCallCreate.getDestination()));
logger.info(output);
results.add(output);
}
boolean assertData = Arrays.equals(
expectedCallCreate.getData(),
resultCallCreate.getData());
if (!assertData) {
String output =
String.format("Call/Create data is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getData()),
Hex.toHexString(resultCallCreate.getData()));
logger.info(output);
results.add(output);
}
boolean assertGasLimit = Arrays.equals(
expectedCallCreate.getGasLimit(),
resultCallCreate.getGasLimit());
if (!assertGasLimit) {
String output =
String.format("Call/Create gasLimit is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getGasLimit()),
Hex.toHexString(resultCallCreate.getGasLimit()));
logger.info(output);
results.add(output);
}
boolean assertValue = Arrays.equals(
expectedCallCreate.getValue(),
resultCallCreate.getValue());
if (!assertValue) {
String output =
String.format("Call/Create value is different. Expected: [ %s ], result: [ %s ]",
Hex.toHexString(expectedCallCreate.getValue()),
Hex.toHexString(resultCallCreate.getValue()));
logger.info(output);
results.add(output);
}
}
// assert out
byte[] expectedHReturn = testCase.getOut();
byte[] actualHReturn = ByteUtil.EMPTY_BYTE_ARRAY;
if (program.getResult().getHReturn() != null) {
actualHReturn = program.getResult().getHReturn().array();
}
if (!Arrays.equals(expectedHReturn, actualHReturn)) {
String output =
String.format("HReturn is different. Expected hReturn: [ %s ], actual hReturn: [ %s ]",
Hex.toHexString(expectedHReturn),
Hex.toHexString(actualHReturn));
logger.info(output);
results.add(output);
}
// assert gas
BigInteger expectedGas = new BigInteger(testCase.getGas());
BigInteger actualGas = new BigInteger(gas).subtract(BigInteger.valueOf(program.getResult().getGasUsed()));
if (!expectedGas.equals(actualGas)) {
String output =
String.format("Gas remaining is different. Expected gas remaining: [ %s ], actual gas remaining: [ %s ]",
expectedGas.toString() ,
actualGas.toString());
logger.info(output);
results.add(output);
}
/*
* end of if(testCase.getPost().size() == 0)
*/
}
return results;
} finally {
repository.close();

View File

@ -21,6 +21,7 @@ public class TestSuite {
for (Object key: testCaseJSONObj.keySet()){
Object testCaseJSON = testCaseJSONObj.get(key);
TestCase testCase = new TestCase(key.toString(), (JSONObject) testCaseJSON);
testList.add(testCase);

View File

@ -305,4 +305,34 @@ public class ByteUtil {
public static ByteArrayWrapper wrap(byte[] data){
return new ByteArrayWrapper(data);
}
public static byte[] setBit(byte[] data, int pos, int val) {
if ( (data.length * 8) - 1 < pos )
throw new Error("outside byte array limit, pos: " + pos);
int posByte = (pos) / 8;
int posBit = (pos) % 8;
byte setter = (byte)(1 << (7 - posBit));
byte toBeSet = data[posByte];
byte result;
if(val == 1)
result = (byte)(toBeSet | setter);
else
result = (byte)(toBeSet & ~setter);
data[posByte] = result;
return data;
}
public static int getBit(byte[] data, int pos) {
if ((data.length * 8) - 1 < pos )
throw new Error("outside byte array limit, pos: " + pos);
int posByte = pos / 8;
int posBit = pos % 8;
byte dataByte = data[posByte];
return Math.min(1, (dataByte & (1 << (7 - posBit))));
}
}

View File

@ -78,6 +78,8 @@ public class DataWord implements Comparable<DataWord> {
*/
public int intValue() {
BigDecimal tmpValue = new BigDecimal(this.value());
if(this.bytesOccupied() > 4)
return Integer.MAX_VALUE;
return tmpValue.intValueExact();
}

View File

@ -1,9 +1,12 @@
package org.ethereum.vm;
import org.ethereum.core.BlockHeader;
import org.ethereum.core.Bloom;
import org.ethereum.crypto.HashUtil;
import org.ethereum.util.RLP;
import org.spongycastle.util.encoders.Hex;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -62,6 +65,15 @@ public class LogInfo {
return RLP.encodeList(addressEncoded, RLP.encodeList(topicsEncoded), dataEncoded);
}
public Bloom getBloom() {
Bloom ret = Bloom.create(HashUtil.sha3(address));
for(byte[] topic:topics) {
ret.or(Bloom.create(HashUtil.sha3(topic)));
}
return ret;
}
@Override
public String toString() {

View File

@ -60,10 +60,10 @@ public enum OpCode {
OR(0x17, 2),
/** (0x18) Bitwise XOR operation */
XOR(0x18, 2),
/** (0x19) Retrieve single byte from word */
BYTE(0x19, 2),
/** (0x1a) Bitwise NOT operationr */
NOT(0x1a, 1),
NOT(0x19, 1),
/** (0x19) Retrieve single byte from word */
BYTE(0x1a, 2),
/* Cryptographic Operations */

View File

@ -47,6 +47,7 @@ public class Program {
byte[] ops;
int pc = 0;
byte lastOp = 0;
byte previouslyExecutedOp = 0;
boolean stopped = false;
ProgramInvoke invokeData;
@ -76,10 +77,30 @@ public class Program {
return ops[pc];
}
/**
* Last Op can only be set publicly (no getLastOp method), is used for logging
* @param op
*/
public void setLastOp(byte op) {
this.lastOp = op;
}
/**
* Should be set only after the OP is fully executed
* @param op
*/
public void setPreviouslyExecutedOp(byte op) {
this.previouslyExecutedOp = op;
}
/**
* returns the last fully executed OP
* @return
*/
public byte getPreviouslyExecutedOp() {
return this.previouslyExecutedOp;
}
public void stackPush(byte[] data) {
DataWord stackWord = new DataWord(data);
stack.push(stackWord);

View File

@ -176,7 +176,7 @@ public class VM {
DataWord exp = stack.get(stack.size()-2);
int bytesOccupied = exp.bytesOccupied();
gasCost = (bytesOccupied == 0) ? 0 : GasCost.EXP_GAS + GasCost.EXP_BYTE_GAS * bytesOccupied;
gasCost = GasCost.EXP_GAS + GasCost.EXP_BYTE_GAS * bytesOccupied;
break;
default:
break;
@ -821,9 +821,11 @@ public class VM {
case JUMP:{
DataWord pos = program.stackPop();
int nextPC = pos.intValue(); // possible overflow
if (nextPC != 0 && program.getOp(nextPC) != OpCode.JUMPDEST.val())
throw program.new BadJumpDestinationException();
if(program.getPreviouslyExecutedOp() < OpCode.PUSH1.val() || program.getPreviouslyExecutedOp() > OpCode.PUSH32.val()) {
if (nextPC != 0 && program.getOp(nextPC) != OpCode.JUMPDEST.val())
throw program.new BadJumpDestinationException();
}
if (logger.isInfoEnabled())
hint = "~> " + nextPC;
@ -836,8 +838,10 @@ public class VM {
if (!cond.isZero()) {
int nextPC = pos.intValue(); // possible overflow
if (nextPC != 0 && program.getOp(nextPC) != OpCode.JUMPDEST.val())
throw program.new BadJumpDestinationException();
if(program.getPreviouslyExecutedOp() < OpCode.PUSH1.val() || program.getPreviouslyExecutedOp() > OpCode.PUSH32.val()) {
if (nextPC != 0 && program.getOp(nextPC) != OpCode.JUMPDEST.val())
throw program.new BadJumpDestinationException();
}
// todo: in case destination is not JUMPDEST, check if prev was strict push
// todo: in EP: (ii) If a jump is preceded by a push, no jumpdest required;
@ -971,6 +975,8 @@ public class VM {
break;
}
program.setPreviouslyExecutedOp(op.val());
if (logger.isInfoEnabled() && !op.equals(CALL)
&& !op.equals(CREATE))
logger.info(logString, stepBefore, String.format("%-12s",
@ -1003,7 +1009,7 @@ public class VM {
program.spendGas(GasCost.TX_NO_ZERO_DATA * nonZeroesVals, "DATA");
program.spendGas(GasCost.TX_ZERO_DATA * zeroVals, "DATA");
}
while(!program.isStopped())
this.step(program);

View File

@ -14,7 +14,7 @@ public class GitHubVMTest {
@Ignore
public void testArithmeticFromGitHub() throws ParseException {
String json = JSONReader.loadJSON("vmtests/vmArithmeticTest.json");
String json = JSONReader.loadJSON("VMTests/vmArithmeticTest.json");
GitHubJSONTestSuite.runGitHubJsonTest(json);
}
@ -22,7 +22,7 @@ public class GitHubVMTest {
@Ignore
public void testBitwiseLogicOperationFromGitHub() throws ParseException {
String json = JSONReader.loadJSON("vmtests/vmBitwiseLogicOperationTest.json");
String json = JSONReader.loadJSON("VMTests/vmBitwiseLogicOperationTest.json");
GitHubJSONTestSuite.runGitHubJsonTest(json);
}
@ -68,9 +68,16 @@ public class GitHubVMTest {
@Test // testing full suite
@Ignore
public void testSystemOperationsFromGitHub() throws ParseException {
public void testVMGitHub() throws ParseException {
String json = JSONReader.loadJSON("vmtests/vmSystemOperationsTest.json");
GitHubJSONTestSuite.runGitHubJsonTest(json);
String json = JSONReader.loadJSON("vmtests/vmtests.json");
GitHubJSONTestSuite.runGitHubJsonTest(json);
}
@Test // testing full suite
public void testVMLogGitHub() throws ParseException {
String json = JSONReader.loadJSON("vmtests/vmLogTest.json");
GitHubJSONTestSuite.runGitHubJsonTest(json);
}
}

View File

@ -4,6 +4,8 @@ import static org.junit.Assert.*;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.ethereum.util.ByteUtil;
import org.ethereum.util.FastByteComparisons;
@ -237,6 +239,78 @@ public class ByteUtilTest {
assertEquals(0, result);
}
@Test
public void setBitTest() {
/*
Set on
*/
byte[] data = ByteBuffer.allocate(4).putInt(0).array();
int posBit = 24;
int expected = 128;
int result = -1;
byte[] ret = ByteUtil.setBit(data, posBit, 1);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
posBit = 25;
expected = 192;
ret = ByteUtil.setBit(data, posBit, 1);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
posBit = 2;
expected = 536871104;
ret = ByteUtil.setBit(data, posBit, 1);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
/*
Set off
*/
posBit = 24;
expected = 536870976;
ret = ByteUtil.setBit(data, posBit, 0);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
posBit = 25;
expected = 536870912;
ret = ByteUtil.setBit(data, posBit, 0);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
posBit = 2;
expected = 0;
ret = ByteUtil.setBit(data, posBit, 0);
result = ByteUtil.byteArrayToInt(ret);
assertTrue(expected == result);
}
@Test
public void getBitTest() {
byte[] data = ByteBuffer.allocate(4).putInt(0).array();
ByteUtil.setBit(data, 24, 1);
ByteUtil.setBit(data, 25, 1);
ByteUtil.setBit(data, 2, 1);
List<Integer> found = new ArrayList<Integer>();
for(int i=0; i < (data.length * 8); i++) {
int res = ByteUtil.getBit(data, i);
if(res == 1)
if(i != 24 && i != 25 && i != 2)
assertTrue(false);
else
found.add(i);
else {
if(i == 24 || i == 25 || i == 2)
assertTrue(false);
}
}
if(found.size() != 3)
assertTrue(false);
assertTrue(found.get(0) == 2);
assertTrue(found.get(1) == 24);
assertTrue(found.get(2) == 25);
}
}

View File

@ -1,49 +0,0 @@
{"arithm" : {
"callcreates": [
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9770,
"value": 74
}
],
"env": {
"currentCoinbase": "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty": "256",
"currentGasLimit": "1000000",
"currentNumber": "0",
"currentTimestamp": 1,
"previousHash": "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec": {
"address": "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller": "cd1722f3947def4cf144679da39c4c32bdc35681",
"code": "0x600060006000600060026002600803036002600306600260020460046004600402026002600201010101013360c85c03f1",
"data": "0x",
"gas": 10000,
"gasPrice": 100000000000000,
"origin": "cd1722f3947def4cf144679da39c4c32bdc35681",
"value": 1000000000000000000
},
"gas": 9949,
"out": [
],
"post": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 999999999999999926,
"code": "0x600060006000600060026002600803036002600306600260020460046004600402026002600201010101013360c85c03f1",
"nonce": 0,
"storage": {
}
}
},
"pre": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 1000000000000000000,
"code": "0x600060006000600060026002600803036002600306600260020460046004600402026002600201010101013360c85c03f1",
"nonce": 0,
"storage": {
}
}
}
}}

View File

@ -1,67 +0,0 @@
{"boolean": {
"callcreates": [
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9786,
"value": 2
},
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9732,
"value": 12
},
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9696,
"value": 13
},
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9660,
"value": 14
}
],
"env": {
"currentCoinbase": "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty": "256",
"currentGasLimit": "1000000",
"currentNumber": "0",
"currentTimestamp": 1,
"previousHash": "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec": {
"address": "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller": "cd1722f3947def4cf144679da39c4c32bdc35681",
"code": "0x60016001100f601a59600060006000600060023360c85c03f15060006001100f603459600060006000600060033360c85c03f15060016000100f604e59600060006000600060043360c85c03f15060006000100f606859600060006000600060053360c85c03f15060016001110f6082596000600060006000600c3360c85c03f15060006001110f609c596000600060006000600d3360c85c03f15060016000110f60b6596000600060006000600e3360c85c03f15060006000110f60d0596000600060006000600f3360c85c03f150",
"data": "0x",
"gas": 10000,
"gasPrice": 100000000000000,
"origin": "cd1722f3947def4cf144679da39c4c32bdc35681",
"value": 1000000000000000000
},
"gas": 9832,
"out": [
],
"post": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 999999999999999959,
"code": "0x60016001100f601a59600060006000600060023360c85c03f15060006001100f603459600060006000600060033360c85c03f15060016000100f604e59600060006000600060043360c85c03f15060006000100f606859600060006000600060053360c85c03f15060016001110f6082596000600060006000600c3360c85c03f15060006001110f609c596000600060006000600d3360c85c03f15060016000110f60b6596000600060006000600e3360c85c03f15060006000110f60d0596000600060006000600f3360c85c03f150",
"nonce": 0,
"storage": {
}
}
},
"pre": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 1000000000000000000,
"code": "0x60016001100f601a59600060006000600060023360c85c03f15060006001100f603459600060006000600060033360c85c03f15060016000100f604e59600060006000600060043360c85c03f15060006000100f606859600060006000600060053360c85c03f15060016001110f6082596000600060006000600c3360c85c03f15060006001110f609c596000600060006000600d3360c85c03f15060016000110f60b6596000600060006000600e3360c85c03f15060006000110f60d0596000600060006000600f3360c85c03f150",
"nonce": 0,
"storage": {
}
}
}
}}

View File

@ -1,49 +0,0 @@
{"mktx": {
"callcreates": [
{
"data": "0x",
"destination": "cd1722f3947def4cf144679da39c4c32bdc35681",
"gasLimit": 9792,
"value": 500000000000000000
}
],
"env": {
"currentCoinbase": "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty": "256",
"currentGasLimit": "1000000",
"currentNumber": "0",
"currentTimestamp": 1,
"previousHash": "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec": {
"address": "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller": "cd1722f3947def4cf144679da39c4c32bdc35681",
"code": "0x60006000600060006706f05b59d3b200003360c85c03f1",
"data": "0x",
"gas": 10000,
"gasPrice": 100000000000000,
"origin": "cd1722f3947def4cf144679da39c4c32bdc35681",
"value": 1000000000000000000
},
"gas": 9971,
"out": [
],
"post": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 500000000000000000,
"code": "0x60006000600060006706f05b59d3b200003360c85c03f1",
"nonce": 0,
"storage": {
}
}
},
"pre": {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6": {
"balance": 1000000000000000000,
"code": "0x60006000600060006706f05b59d3b200003360c85c03f1",
"nonce": 0,
"storage": {
}
}
}
}}

View File

@ -1,45 +0,0 @@
{
"suicide" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x33ff",
"data" : "0x",
"gas" : 10000,
"gasPrice" : 100000000000000,
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : 1000000000000000000
},
"gas" : 9999,
"out" : [
],
"post" : {
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
"balance" : 1000000000000000000,
"code" : "0x",
"nonce" : 0,
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : 1000000000000000000,
"code" : "0x33ff",
"nonce" : 0,
"storage" : {
}
}
}
}
}

View File

@ -1,67 +0,0 @@
{
"namecoin": {
"pre": {
"0000000000000000000000000000000000000000": {
"nonce": 0,
"balance": 1500000000000000000,
"storage": {},
"code": ""
},
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1": {
"nonce": 1,
"balance": 1000000000000000000,
"storage": {},
"code": ""
},
"c305c901078781c232a2a521c2af7980f8385ee9": {
"nonce": 0,
"balance": 0,
"storage": {},
"code": "0x600035560f601559600060605460206060f260265860203560003557600160405460206040f2"
}
},
"exec": {
"origin": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"code": "0x600035560f601559600060605460206060f260265860203560003557600160405460206040f2",
"value": 0,
"address": "c305c901078781c232a2a521c2af7980f8385ee9",
"gas": 10000,
"caller": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"data": "0x000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e",
"gasPrice": 1000000000000
},
"callcreates": [],
"gas": 9762,
"env": {
"currentTimestamp": 1405011413,
"currentGasLimit": 999023,
"previousHash": "dd9c9abf3aba9a813870dad3addac510dfc98362b9d44206a21865c4c059e38d",
"currentCoinbase": "82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
"currentDifficulty": 4190208,
"currentNumber": 1
},
"post": {
"0000000000000000000000000000000000000000": {
"nonce": 0,
"balance": 1500000000000000000,
"storage": {},
"code": "0x"
},
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1": {
"nonce": 1,
"balance": 1000000000000000000,
"storage": {},
"code": "0x"
},
"c305c901078781c232a2a521c2af7980f8385ee9": {
"nonce": 0,
"balance": 0,
"storage": {
"0x2d": "0x4e"
},
"code": "0x600035560f601559600060605460206060f260265860203560003557600160405460206040f2"
}
},
"out": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
}

View File

@ -1,259 +0,0 @@
{
"coinbase" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x41600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9798",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x41600057",
"nonce" : "0",
"storage" : {
"0x" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x41600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"difficulty" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x44600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9798",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x44600057",
"nonce" : "0",
"storage" : {
"0x" : "0x0100"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x44600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"gaslimit" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x45600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9798",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x45600057",
"nonce" : "0",
"storage" : {
"0x" : "0x0f4240"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x45600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"number" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x43600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9898",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x43600057",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x43600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"prevhash" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x40600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9798",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x40600057",
"nonce" : "0",
"storage" : {
"0x" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x40600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"timestamp" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x42600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9798",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x42600057",
"nonce" : "0",
"storage" : {
"0x" : "0x01"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x42600057",
"nonce" : "0",
"storage" : {
}
}
}
}
}

View File

@ -1,173 +0,0 @@
{
"sha3_0" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x6000600020600057",
"data" : "0x",
"gas" : "100000000000",
"gasPrice" : "1000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "99999999777",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6000600020600057",
"nonce" : "0",
"storage" : {
"0x" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6000600020600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"sha3_1" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x6005600420600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9776",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6005600420600057",
"nonce" : "0",
"storage" : {
"0x" : "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6005600420600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"sha3_2" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x600a600a20600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9776",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x600a600a20600057",
"nonce" : "0",
"storage" : {
"0x" : "0x6bd2dd6bd408cbee33429358bf24fdc64612fbf8b1b4db604518f40ffd34b607"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x600a600a20600057",
"nonce" : "0",
"storage" : {
}
}
}
},
"sha3_3" : {
"callcreates" : [
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "256",
"currentGasLimit" : "1000000",
"currentNumber" : "0",
"currentTimestamp" : "1",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x6064640fffffffff20600057",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "0",
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6064640fffffffff20600057",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x6064640fffffffff20600057",
"nonce" : "0",
"storage" : {
}
}
}
}
}

View File

@ -19,7 +19,7 @@ log4j.logger.peermonitor = ERROR
log4j.logger.java.nio = ERROR
log4j.logger.io.netty = ERROR
log4j.logger.wire = ERROR
log4j.logger.VM = ERROR
log4j.logger.VM = ALL
log4j.logger.main = ERROR
log4j.logger.trie = ERROR
log4j.logger.state = INFO

View File

@ -136,4 +136,7 @@ hello.phrase = Dev
# but any manual hash this property will help.
# values [-1] - load from db
# [hex hash 32 bytes] root hash
root.hash.start = -1
root.hash.start = -1
# if set true, json tests will be loaded from local repository
GitHubTests.VMTest.loadLocal = true