Merge branch 'vmfixes'
This commit is contained in:
commit
3613002557
|
@ -5,7 +5,6 @@ import org.ethereum.facade.Repository;
|
|||
import org.ethereum.listener.EthereumListener;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.net.BlockQueue;
|
||||
import org.ethereum.net.eth.EthHandler;
|
||||
import org.ethereum.util.AdvancedDeviceUtils;
|
||||
import org.ethereum.vm.*;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -3,8 +3,6 @@ package org.ethereum.core;
|
|||
import org.ethereum.crypto.HashUtil;
|
||||
import org.ethereum.trie.Trie;
|
||||
import org.ethereum.trie.TrieImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
@ -41,8 +39,6 @@ public class Genesis extends Block {
|
|||
"1a26338f0d905e295fccb71fa9ea849ffa12aaf4", // # (A)
|
||||
};
|
||||
|
||||
Logger logger = LoggerFactory.getLogger("main");
|
||||
|
||||
private static byte[] zeroHash256 = new byte[32];
|
||||
private static byte[] zeroHash160 = new byte[20];
|
||||
|
||||
|
@ -74,9 +70,6 @@ public class Genesis extends Block {
|
|||
state.update(Hex.decode(address), acctState.getEncoded());
|
||||
}
|
||||
setStateRoot(state.getRootHash());
|
||||
|
||||
logger.info("Genesis-hash: {}", Hex.toHexString(this.getHash()));
|
||||
logger.info("Genesis-stateRoot: {}", Hex.toHexString(this.getStateRoot()));
|
||||
}
|
||||
|
||||
public static Block getInstance() {
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.spongycastle.util.BigIntegers;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.SignatureException;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +24,7 @@ import java.security.SignatureException;
|
|||
*/
|
||||
public class Transaction {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Transaction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(Transaction.class);
|
||||
|
||||
/* SHA3 hash of the RLP encoded transaction */
|
||||
private byte[] hash;
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.spongycastle.util.encoders.Hex;
|
|||
*/
|
||||
public class DatabaseImpl implements Database {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger("db");
|
||||
private static final Logger logger = LoggerFactory.getLogger("db");
|
||||
private DB db;
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import static org.ethereum.config.SystemProperties.CONFIG;
|
|||
*/
|
||||
public class RepositoryImpl implements Repository {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("repository");
|
||||
private static final Logger logger = LoggerFactory.getLogger("repository");
|
||||
|
||||
private Trie worldState;
|
||||
private TrackTrie accountStateDB;
|
||||
|
@ -473,18 +473,17 @@ public class RepositoryImpl implements Repository {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
|
||||
if (this.chainDB != null){
|
||||
chainDB.close();
|
||||
chainDB = null;
|
||||
if (this.detailsDB != null){
|
||||
detailsDB.close();
|
||||
detailsDB = null;
|
||||
}
|
||||
if (this.stateDB != null){
|
||||
stateDB.close();
|
||||
stateDB = null;
|
||||
}
|
||||
if (this.detailsDB != null){
|
||||
detailsDB.close();
|
||||
detailsDB = null;
|
||||
if (this.chainDB != null){
|
||||
chainDB.close();
|
||||
chainDB = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,273 +44,275 @@ public class TestRunner {
|
|||
|
||||
public List<String> runTestCase(TestCase testCase) {
|
||||
|
||||
System.out.println("\nRunning test case: " + testCase.getName());
|
||||
List<String> results = new ArrayList<>();
|
||||
|
||||
Repository repository = new RepositoryImpl();
|
||||
|
||||
System.out.println("--------- PRE ---------");
|
||||
/* 1. Store pre-exist accounts - Pre */
|
||||
for (ByteArrayWrapper key : testCase.getPre().keySet()) {
|
||||
|
||||
AccountState accountState = testCase.getPre().get(key);
|
||||
|
||||
repository.createAccount(key.getData());
|
||||
repository.saveCode(key.getData(), accountState.getCode());
|
||||
repository.addBalance(key.getData(), new BigInteger(accountState.getBalance()));
|
||||
|
||||
for (long i = 0; i < accountState.getNonceLong(); ++i)
|
||||
repository.increaseNonce(key.getData());
|
||||
}
|
||||
|
||||
/* 2. Create ProgramInvoke - Env/Exec */
|
||||
Env env = testCase.getEnv();
|
||||
Exec exec = testCase.getExec();
|
||||
|
||||
byte[] address = exec.getAddress();
|
||||
byte[] origin = exec.getOrigin();
|
||||
byte[] caller = exec.getCaller();
|
||||
byte[] balance = ByteUtil.bigIntegerToBytes(repository.getBalance(exec.getAddress()));
|
||||
byte[] gasPrice = exec.getGasPrice();
|
||||
byte[] gas = exec.getGas();
|
||||
byte[] callValue = exec.getValue();
|
||||
byte[] msgData = exec.getData();
|
||||
byte[] lastHash = env.getPreviousHash();
|
||||
byte[] coinbase = env.getCurrentCoinbase();
|
||||
long timestamp = new BigInteger(env.getCurrentTimestamp()).longValue();
|
||||
long number = new BigInteger(env.getCurrentNumber()).longValue();
|
||||
byte[] difficulty = env.getCurrentDifficlty();
|
||||
long gaslimit = new BigInteger(env.getCurrentGasLimit()).longValue();
|
||||
|
||||
// Origin and caller need to exist in order to be able to execute
|
||||
if(repository.getAccountState(origin) == null)
|
||||
repository.createAccount(origin);
|
||||
if(repository.getAccountState(caller) == null)
|
||||
repository.createAccount(caller);
|
||||
|
||||
ProgramInvoke programInvoke = new ProgramInvokeImpl(address, origin, caller, balance,
|
||||
gasPrice, gas, callValue, msgData, lastHash, coinbase,
|
||||
timestamp, number, difficulty, gaslimit, repository, true);
|
||||
|
||||
/* 3. Create Program - exec.code */
|
||||
/* 4. run VM */
|
||||
VM vm = new VM();
|
||||
Program program = new Program(exec.getCode(), programInvoke);
|
||||
|
||||
try {
|
||||
System.out.println("-------- EXEC --------");
|
||||
while(!program.isStopped())
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.setRuntimeFailure(e);
|
||||
}
|
||||
|
||||
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 (!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),
|
||||
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);
|
||||
}
|
||||
program.getResult().getRepository().close();
|
||||
|
||||
return results;
|
||||
Repository repository = new RepositoryImpl();
|
||||
|
||||
try {
|
||||
System.out.println("\nRunning test case: " + testCase.getName());
|
||||
List<String> results = new ArrayList<>();
|
||||
|
||||
System.out.println("--------- PRE ---------");
|
||||
/* 1. Store pre-exist accounts - Pre */
|
||||
for (ByteArrayWrapper key : testCase.getPre().keySet()) {
|
||||
|
||||
AccountState accountState = testCase.getPre().get(key);
|
||||
|
||||
repository.createAccount(key.getData());
|
||||
repository.saveCode(key.getData(), accountState.getCode());
|
||||
repository.addBalance(key.getData(), new BigInteger(accountState.getBalance()));
|
||||
|
||||
for (long i = 0; i < accountState.getNonceLong(); ++i)
|
||||
repository.increaseNonce(key.getData());
|
||||
}
|
||||
|
||||
/* 2. Create ProgramInvoke - Env/Exec */
|
||||
Env env = testCase.getEnv();
|
||||
Exec exec = testCase.getExec();
|
||||
|
||||
byte[] address = exec.getAddress();
|
||||
byte[] origin = exec.getOrigin();
|
||||
byte[] caller = exec.getCaller();
|
||||
byte[] balance = ByteUtil.bigIntegerToBytes(repository.getBalance(exec.getAddress()));
|
||||
byte[] gasPrice = exec.getGasPrice();
|
||||
byte[] gas = exec.getGas();
|
||||
byte[] callValue = exec.getValue();
|
||||
byte[] msgData = exec.getData();
|
||||
byte[] lastHash = env.getPreviousHash();
|
||||
byte[] coinbase = env.getCurrentCoinbase();
|
||||
long timestamp = new BigInteger(env.getCurrentTimestamp()).longValue();
|
||||
long number = new BigInteger(env.getCurrentNumber()).longValue();
|
||||
byte[] difficulty = env.getCurrentDifficlty();
|
||||
long gaslimit = new BigInteger(env.getCurrentGasLimit()).longValue();
|
||||
|
||||
// Origin and caller need to exist in order to be able to execute
|
||||
if(repository.getAccountState(origin) == null)
|
||||
repository.createAccount(origin);
|
||||
if(repository.getAccountState(caller) == null)
|
||||
repository.createAccount(caller);
|
||||
|
||||
ProgramInvoke programInvoke = new ProgramInvokeImpl(address, origin, caller, balance,
|
||||
gasPrice, gas, callValue, msgData, lastHash, coinbase,
|
||||
timestamp, number, difficulty, gaslimit, repository, true);
|
||||
|
||||
/* 3. Create Program - exec.code */
|
||||
/* 4. run VM */
|
||||
VM vm = new VM();
|
||||
Program program = new Program(exec.getCode(), programInvoke);
|
||||
|
||||
try {
|
||||
System.out.println("-------- EXEC --------");
|
||||
while(!program.isStopped())
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.setRuntimeFailure(e);
|
||||
}
|
||||
|
||||
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 (!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),
|
||||
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);
|
||||
}
|
||||
return results;
|
||||
} finally {
|
||||
repository.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.ethereum.net;
|
|||
|
||||
import static org.ethereum.config.SystemProperties.CONFIG;
|
||||
|
||||
import org.ethereum.config.SystemProperties;
|
||||
import org.ethereum.core.Block;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -22,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
*/
|
||||
public class BlockQueue {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger("blockqueue");
|
||||
private static final Logger logger = LoggerFactory.getLogger("blockqueue");
|
||||
|
||||
/** The list of hashes of the heaviest chain on the network,
|
||||
* for which this client doesn't have the blocks yet */
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
*/
|
||||
public class MessageQueue {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("net");
|
||||
private static final Logger logger = LoggerFactory.getLogger("net");
|
||||
|
||||
private Queue<MessageRoundtrip> messageQueue = new ConcurrentLinkedQueue<>();
|
||||
private PeerListener listener;
|
||||
|
|
|
@ -29,7 +29,7 @@ import static org.ethereum.config.SystemProperties.CONFIG;
|
|||
*/
|
||||
public class PeerClient {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("wire");
|
||||
private static final Logger logger = LoggerFactory.getLogger("wire");
|
||||
|
||||
private PeerListener peerListener;
|
||||
private P2pHandler p2pHandler;
|
||||
|
|
|
@ -16,7 +16,7 @@ import static java.lang.Thread.sleep;
|
|||
*/
|
||||
public class TransactionTask implements Callable<Transaction> {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(TransactionTask.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TransactionTask.class);
|
||||
|
||||
private Transaction tx;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ import java.util.List;
|
|||
*/
|
||||
public class MessageDecoder extends ByteToMessageDecoder {
|
||||
|
||||
private Logger loggerWire = LoggerFactory.getLogger("wire");
|
||||
private Logger loggerNet = LoggerFactory.getLogger("net");
|
||||
private static final Logger loggerWire = LoggerFactory.getLogger("wire");
|
||||
private static final Logger loggerNet = LoggerFactory.getLogger("net");
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
||||
|
|
|
@ -16,8 +16,8 @@ import org.spongycastle.util.encoders.Hex;
|
|||
*/
|
||||
public class MessageEncoder extends MessageToByteEncoder<Message> {
|
||||
|
||||
private Logger loggerWire = LoggerFactory.getLogger("wire");
|
||||
private Logger loggerNet = LoggerFactory.getLogger("net");
|
||||
private static final Logger loggerWire = LoggerFactory.getLogger("wire");
|
||||
private static final Logger loggerNet = LoggerFactory.getLogger("net");
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.spongycastle.util.encoders.Hex;
|
|||
*/
|
||||
public class TrieImpl implements Trie {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("trie");
|
||||
private static final Logger logger = LoggerFactory.getLogger("trie");
|
||||
|
||||
private static byte PAIR_SIZE = 2;
|
||||
private static byte LIST_SIZE = 17;
|
||||
|
|
|
@ -9,304 +9,305 @@ import java.util.Map;
|
|||
* - Appendix G. Virtual Machine Specification
|
||||
*/
|
||||
public enum OpCode {
|
||||
|
||||
|
||||
/** Halts execution (0x00) */
|
||||
STOP(0x00),
|
||||
STOP(0x00, 0),
|
||||
|
||||
/* Arithmetic Operations */
|
||||
|
||||
/** (0x01) Addition operation */
|
||||
ADD(0x01),
|
||||
ADD(0x01, 2),
|
||||
/** (0x02) Multiplication operation */
|
||||
MUL(0x02),
|
||||
MUL(0x02, 2),
|
||||
/** (0x03) Subtraction operations */
|
||||
SUB(0x03),
|
||||
SUB(0x03, 2),
|
||||
/** (0x04) Integer division operation */
|
||||
DIV(0x04),
|
||||
DIV(0x04, 2),
|
||||
/** (0x05) Signed integer division operation*/
|
||||
SDIV(0x05),
|
||||
SDIV(0x05, 2),
|
||||
/** (0x06) Modulo remainder operation */
|
||||
MOD(0x06),
|
||||
MOD(0x06, 2),
|
||||
/** (0x07) Signed modulo remainder operation*/
|
||||
SMOD(0x07),
|
||||
SMOD(0x07, 2),
|
||||
/** (0x08) Exponential operation */
|
||||
EXP(0x08),
|
||||
EXP(0x08, 2),
|
||||
/** (0x09) Negation operation */
|
||||
NEG(0x09),
|
||||
NEG(0x09, 1),
|
||||
/** (0x0a) Less-than comparison */
|
||||
LT(0X0a),
|
||||
LT(0X0a, 2),
|
||||
/** (0x0b) Greater-than comparison */
|
||||
GT(0X0b),
|
||||
GT(0X0b, 2),
|
||||
/** (0x0c) Signed less-than comparison */
|
||||
SLT(0X0c),
|
||||
SLT(0X0c, 2),
|
||||
/** (0x0d) Signed greater-than comparison */
|
||||
SGT(0X0d),
|
||||
SGT(0X0d, 2),
|
||||
/** (0x0e) Equality comparison */
|
||||
EQ(0X0e),
|
||||
EQ(0X0e, 2),
|
||||
/** (0x0f) Simple not operator */
|
||||
NOT(0X0f),
|
||||
NOT(0X0f, 1),
|
||||
|
||||
/* Bitwise Logic Operations */
|
||||
|
||||
/** (0x10) Bitwise AND operation */
|
||||
AND(0x10),
|
||||
AND(0x10, 2),
|
||||
/** (0x11) Bitwise OR operation */
|
||||
OR(0x11),
|
||||
OR(0x11, 2),
|
||||
/** (0x12) Bitwise XOR operation */
|
||||
XOR(0x12),
|
||||
XOR(0x12, 2),
|
||||
/** (0x13) Retrieve single byte from word */
|
||||
BYTE(0x13),
|
||||
BYTE(0x13, 2),
|
||||
/** (0x14) Addition combined with modulo
|
||||
* remainder operation */
|
||||
ADDMOD(0x14),
|
||||
ADDMOD(0x14, 3),
|
||||
/** (0x15) Multiplication combined with modulo
|
||||
* remainder operation */
|
||||
MULMOD(0x15),
|
||||
MULMOD(0x15, 3),
|
||||
|
||||
/* Cryptographic Operations */
|
||||
|
||||
/** (0x20) Compute SHA3-256 hash */
|
||||
SHA3(0x20),
|
||||
SHA3(0x20, 2),
|
||||
|
||||
/* Environmental Information */
|
||||
|
||||
|
||||
/** (0x30) Get address of currently
|
||||
* executing account */
|
||||
ADDRESS(0x30),
|
||||
ADDRESS(0x30, 0),
|
||||
/** (0x31) Get balance of the given account */
|
||||
BALANCE(0x31),
|
||||
BALANCE(0x31, 1),
|
||||
/** (0x32) Get execution origination address*/
|
||||
ORIGIN(0x32),
|
||||
ORIGIN(0x32, 0),
|
||||
/** (0x33) Get caller address */
|
||||
CALLER(0x33),
|
||||
CALLER(0x33, 0),
|
||||
/** (0x34) Get deposited value by the
|
||||
* instruction/transaction responsible
|
||||
* for this execution */
|
||||
CALLVALUE(0x34),
|
||||
CALLVALUE(0x34, 0),
|
||||
/** (0x35) Get input data of current
|
||||
* environment */
|
||||
CALLDATALOAD(0x35),
|
||||
CALLDATALOAD(0x35, 1),
|
||||
/** (0x36) Get size of input data in current
|
||||
* environment */
|
||||
CALLDATASIZE(0x36),
|
||||
CALLDATASIZE(0x36, 0),
|
||||
/** (0x37) Copy input data in current
|
||||
* environment to memory */
|
||||
CALLDATACOPY(0x37),
|
||||
CALLDATACOPY(0x37, 3),
|
||||
/** (0x38) Get size of code running in
|
||||
* current environment */
|
||||
CODESIZE(0x38),
|
||||
CODESIZE(0x38, 0),
|
||||
/** (0x39) Copy code running in current
|
||||
* environment to memory */
|
||||
CODECOPY(0x39), // [len code_start mem_start CODECOPY]
|
||||
CODECOPY(0x39, 3), // [len code_start mem_start CODECOPY]
|
||||
/** (0x3a) Get price of gas in current
|
||||
* environment */
|
||||
GASPRICE(0x3a),
|
||||
GASPRICE(0x3a, 0),
|
||||
/** (0x3b) Get size of code running in
|
||||
* current environment with given offset */
|
||||
EXTCODESIZE(0x3b),
|
||||
EXTCODESIZE(0x3b, 1),
|
||||
/** (0x3c) Copy code running in current
|
||||
* environment to memory with given offset */
|
||||
EXTCODECOPY(0x3c),
|
||||
EXTCODECOPY(0x3c, 4),
|
||||
|
||||
|
||||
|
||||
/* Block Information */
|
||||
|
||||
/** (0x40) Get hash of most recent
|
||||
* complete block */
|
||||
PREVHASH(0x40),
|
||||
PREVHASH(0x40, 0),
|
||||
/** (0x41) Get the block’s coinbase address */
|
||||
COINBASE(0x41),
|
||||
COINBASE(0x41, 0),
|
||||
/** (x042) Get the block’s timestamp */
|
||||
TIMESTAMP(0x42),
|
||||
TIMESTAMP(0x42, 0),
|
||||
/** (0x43) Get the block’s number */
|
||||
NUMBER(0x43),
|
||||
NUMBER(0x43, 0),
|
||||
/** (0x44) Get the block’s difficulty */
|
||||
DIFFICULTY(0x44),
|
||||
DIFFICULTY(0x44, 0),
|
||||
/** (0x45) Get the block’s gas limit */
|
||||
GASLIMIT(0x45),
|
||||
GASLIMIT(0x45, 0),
|
||||
|
||||
/* Memory, Storage and Flow Operations */
|
||||
|
||||
|
||||
/** (0x50) Remove item from stack */
|
||||
POP(0x50),
|
||||
POP(0x50, 1),
|
||||
/** (0x53) Load word from memory */
|
||||
MLOAD(0x53),
|
||||
MLOAD(0x53, 1),
|
||||
/** (0x54) Save word to memory */
|
||||
MSTORE(0x54),
|
||||
MSTORE(0x54, 2),
|
||||
/** (0x55) Save byte to memory */
|
||||
MSTORE8(0x55),
|
||||
MSTORE8(0x55, 2),
|
||||
/** (0x56) Load word from storage */
|
||||
SLOAD(0x56),
|
||||
SLOAD(0x56, 1),
|
||||
/** (0x57) Save word to storage */
|
||||
SSTORE(0x57),
|
||||
SSTORE(0x57, 2),
|
||||
/** (0x58) Alter the program counter */
|
||||
JUMP(0x58),
|
||||
JUMP(0x58, 1),
|
||||
/** (0x59) Conditionally alter the program
|
||||
* counter */
|
||||
JUMPI(0x59),
|
||||
JUMPI(0x59, 2),
|
||||
/** (0x5a) Get the program counter */
|
||||
PC(0x5a),
|
||||
PC(0x5a, 0),
|
||||
/** (0x5b) Get the size of active memory */
|
||||
MSIZE(0x5b),
|
||||
MSIZE(0x5b, 0),
|
||||
/** (0x5c) Get the amount of available gas */
|
||||
GAS(0x5c),
|
||||
GAS(0x5c, 0),
|
||||
/** (0x5d) */
|
||||
JUMPDEST(0x5d),
|
||||
JUMPDEST(0x5d, 0),
|
||||
|
||||
/* Push Operations */
|
||||
|
||||
/** (0x60) Place 1-byte item on stack */
|
||||
PUSH1(0x60),
|
||||
PUSH1(0x60, 0),
|
||||
/** (0x61) Place 2-byte item on stack */
|
||||
PUSH2(0x61),
|
||||
PUSH2(0x61, 0),
|
||||
/** (0x62) Place 3-byte item on stack */
|
||||
PUSH3(0x62),
|
||||
PUSH3(0x62, 0),
|
||||
/** (0x63) Place 4-byte item on stack */
|
||||
PUSH4(0x63),
|
||||
PUSH4(0x63, 0),
|
||||
/** (0x64) Place 5-byte item on stack */
|
||||
PUSH5(0x64),
|
||||
PUSH5(0x64, 0),
|
||||
/** (0x65) Place 6-byte item on stack */
|
||||
PUSH6(0x65),
|
||||
PUSH6(0x65, 0),
|
||||
/** (0x66) Place 7-byte item on stack */
|
||||
PUSH7(0x66),
|
||||
PUSH7(0x66, 0),
|
||||
/** (0x67) Place 8-byte item on stack */
|
||||
PUSH8(0x67),
|
||||
PUSH8(0x67, 0),
|
||||
/** (0x68) Place 9-byte item on stack */
|
||||
PUSH9(0x68),
|
||||
PUSH9(0x68, 0),
|
||||
/** (0x69) Place 10-byte item on stack */
|
||||
PUSH10(0x69),
|
||||
PUSH10(0x69, 0),
|
||||
/** (0x6a) Place 11-byte item on stack */
|
||||
PUSH11(0x6a),
|
||||
PUSH11(0x6a, 0),
|
||||
/** (0x6b) Place 12-byte item on stack */
|
||||
PUSH12(0x6b),
|
||||
PUSH12(0x6b, 0),
|
||||
/** (0x6c) Place 13-byte item on stack */
|
||||
PUSH13(0x6c),
|
||||
PUSH13(0x6c, 0),
|
||||
/** (0x6d) Place 14-byte item on stack */
|
||||
PUSH14(0x6d),
|
||||
PUSH14(0x6d, 0),
|
||||
/** (0x6e) Place 15-byte item on stack */
|
||||
PUSH15(0x6e),
|
||||
PUSH15(0x6e, 0),
|
||||
/** (0x6f) Place 16-byte item on stack */
|
||||
PUSH16(0x6f),
|
||||
PUSH16(0x6f, 0),
|
||||
/** (0x70) Place 17-byte item on stack */
|
||||
PUSH17(0x70),
|
||||
PUSH17(0x70, 0),
|
||||
/** (0x71) Place 18-byte item on stack */
|
||||
PUSH18(0x71),
|
||||
PUSH18(0x71, 0),
|
||||
/** (0x72) Place 19-byte item on stack */
|
||||
PUSH19(0x72),
|
||||
PUSH19(0x72, 0),
|
||||
/** (0x73) Place 20-byte item on stack */
|
||||
PUSH20(0x73),
|
||||
PUSH20(0x73, 0),
|
||||
/** (0x74) Place 21-byte item on stack */
|
||||
PUSH21(0x74),
|
||||
PUSH21(0x74, 0),
|
||||
/** (0x75) Place 22-byte item on stack */
|
||||
PUSH22(0x75),
|
||||
PUSH22(0x75, 0),
|
||||
/** (0x76) Place 23-byte item on stack */
|
||||
PUSH23(0x76),
|
||||
PUSH23(0x76, 0),
|
||||
/** (0x77) Place 24-byte item on stack */
|
||||
PUSH24(0x77),
|
||||
PUSH24(0x77, 0),
|
||||
/** (0x78) Place 25-byte item on stack */
|
||||
PUSH25(0x78),
|
||||
PUSH25(0x78, 0),
|
||||
/** (0x79) Place 26-byte item on stack */
|
||||
PUSH26(0x79),
|
||||
PUSH26(0x79, 0),
|
||||
/** (0x7a) Place 27-byte item on stack */
|
||||
PUSH27(0x7a),
|
||||
PUSH27(0x7a, 0),
|
||||
/** (0x7b) Place 28-byte item on stack */
|
||||
PUSH28(0x7b),
|
||||
PUSH28(0x7b, 0),
|
||||
/** (0x7c) Place 29-byte item on stack */
|
||||
PUSH29(0x7c),
|
||||
PUSH29(0x7c, 0),
|
||||
/** (0x7d) Place 30-byte item on stack */
|
||||
PUSH30(0x7d),
|
||||
PUSH30(0x7d, 0),
|
||||
/** (0x7e) Place 31-byte item on stack */
|
||||
PUSH31(0x7e),
|
||||
PUSH31(0x7e, 0),
|
||||
/** (0x7f) Place 32-byte (full word)
|
||||
* item on stack */
|
||||
PUSH32(0x7f),
|
||||
PUSH32(0x7f, 0),
|
||||
|
||||
/* Duplicate Nth item from the stack */
|
||||
|
||||
/** (0x80) Duplicate 1st item on stack */
|
||||
DUP1(0x80),
|
||||
DUP1(0x80, 1),
|
||||
/** (0x81) Duplicate 2nd item on stack */
|
||||
DUP2(0x81),
|
||||
DUP2(0x81, 2),
|
||||
/** (0x82) Duplicate 3rd item on stack */
|
||||
DUP3(0x82),
|
||||
DUP3(0x82, 3),
|
||||
/** (0x83) Duplicate 4th item on stack */
|
||||
DUP4(0x83),
|
||||
DUP4(0x83, 4),
|
||||
/** (0x84) Duplicate 5th item on stack */
|
||||
DUP5(0x84),
|
||||
DUP5(0x84, 5),
|
||||
/** (0x85) Duplicate 6th item on stack */
|
||||
DUP6(0x85),
|
||||
DUP6(0x85, 6),
|
||||
/** (0x86) Duplicate 7th item on stack */
|
||||
DUP7(0x86),
|
||||
DUP7(0x86, 7),
|
||||
/** (0x87) Duplicate 8th item on stack */
|
||||
DUP8(0x87),
|
||||
DUP8(0x87, 8),
|
||||
/** (0x88) Duplicate 9th item on stack */
|
||||
DUP9(0x88),
|
||||
DUP9(0x88, 9),
|
||||
/** (0x89) Duplicate 10th item on stack */
|
||||
DUP10(0x89),
|
||||
DUP10(0x89, 10),
|
||||
/** (0x8a) Duplicate 11th item on stack */
|
||||
DUP11(0x8a),
|
||||
DUP11(0x8a, 11),
|
||||
/** (0x8b) Duplicate 12th item on stack */
|
||||
DUP12(0x8b),
|
||||
DUP12(0x8b, 12),
|
||||
/** (0x8c) Duplicate 13th item on stack */
|
||||
DUP13(0x8c),
|
||||
DUP13(0x8c, 13),
|
||||
/** (0x8d) Duplicate 14th item on stack */
|
||||
DUP14(0x8d),
|
||||
DUP14(0x8d, 14),
|
||||
/** (0x8e) Duplicate 15th item on stack */
|
||||
DUP15(0x8e),
|
||||
DUP15(0x8e, 15),
|
||||
/** (0x8f) Duplicate 16th item on stack */
|
||||
DUP16(0x8f),
|
||||
DUP16(0x8f, 16),
|
||||
|
||||
/* Swap the Nth item from the stack with the top */
|
||||
|
||||
/** (0x90) Exchange 2nd item from stack with the top */
|
||||
SWAP1(0x90),
|
||||
SWAP1(0x90, 2),
|
||||
/** (0x91) Exchange 3rd item from stack with the top */
|
||||
SWAP2(0x91),
|
||||
SWAP2(0x91, 3),
|
||||
/** (0x92) Exchange 4th item from stack with the top */
|
||||
SWAP3(0x92),
|
||||
SWAP3(0x92, 4),
|
||||
/** (0x93) Exchange 5th item from stack with the top */
|
||||
SWAP4(0x93),
|
||||
SWAP4(0x93, 5),
|
||||
/** (0x94) Exchange 6th item from stack with the top */
|
||||
SWAP5(0x94),
|
||||
SWAP5(0x94, 6),
|
||||
/** (0x95) Exchange 7th item from stack with the top */
|
||||
SWAP6(0x95),
|
||||
SWAP6(0x95, 7),
|
||||
/** (0x96) Exchange 8th item from stack with the top */
|
||||
SWAP7(0x96),
|
||||
SWAP7(0x96, 8),
|
||||
/** (0x97) Exchange 9th item from stack with the top */
|
||||
SWAP8(0x97),
|
||||
SWAP8(0x97, 9),
|
||||
/** (0x98) Exchange 10th item from stack with the top */
|
||||
SWAP9(0x98),
|
||||
SWAP9(0x98, 10),
|
||||
/** (0x99) Exchange 11th item from stack with the top */
|
||||
SWAP10(0x99),
|
||||
SWAP10(0x99, 11),
|
||||
/** (0x9a) Exchange 12th item from stack with the top */
|
||||
SWAP11(0x9a),
|
||||
SWAP11(0x9a, 12),
|
||||
/** (0x9b) Exchange 13th item from stack with the top */
|
||||
SWAP12(0x9b),
|
||||
SWAP12(0x9b, 13),
|
||||
/** (0x9c) Exchange 14th item from stack with the top */
|
||||
SWAP13(0x9c),
|
||||
SWAP13(0x9c, 14),
|
||||
/** (0x9d) Exchange 15th item from stack with the top */
|
||||
SWAP14(0x9d),
|
||||
SWAP14(0x9d, 15),
|
||||
/** (0x9e) Exchange 16th item from stack with the top */
|
||||
SWAP15(0x9e),
|
||||
SWAP15(0x9e, 16),
|
||||
/** (0x9f) Exchange 17th item from stack with the top */
|
||||
SWAP16(0x9f),
|
||||
SWAP16(0x9f, 17),
|
||||
|
||||
/* System operations */
|
||||
|
||||
/** (0xf0) Create a new account with associated code */
|
||||
CREATE(0xf0), // [in_size] [in_offs] [gas_val] CREATE
|
||||
CREATE(0xf0, 3), // [in_size] [in_offs] [gas_val] CREATE
|
||||
/** (cxf1) Message-call into an account */
|
||||
CALL(0xf1), // [out_data_size] [out_data_start] [in_data_size] [in_data_start] [value] [to_addr] [gas] CALL
|
||||
CALL(0xf1, 7), // [out_data_size] [out_data_start] [in_data_size] [in_data_start] [value] [to_addr] [gas] CALL
|
||||
/** (0xf2) Halt execution returning output data */
|
||||
RETURN(0xf2),
|
||||
RETURN(0xf2, 2),
|
||||
/** (0xf3) Calls self, but grabbing the code from the
|
||||
* TO argument instead of from one's own address */
|
||||
CALLCODE(0xf3),
|
||||
CALLCODE(0xf3, 7),
|
||||
/** (0xff) Halt execution and register account for
|
||||
* later deletion */
|
||||
SUICIDE(0xff);
|
||||
SUICIDE(0xff, 1);
|
||||
|
||||
private byte opcode;
|
||||
private int require;
|
||||
|
||||
private static final Map<Byte, OpCode> intToTypeMap = new HashMap<>();
|
||||
private static final Map<String, Byte> stringToByteMap = new HashMap<>();
|
||||
|
@ -318,13 +319,23 @@ public enum OpCode {
|
|||
}
|
||||
}
|
||||
|
||||
private OpCode(int op) {
|
||||
private OpCode(int op, int require) {
|
||||
this.opcode = (byte) op;
|
||||
this.require = require;
|
||||
}
|
||||
|
||||
public byte val() {
|
||||
return opcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mininum amount of items required on the stack for this operation
|
||||
*
|
||||
* @return minimum amount of expected items on the stack
|
||||
*/
|
||||
public int require() {
|
||||
return require;
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return opcode;
|
||||
|
|
|
@ -24,8 +24,9 @@ import java.util.Stack;
|
|||
*/
|
||||
public class Program {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("VM");
|
||||
private Logger gasLogger = LoggerFactory.getLogger("gas");
|
||||
private static final Logger logger = LoggerFactory.getLogger("VM");
|
||||
private static final Logger gasLogger = LoggerFactory.getLogger("gas");
|
||||
|
||||
private int invokeHash;
|
||||
private ProgramListener listener;
|
||||
|
||||
|
@ -55,6 +56,12 @@ public class Program {
|
|||
}
|
||||
}
|
||||
|
||||
public byte getOp(int pc) {
|
||||
if (ops.length <= pc)
|
||||
return 0;
|
||||
return ops[pc];
|
||||
}
|
||||
|
||||
public byte getCurrentOp() {
|
||||
if(ops.length == 0)
|
||||
return 0;
|
||||
|
@ -93,9 +100,12 @@ public class Program {
|
|||
}
|
||||
|
||||
public void setPC(DataWord pc) {
|
||||
this.setPC(pc.intValue());
|
||||
}
|
||||
|
||||
this.pc = pc.intValue();
|
||||
|
||||
public void setPC(int pc) {
|
||||
this.pc = pc;
|
||||
|
||||
if (this.pc == ops.length)
|
||||
stop();
|
||||
|
||||
|
@ -105,10 +115,6 @@ public class Program {
|
|||
}
|
||||
}
|
||||
|
||||
public void setPC(int pc) {
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
public boolean isStopped() {
|
||||
return stopped;
|
||||
}
|
||||
|
@ -130,7 +136,7 @@ public class Program {
|
|||
|
||||
if (pc + n > ops.length) {
|
||||
stop();
|
||||
throw new RuntimeException("pc overflow sweep n: " + n + " pc: " + pc);
|
||||
throw new PcOverflowException("pc overflow sweep n: " + n + " pc: " + pc);
|
||||
}
|
||||
|
||||
byte[] data = Arrays.copyOfRange(ops, pc, pc + n);
|
||||
|
@ -257,12 +263,12 @@ public class Program {
|
|||
public void createContract(DataWord value, DataWord memStart, DataWord memSize) {
|
||||
|
||||
// [1] FETCH THE CODE FROM THE MEMORY
|
||||
ByteBuffer programCode = memoryChunk(memStart, memSize);
|
||||
byte[] programCode = memoryChunk(memStart, memSize).array();
|
||||
|
||||
byte[] senderAddress = this.getOwnerAddress().getLast20Bytes();
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("creating a new contract inside contract run: [{}]", Hex.toHexString(senderAddress));
|
||||
|
||||
|
||||
// actual gas subtract
|
||||
DataWord gasLimit = this.getGas();
|
||||
this.spendGas(gasLimit.longValue(), "internal call");
|
||||
|
@ -272,16 +278,12 @@ public class Program {
|
|||
byte[] newAddress = HashUtil.calcNewAddr(this.getOwnerAddress().getLast20Bytes(), nonce);
|
||||
result.getRepository().createAccount(newAddress);
|
||||
|
||||
// [3] UPDATE THE NONCE
|
||||
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
|
||||
result.getRepository().increaseNonce(senderAddress);
|
||||
|
||||
if (invokeData.byTestingSuite()) {
|
||||
// This keeps track of the contracts created for a test
|
||||
this.getResult().addCallCreate(programCode.array(), newAddress,
|
||||
gasLimit.getNoLeadZeroesData(),
|
||||
value.getNoLeadZeroesData());
|
||||
}
|
||||
if (invokeData.byTestingSuite()) {
|
||||
// This keeps track of the contracts created for a test
|
||||
this.getResult().addCallCreate(programCode, newAddress,
|
||||
gasLimit.getNoLeadZeroesData(),
|
||||
value.getNoLeadZeroesData());
|
||||
}
|
||||
|
||||
// [4] TRANSFER THE BALANCE
|
||||
BigInteger endowment = value.value();
|
||||
|
@ -291,23 +293,32 @@ public class Program {
|
|||
return;
|
||||
}
|
||||
result.getRepository().addBalance(senderAddress, endowment.negate());
|
||||
result.getRepository().addBalance(newAddress, endowment);
|
||||
BigInteger newBalance = result.getRepository().addBalance(newAddress, endowment);
|
||||
|
||||
Repository trackRepository = result.getRepository().getTrack();
|
||||
trackRepository.startTracking();
|
||||
|
||||
// [3] UPDATE THE NONCE
|
||||
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
|
||||
trackRepository.increaseNonce(senderAddress);
|
||||
|
||||
// [5] COOK THE INVOKE AND EXECUTE
|
||||
ProgramInvoke programInvoke =
|
||||
ProgramInvokeFactory.createProgramInvoke(this, new DataWord(newAddress), DataWord.ZERO,
|
||||
gasLimit, BigInteger.ZERO, null, trackRepository, this.invokeData.getCallDeep() + 1);
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(programCode.array(), programInvoke);
|
||||
vm.play(program);
|
||||
ProgramResult result = program.getResult();
|
||||
this.result.addDeleteAccounts(result.getDeleteAccounts());
|
||||
|
||||
if (result.getException() != null &&
|
||||
ProgramInvoke programInvoke = ProgramInvokeFactory.createProgramInvoke(
|
||||
this, new DataWord(newAddress), DataWord.ZERO, gasLimit,
|
||||
newBalance, null, trackRepository);
|
||||
|
||||
ProgramResult result = null;
|
||||
|
||||
if (programCode != null && programCode.length != 0) {
|
||||
VM vm = new VM();
|
||||
Program program = new Program(programCode, programInvoke);
|
||||
vm.play(program);
|
||||
result = program.getResult();
|
||||
this.result.addDeleteAccounts(result.getDeleteAccounts());
|
||||
}
|
||||
|
||||
if (result != null &&
|
||||
result.getException() != null &&
|
||||
result.getException() instanceof Program.OutOfGasException) {
|
||||
logger.info("contract run halted by OutOfGas: new contract init ={}" , Hex.toHexString(newAddress));
|
||||
|
||||
|
@ -319,17 +330,18 @@ public class Program {
|
|||
// 4. CREATE THE CONTRACT OUT OF RETURN
|
||||
byte[] code = result.getHReturn().array();
|
||||
trackRepository.saveCode(newAddress, code);
|
||||
|
||||
trackRepository.commit();
|
||||
|
||||
// IN SUCCESS PUSH THE ADDRESS INTO THE STACK
|
||||
stackPush(new DataWord(newAddress));
|
||||
trackRepository.commit();
|
||||
|
||||
|
||||
// 5. REFUND THE REMAIN GAS
|
||||
|
||||
long refundGas = gasLimit.longValue() - result.getGasUsed();
|
||||
if (refundGas > 0) {
|
||||
this.refundGas(refundGas, "remain gas from the internal call");
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("The remaining gas is refunded, account: [{}], gas: [{}] ",
|
||||
if (gasLogger.isInfoEnabled()) {
|
||||
gasLogger.info("The remaining gas is refunded, account: [{}], gas: [{}] ",
|
||||
Hex.toHexString(this.getOwnerAddress().getLast20Bytes()),
|
||||
refundGas);
|
||||
}
|
||||
|
@ -346,7 +358,7 @@ public class Program {
|
|||
*/
|
||||
public void callToAddress(MessageCall msg) {
|
||||
|
||||
ByteBuffer data = memoryChunk(msg.getInDataOffs(), msg.getInDataSize());
|
||||
byte[] data = memoryChunk(msg.getInDataOffs(), msg.getInDataSize()).array();
|
||||
|
||||
// FETCH THE SAVED STORAGE
|
||||
byte[] codeAddress = msg.getCodeAddress().getLast20Bytes();
|
||||
|
@ -363,12 +375,12 @@ public class Program {
|
|||
// 2.1 PERFORM THE GAS VALUE TX
|
||||
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
|
||||
if (this.getGas().longValue() - msg.getGas().longValue() < 0 ) {
|
||||
logger.info("No gas for the internal call, \n" +
|
||||
gasLogger.info("No gas for the internal call, \n" +
|
||||
"fromAddress={}, codeAddress={}",
|
||||
Hex.toHexString(senderAddress), Hex.toHexString(codeAddress));
|
||||
throw new OutOfGasException();
|
||||
}
|
||||
|
||||
|
||||
BigInteger endowment = msg.getEndowment().value();
|
||||
BigInteger senderBalance = result.getRepository().getBalance(senderAddress);
|
||||
if (senderBalance.compareTo(endowment) < 0) {
|
||||
|
@ -377,11 +389,10 @@ public class Program {
|
|||
}
|
||||
result.getRepository().addBalance(senderAddress, endowment.negate());
|
||||
BigInteger contextBalance = result.getRepository().addBalance(contextAddress, endowment);
|
||||
|
||||
|
||||
if (invokeData.byTestingSuite()) {
|
||||
// This keeps track of the calls created for a test
|
||||
this.getResult().addCallCreate(data.array(),
|
||||
contextAddress,
|
||||
this.getResult().addCallCreate(data, contextAddress,
|
||||
msg.getGas().getNoLeadZeroesData(),
|
||||
msg.getEndowment().getNoLeadZeroesData());
|
||||
}
|
||||
|
@ -393,9 +404,8 @@ public class Program {
|
|||
trackRepository.startTracking();
|
||||
|
||||
ProgramInvoke programInvoke = ProgramInvokeFactory.createProgramInvoke(
|
||||
this, new DataWord(contextAddress), msg.getEndowment(), msg.getGas(),
|
||||
contextBalance, data.array(), trackRepository,
|
||||
this.invokeData.getCallDeep() + 1);
|
||||
this, new DataWord(contextAddress), msg.getEndowment(),
|
||||
msg.getGas(), contextBalance, data, trackRepository);
|
||||
|
||||
ProgramResult result = null;
|
||||
|
||||
|
@ -410,7 +420,7 @@ public class Program {
|
|||
if (result != null &&
|
||||
result.getException() != null &&
|
||||
result.getException() instanceof Program.OutOfGasException) {
|
||||
logger.info("contract run halted by OutOfGas: contract={}" , Hex.toHexString(contextAddress));
|
||||
gasLogger.info("contract run halted by OutOfGas: contract={}" , Hex.toHexString(contextAddress));
|
||||
|
||||
trackRepository.rollback();
|
||||
stackPushZero();
|
||||
|
@ -438,10 +448,12 @@ public class Program {
|
|||
// 5. REFUND THE REMAIN GAS
|
||||
if (result != null) {
|
||||
BigInteger refundGas = msg.getGas().value().subtract(BigInteger.valueOf(result.getGasUsed()));
|
||||
if (refundGas.compareTo(BigInteger.ZERO) == 1) {
|
||||
if (refundGas.signum() == 1) {
|
||||
this.refundGas(refundGas.longValue(), "remaining gas from the internal call");
|
||||
logger.info("The remaining gas refunded, account: [{}], gas: [{}] ",
|
||||
Hex.toHexString(senderAddress), refundGas.toString());
|
||||
if(gasLogger.isInfoEnabled())
|
||||
gasLogger.info("The remaining gas refunded, account: [{}], gas: [{}] ",
|
||||
Hex.toHexString(senderAddress),
|
||||
refundGas.toString());
|
||||
}
|
||||
} else {
|
||||
this.refundGas(msg.getGas().longValue(), "remaining gas from the internal call");
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.ethereum.core.Block;
|
|||
import org.ethereum.core.Transaction;
|
||||
import org.ethereum.facade.Repository;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.util.ByteUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
@ -18,8 +19,16 @@ import java.math.BigInteger;
|
|||
*/
|
||||
public class ProgramInvokeFactory {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger("VM");
|
||||
private static final Logger logger = LoggerFactory.getLogger("VM");
|
||||
|
||||
/**
|
||||
* This attribute defines the number of resursive calls allowed in the EVM
|
||||
* Note: For the JVM to reach this level without a StackOverflow exception,
|
||||
* ethereumj may need to be started with a JVM argument to increase
|
||||
* the stack size. For example: -Xss10m
|
||||
*/
|
||||
private static final int MAX_CREATE_CALL_DEPTH = 1024;
|
||||
|
||||
// Invocation by the wire tx
|
||||
public static ProgramInvoke createProgramInvoke(Transaction tx, Block block, Repository repository) {
|
||||
|
||||
|
@ -28,7 +37,7 @@ public class ProgramInvokeFactory {
|
|||
|
||||
/*** ADDRESS op ***/
|
||||
// YP: Get address of currently executing account.
|
||||
byte[] address = (tx.isContractCreation())? tx.getContractAddress(): tx.getReceiveAddress();
|
||||
byte[] address = tx.isContractCreation() ? tx.getContractAddress(): tx.getReceiveAddress();
|
||||
|
||||
/*** ORIGIN op ***/
|
||||
// YP: This is the sender of original transaction; it is never a contract.
|
||||
|
@ -53,8 +62,7 @@ public class ProgramInvokeFactory {
|
|||
/*** CALLDATALOAD op ***/
|
||||
/*** CALLDATACOPY op ***/
|
||||
/*** CALLDATASIZE op ***/
|
||||
byte[] data = tx.getData();
|
||||
if (data == null) data = new byte[]{};
|
||||
byte[] data = tx.getData() == null ? ByteUtil.EMPTY_BYTE_ARRAY : tx.getData();
|
||||
|
||||
/*** PREVHASH op ***/
|
||||
byte[] lastHash = lastBlock.getHash();
|
||||
|
@ -122,7 +130,7 @@ public class ProgramInvokeFactory {
|
|||
public static ProgramInvoke createProgramInvoke(Program program, DataWord toAddress,
|
||||
DataWord inValue, DataWord inGas,
|
||||
BigInteger balanceInt, byte[] dataIn,
|
||||
Repository repository, int callDeep) {
|
||||
Repository repository) {
|
||||
|
||||
DataWord address = toAddress;
|
||||
DataWord origin = program.getOriginAddress();
|
||||
|
@ -174,9 +182,14 @@ public class ProgramInvokeFactory {
|
|||
Hex.toHexString(difficulty.getNoLeadZeroesData()),
|
||||
gasLimit.longValue());
|
||||
}
|
||||
|
||||
int newCallDepth = program.invokeData.getCallDeep() + 1;
|
||||
if (newCallDepth >= MAX_CREATE_CALL_DEPTH) {
|
||||
throw program.new OutOfGasException();
|
||||
}
|
||||
|
||||
return new ProgramInvokeImpl(address, origin, caller, balance, gasPrice, gas, callValue,
|
||||
data, lastHash, coinbase, timestamp, number, difficulty, gasLimit,
|
||||
repository, callDeep);
|
||||
repository, newCallDepth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,23 +63,16 @@ public class ProgramResult {
|
|||
this.repository = repository;
|
||||
}
|
||||
|
||||
public void addDeleteAccount(DataWord address){
|
||||
|
||||
if (deleteAccounts == null){
|
||||
public void addDeleteAccount(DataWord address) {
|
||||
if (deleteAccounts == null)
|
||||
deleteAccounts = new ArrayList<>();
|
||||
}
|
||||
|
||||
deleteAccounts.add(address);
|
||||
}
|
||||
|
||||
public void addDeleteAccounts(List<DataWord> accounts){
|
||||
|
||||
public void addDeleteAccounts(List<DataWord> accounts) {
|
||||
if (accounts == null) return;
|
||||
|
||||
if (deleteAccounts == null){
|
||||
if (deleteAccounts == null)
|
||||
deleteAccounts = new ArrayList<>();
|
||||
}
|
||||
|
||||
deleteAccounts.addAll(accounts);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ import static org.ethereum.vm.OpCode.PUSH1;
|
|||
*/
|
||||
public class VM {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("VM");
|
||||
private Logger dumpLogger = LoggerFactory.getLogger("dump");
|
||||
private static final Logger logger = LoggerFactory.getLogger("VM");
|
||||
private static final Logger dumpLogger = LoggerFactory.getLogger("dump");
|
||||
private static BigInteger _32_ = BigInteger.valueOf(32);
|
||||
private static String logString = "[{}]\t Op: [{}] Gas: [{}] Deep: [{}] Hint: [{}]";
|
||||
|
||||
|
@ -94,6 +94,8 @@ public class VM {
|
|||
long gasBefore = program.getGas().longValue();
|
||||
int stepBefore = program.getPC();
|
||||
|
||||
program.stackRequire(op.require());
|
||||
|
||||
// Calculate fees and spend gas
|
||||
switch (op) {
|
||||
case STOP: case SUICIDE:
|
||||
|
@ -101,7 +103,6 @@ public class VM {
|
|||
gasCost = GasCost.STOP;
|
||||
break;
|
||||
case SSTORE:
|
||||
program.stackRequire(2);
|
||||
DataWord newValue = stack.get(stack.size()-2);
|
||||
DataWord oldValue = program.storageLoad(stack.peek());
|
||||
if (oldValue == null && !newValue.isZero())
|
||||
|
@ -120,40 +121,31 @@ public class VM {
|
|||
|
||||
// These all operate on memory and therefore potentially expand it:
|
||||
case MSTORE:
|
||||
program.stackRequire(2);
|
||||
newMemSize = memNeeded(stack.peek(), new DataWord(32));
|
||||
break;
|
||||
case MSTORE8:
|
||||
program.stackRequire(2);
|
||||
newMemSize = memNeeded(stack.peek(), new DataWord(1));
|
||||
break;
|
||||
case MLOAD:
|
||||
program.stackRequire(1);
|
||||
newMemSize = memNeeded(stack.peek(), new DataWord(32));
|
||||
break;
|
||||
case RETURN:
|
||||
program.stackRequire(2);
|
||||
newMemSize = memNeeded(stack.peek(), stack.get(stack.size()-2));
|
||||
break;
|
||||
case SHA3:
|
||||
program.stackRequire(2);
|
||||
gasCost = GasCost.SHA3;
|
||||
newMemSize = memNeeded(stack.peek(), stack.get(stack.size()-2));
|
||||
break;
|
||||
case CALLDATACOPY:
|
||||
program.stackRequire(3);
|
||||
newMemSize = memNeeded(stack.peek(), stack.get(stack.size()-3));
|
||||
break;
|
||||
case CODECOPY:
|
||||
program.stackRequire(3);
|
||||
newMemSize = memNeeded(stack.peek(), stack.get(stack.size()-3));
|
||||
break;
|
||||
case EXTCODECOPY:
|
||||
program.stackRequire(4);
|
||||
newMemSize = memNeeded(stack.get(stack.size()-2), stack.get(stack.size()-4));
|
||||
break;
|
||||
case CALL: case CALLCODE:
|
||||
program.stackRequire(7);
|
||||
gasCost = GasCost.CALL;
|
||||
DataWord callGasWord = stack.get(stack.size()-1);
|
||||
if(callGasWord.compareTo(program.getGas()) == 1) {
|
||||
|
@ -165,7 +157,6 @@ public class VM {
|
|||
newMemSize = in.max(out);
|
||||
break;
|
||||
case CREATE:
|
||||
program.stackRequire(3);
|
||||
gasCost = GasCost.CREATE;
|
||||
newMemSize = memNeeded(stack.get(stack.size()-2), stack.get(stack.size()-3));
|
||||
break;
|
||||
|
@ -202,7 +193,6 @@ public class VM {
|
|||
program.stop();
|
||||
} break;
|
||||
case ADD:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -215,7 +205,6 @@ public class VM {
|
|||
|
||||
} break;
|
||||
case MUL:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -227,7 +216,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SUB:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -239,7 +227,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case DIV:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -251,7 +238,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SDIV:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -263,7 +249,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case MOD:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -275,7 +260,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SMOD:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -287,7 +271,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case EXP:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -299,7 +282,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case NEG:{
|
||||
program.stackRequire(1);
|
||||
DataWord word1 = program.stackPop();
|
||||
word1.negate();
|
||||
|
||||
|
@ -310,7 +292,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case LT:{
|
||||
program.stackRequire(2);
|
||||
// TODO: can be improved by not using BigInteger
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
@ -328,7 +309,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SLT:{
|
||||
program.stackRequire(2);
|
||||
// TODO: can be improved by not using BigInteger
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
@ -346,7 +326,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SGT:{
|
||||
program.stackRequire(2);
|
||||
// TODO: can be improved by not using BigInteger
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
@ -364,7 +343,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case GT:{
|
||||
program.stackRequire(2);
|
||||
// TODO: can be improved by not using BigInteger
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
@ -382,7 +360,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case EQ:{
|
||||
program.stackRequire(2);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -399,7 +376,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case NOT: {
|
||||
program.stackRequire(1);
|
||||
DataWord word1 = program.stackPop();
|
||||
if (word1.isZero()) {
|
||||
word1.getData()[31] = 1;
|
||||
|
@ -417,8 +393,7 @@ public class VM {
|
|||
/**
|
||||
* Bitwise Logic Operations
|
||||
*/
|
||||
case AND:{
|
||||
program.stackRequire(2);
|
||||
case AND:{
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -429,8 +404,7 @@ public class VM {
|
|||
program.stackPush(word1);
|
||||
program.step();
|
||||
} break;
|
||||
case OR: {
|
||||
program.stackRequire(2);
|
||||
case OR: {
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -441,8 +415,7 @@ public class VM {
|
|||
program.stackPush(word1);
|
||||
program.step();
|
||||
} break;
|
||||
case XOR: {
|
||||
program.stackRequire(2);
|
||||
case XOR: {
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
|
||||
|
@ -453,8 +426,7 @@ public class VM {
|
|||
program.stackPush(word1);
|
||||
program.step();
|
||||
} break;
|
||||
case BYTE:{
|
||||
program.stackRequire(2);
|
||||
case BYTE:{
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
DataWord result = null;
|
||||
|
@ -474,7 +446,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case ADDMOD:{
|
||||
program.stackRequire(3);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
DataWord word3 = program.stackPop();
|
||||
|
@ -483,7 +454,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case MULMOD:{
|
||||
program.stackRequire(3);
|
||||
DataWord word1 = program.stackPop();
|
||||
DataWord word2 = program.stackPop();
|
||||
DataWord word3 = program.stackPop();
|
||||
|
@ -495,8 +465,7 @@ public class VM {
|
|||
/**
|
||||
* SHA3
|
||||
*/
|
||||
case SHA3:{
|
||||
program.stackRequire(2);
|
||||
case SHA3:{
|
||||
DataWord memOffsetData = program.stackPop();
|
||||
DataWord lengthData = program.stackPop();
|
||||
ByteBuffer buffer = program.memoryChunk(memOffsetData, lengthData);
|
||||
|
@ -524,7 +493,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case BALANCE:{
|
||||
program.stackRequire(1);
|
||||
DataWord address = program.stackPop();
|
||||
DataWord balance = program.getBalance(address);
|
||||
|
||||
|
@ -563,8 +531,7 @@ public class VM {
|
|||
program.stackPush(callValue);
|
||||
program.step();
|
||||
} break;
|
||||
case CALLDATALOAD:{
|
||||
program.stackRequire(1);
|
||||
case CALLDATALOAD:{
|
||||
DataWord dataOffs = program.stackPop();
|
||||
DataWord value = program.getDataValue(dataOffs);
|
||||
|
||||
|
@ -583,8 +550,7 @@ public class VM {
|
|||
program.stackPush(dataSize);
|
||||
program.step();
|
||||
} break;
|
||||
case CALLDATACOPY:{
|
||||
program.stackRequire(3);
|
||||
case CALLDATACOPY:{
|
||||
DataWord memOffsetData = program.stackPop();
|
||||
DataWord dataOffsetData = program.stackPop();
|
||||
DataWord lengthData = program.stackPop();
|
||||
|
@ -603,7 +569,6 @@ public class VM {
|
|||
if (op == OpCode.CODESIZE)
|
||||
length = program.getCode().length;
|
||||
else {
|
||||
program.stackRequire(1);
|
||||
DataWord address = program.stackPop();
|
||||
length = program.getCodeAt(address).length;
|
||||
}
|
||||
|
@ -624,18 +589,20 @@ public class VM {
|
|||
fullCode = program.getCodeAt(address);
|
||||
}
|
||||
|
||||
DataWord memOffsetData = program.stackPop();
|
||||
DataWord codeOffsetData = program.stackPop();
|
||||
DataWord lengthData = program.stackPop();
|
||||
DataWord memOffsetData = program.stackPop();
|
||||
BigInteger codeOffsetData = program.stackPop().value();
|
||||
BigInteger lengthData = program.stackPop().value();
|
||||
|
||||
int length = lengthData.intValue();
|
||||
int codeOffset = codeOffsetData.intValue();
|
||||
|
||||
if (fullCode == null || fullCode.length < length + codeOffset) {
|
||||
if (fullCode == null
|
||||
|| BigInteger.valueOf(fullCode.length).compareTo(
|
||||
codeOffsetData.add(lengthData)) < 0) {
|
||||
program.stop();
|
||||
break;
|
||||
}
|
||||
|
||||
int length = lengthData.intValue();
|
||||
int codeOffset = codeOffsetData.intValue();
|
||||
|
||||
byte[] codeCopy = new byte[length];
|
||||
System.arraycopy(fullCode, codeOffset, codeCopy, 0, length);
|
||||
|
||||
|
@ -713,7 +680,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case POP:{
|
||||
program.stackRequire(1);
|
||||
program.stackPop();
|
||||
program.step();
|
||||
} break;
|
||||
|
@ -723,7 +689,6 @@ public class VM {
|
|||
case DUP13: case DUP14: case DUP15: case DUP16:{
|
||||
|
||||
int n = op.val() - OpCode.DUP1.val() + 1;
|
||||
program.stackRequire(n);
|
||||
DataWord word_1 = stack.get(stack.size() - n);
|
||||
program.stackPush(word_1.clone());
|
||||
program.step();
|
||||
|
@ -735,7 +700,6 @@ public class VM {
|
|||
case SWAP13: case SWAP14: case SWAP15: case SWAP16:{
|
||||
|
||||
int n = op.val() - OpCode.SWAP1.val() + 2;
|
||||
program.stackRequire(n);
|
||||
DataWord word_1 = stack.peek();
|
||||
stack.set(stack.size() - 1, stack.get(stack.size() - n));
|
||||
stack.set(stack.size() - n, word_1);
|
||||
|
@ -743,7 +707,6 @@ public class VM {
|
|||
|
||||
} break;
|
||||
case MLOAD:{
|
||||
program.stackRequire(1);
|
||||
DataWord addr = program.stackPop();
|
||||
DataWord data = program.memoryLoad(addr);
|
||||
|
||||
|
@ -754,7 +717,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case MSTORE:{
|
||||
program.stackRequire(2);
|
||||
DataWord addr = program.stackPop();
|
||||
DataWord value = program.stackPop();
|
||||
|
||||
|
@ -765,7 +727,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case MSTORE8:{
|
||||
program.stackRequire(2);
|
||||
DataWord addr = program.stackPop();
|
||||
DataWord value = program.stackPop();
|
||||
byte[] byteVal = {value.getData()[31]};
|
||||
|
@ -773,7 +734,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SLOAD:{
|
||||
program.stackRequire(1);
|
||||
DataWord key = program.stackPop();
|
||||
DataWord val = program.storageLoad(key);
|
||||
|
||||
|
@ -787,7 +747,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case SSTORE:{
|
||||
program.stackRequire(2);
|
||||
DataWord addr = program.stackPop();
|
||||
DataWord value = program.stackPop();
|
||||
|
||||
|
@ -798,32 +757,34 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case JUMP:{
|
||||
program.stackRequire(1);
|
||||
DataWord pos = program.stackPop();
|
||||
// if (!pos.equals(DataWord.ZERO) && OpCode.code(program.getCurrentOp()) != OpCode.JUMPDEST)
|
||||
// throw new BadJumpDestinationException();
|
||||
int nextPC = pos.intValue(); // possible overflow
|
||||
if (nextPC != 0 && program.getOp(nextPC-1) != OpCode.JUMPDEST.val())
|
||||
throw new BadJumpDestinationException();
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
hint = "~> " + pos.value();
|
||||
hint = "~> " + nextPC;
|
||||
|
||||
program.setPC(nextPC);
|
||||
|
||||
program.setPC(pos);
|
||||
} break;
|
||||
case JUMPI:{
|
||||
program.stackRequire(2);
|
||||
DataWord pos = program.stackPop();
|
||||
DataWord cond = program.stackPop();
|
||||
// if (!pos.isZero() && OpCode.code(program.getCurrentOp()) != OpCode.JUMPDEST)
|
||||
// throw new BadJumpDestinationException();
|
||||
|
||||
|
||||
if (!cond.isZero()) {
|
||||
program.setPC(pos);
|
||||
int nextPC = pos.intValue(); // possible overflow
|
||||
if (nextPC != 0 && program.getOp(nextPC-1) != OpCode.JUMPDEST.val())
|
||||
throw new BadJumpDestinationException();
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
hint = "~> " + nextPC;
|
||||
|
||||
program.setPC(nextPC);
|
||||
} else {
|
||||
program.step();
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
hint = "~> " + program.getPC();
|
||||
|
||||
|
||||
} break;
|
||||
case PC:{
|
||||
int pc = program.getPC();
|
||||
|
@ -868,9 +829,9 @@ public class VM {
|
|||
program.stackPush(data);
|
||||
} break;
|
||||
case JUMPDEST:{
|
||||
program.step();
|
||||
} break;
|
||||
case CREATE:{
|
||||
program.stackRequire(3);
|
||||
DataWord value = program.stackPop();
|
||||
DataWord inOffset = program.stackPop();
|
||||
DataWord inSize = program.stackPop();
|
||||
|
@ -887,7 +848,7 @@ public class VM {
|
|||
} break;
|
||||
case CALL: case CALLCODE: {
|
||||
DataWord gas = program.stackPop();
|
||||
DataWord codeAddress = program.stackPop();
|
||||
DataWord codeAddress = program.stackPop();
|
||||
DataWord value = program.stackPop();
|
||||
|
||||
DataWord inDataOffs = program.stackPop();
|
||||
|
@ -916,7 +877,6 @@ public class VM {
|
|||
program.step();
|
||||
} break;
|
||||
case RETURN:{
|
||||
program.stackRequire(2);
|
||||
DataWord offset = program.stackPop();
|
||||
DataWord size = program.stackPop();
|
||||
|
||||
|
@ -932,7 +892,6 @@ public class VM {
|
|||
program.stop();
|
||||
} break;
|
||||
case SUICIDE:{
|
||||
program.stackRequire(1);
|
||||
DataWord address = program.stackPop();
|
||||
program.suicide(address);
|
||||
|
||||
|
@ -953,12 +912,9 @@ public class VM {
|
|||
|
||||
vmCounter++;
|
||||
} catch (RuntimeException e) {
|
||||
if(e instanceof OutOfGasException) {
|
||||
logger.warn("OutOfGasException occurred", e);
|
||||
if(e instanceof OutOfGasException)
|
||||
program.spendAllGas();
|
||||
}
|
||||
else
|
||||
logger.error("VM halted", e);
|
||||
logger.warn("VM halted", e.getMessage());
|
||||
program.stop();
|
||||
throw e;
|
||||
}
|
||||
|
@ -981,8 +937,8 @@ public class VM {
|
|||
program.setRuntimeFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Utility to calculate new total memory size needed for an operation.
|
||||
* <br/> Basically just offset + size, unless size is 0, in which case the result is also 0.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
|
||||
/**
|
||||
* Test file specific for tests maintained in the GitHub repository
|
||||
* by the Ethereum DEV team. <br/>
|
||||
*
|
||||
* @see <a href="https://github.com/ethereum/tests/">https://github.com/ethereum/tests/</a>
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses({
|
||||
GitHubVMTest.class,
|
||||
GitHubRandomTest.class
|
||||
})
|
||||
public class GitHubJSONTestSuite {
|
||||
|
||||
protected static void runGitHubJsonTest(String json) throws ParseException {
|
||||
Assume.assumeFalse("Online test is not available", json.equals(""));
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testSuiteObj = (JSONObject)parser.parse(json);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testSuiteObj);
|
||||
Iterator<TestCase> testIterator = testSuite.iterator();
|
||||
|
||||
while (testIterator.hasNext()){
|
||||
|
||||
TestCase testCase = testIterator.next();
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestCase(testCase);
|
||||
Assert.assertTrue(result.isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test file specific for tests maintained in the GitHub repository
|
||||
* by the Ethereum DEV team. <br/>
|
||||
*
|
||||
* @see <a href="https://github.com/ethereum/tests/">https://github.com/ethereum/tests/</a>
|
||||
*/
|
||||
public class GitHubJSONTestSuiteTest {
|
||||
|
||||
@Test // testing full suite
|
||||
public void testArithmeticFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmArithmeticTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testBitwiseLogicOperationFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmBitwiseLogicOperationTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testBlockInfoFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmBlockInfoTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testEnvironmentalInfoFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmEnvironmentalInfoTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testIOandFlowOperationsFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmIOandFlowOperationsTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testPushDupSwapFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmPushDupSwapTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testShaFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmSha3Test.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testSystemOperationsFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmSystemOperationsTest.json");
|
||||
runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
private void runGitHubJsonTest(String json) throws ParseException {
|
||||
Assume.assumeFalse("Online test is not available", json.equals(""));
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testSuiteObj = (JSONObject)parser.parse(json);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testSuiteObj);
|
||||
Iterator<TestCase> testIterator = testSuite.iterator();
|
||||
|
||||
while (testIterator.hasNext()){
|
||||
|
||||
TestCase testCase = testIterator.next();
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestCase(testCase);
|
||||
Assert.assertTrue(result.isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class GitHubRandomTest {
|
||||
|
||||
@Test // testing full suite
|
||||
public void testRandom04FromGitHub() throws ParseException {
|
||||
String json = JSONReader.loadJSON("randomTests/201410211705.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testRandom06FromGitHub() throws ParseException {
|
||||
String json = JSONReader.loadJSON("randomTests/201410211708.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class GitHubVMTest {
|
||||
|
||||
@Test // testing full suite
|
||||
public void testArithmeticFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmArithmeticTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testBitwiseLogicOperationFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmBitwiseLogicOperationTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testBlockInfoFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmBlockInfoTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testEnvironmentalInfoFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmEnvironmentalInfoTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testIOandFlowOperationsFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmIOandFlowOperationsTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testPushDupSwapFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmPushDupSwapTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testShaFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmSha3Test.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
|
||||
@Test // testing full suite
|
||||
public void testSystemOperationsFromGitHub() throws ParseException {
|
||||
|
||||
String json = JSONReader.loadJSON("vmtests/vmSystemOperationsTest.json");
|
||||
GitHubJSONTestSuite.runGitHubJsonTest(json);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,8 @@ import java.nio.file.Files;
|
|||
public class JSONReader {
|
||||
|
||||
public static String loadJSON(String filename) {
|
||||
String json = getFromUrl("https://raw.githubusercontent.com/ethereum/tests/master/vmtests/" + filename);
|
||||
// return getFromLocal(filename);
|
||||
String json = getFromUrl("https://raw.githubusercontent.com/ethereum/tests/develop/" + filename);
|
||||
return json == "" ? json = getFromLocal(filename) : json;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
import org.ethereum.db.ByteArrayWrapper;
|
||||
|
@ -173,110 +168,52 @@ public class LocalJSONTestSuiteTest {
|
|||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestCase(testCase);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
|
||||
}
|
||||
|
||||
@Test // TestCase file: vmtest-1.json //
|
||||
public void test6() throws ParseException, IOException, URISyntaxException {
|
||||
|
||||
String testSrc = JSONReader.getFromLocal("vmtest-1.json");
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(testSrc);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
public void test6() {
|
||||
String vmtest = JSONReader.getFromLocal("vmtest-1.json");
|
||||
runTest(vmtest);
|
||||
}
|
||||
|
||||
|
||||
@Test // TestCase file: vmtest-2.json //
|
||||
public void test7() throws ParseException, IOException, URISyntaxException {
|
||||
|
||||
URL vmtest = ClassLoader
|
||||
.getSystemResource("jsontestsuite/vmtest-2.json");
|
||||
|
||||
File vmTestFile = new File(vmtest.toURI());
|
||||
byte[] testData = Files.readAllBytes(vmTestFile.toPath());
|
||||
String testSrc = new String(testData);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(testSrc);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
public void test7() {
|
||||
String vmtest = JSONReader.getFromLocal("vmtest-2.json");
|
||||
runTest(vmtest);
|
||||
}
|
||||
|
||||
@Test // TestCase file: vmtest-3.json //
|
||||
public void test8() throws ParseException, IOException, URISyntaxException {
|
||||
|
||||
URL vmtest = ClassLoader
|
||||
.getSystemResource("jsontestsuite/vmtest-3.json");
|
||||
|
||||
File vmTestFile = new File(vmtest.toURI());
|
||||
byte[] testData = Files.readAllBytes(vmTestFile.toPath());
|
||||
String testSrc = new String(testData);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(testSrc);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
@Test // TestCase file: vmtest-4.json //
|
||||
public void test9() throws ParseException, IOException, URISyntaxException {
|
||||
|
||||
URL vmtest = ClassLoader
|
||||
.getSystemResource("jsontestsuite/vmtest-4.json");
|
||||
|
||||
File vmTestFile = new File(vmtest.toURI());
|
||||
byte[] testData = Files.readAllBytes(vmTestFile.toPath());
|
||||
String testSrc = new String(testData);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(testSrc);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
public void test8() {
|
||||
String vmtest = JSONReader.getFromLocal("vmtest-3.json");
|
||||
runTest(vmtest);
|
||||
}
|
||||
|
||||
@Test // TestCase file: vmtest-4.json //
|
||||
public void test10() throws ParseException, IOException, URISyntaxException {
|
||||
public void test9() {
|
||||
String vmtest = JSONReader.getFromLocal("vmtest-4.json");
|
||||
runTest(vmtest);
|
||||
}
|
||||
|
||||
URL vmtest = ClassLoader
|
||||
.getSystemResource("jsontestsuite/vmtest-5.json");
|
||||
|
||||
File vmTestFile = new File(vmtest.toURI());
|
||||
byte[] testData = Files.readAllBytes(vmTestFile.toPath());
|
||||
String testSrc = new String(testData);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(testSrc);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
@Test // TestCase file: vmtest-5.json //
|
||||
public void test10() {
|
||||
String vmtest = JSONReader.getFromLocal("vmtest-5.json");
|
||||
runTest(vmtest);
|
||||
}
|
||||
|
||||
private void runTest(String vmtest) {
|
||||
try {
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject testCaseJSONObj = (JSONObject)parser.parse(vmtest);
|
||||
|
||||
TestSuite testSuite = new TestSuite(testCaseJSONObj);
|
||||
|
||||
TestRunner runner = new TestRunner();
|
||||
List<String> result = runner.runTestSuite(testSuite);
|
||||
|
||||
Assert.assertTrue(result.size() == 0);
|
||||
} catch (ParseException e) {
|
||||
Assert.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class VMComplexTest {
|
|||
// Set contract into Database
|
||||
String callerAddr = "cd2a3d9f938e13cd947ec05abc7fe734df8dd826";
|
||||
String contractAddr = "77045e71a7a2c50903d88e564cd72fab11e82051";
|
||||
String code = "6103e75660005460006000530b0f630000004b596001600053036103e757600060006000600060007377045e71a7a2c50903d88e564cd72fab11e820516008600a5c0402f1630000004c5800";
|
||||
String code = "6103e75660005460006000530b0f630000004c596001600053036103e757600060006000600060007377045e71a7a2c50903d88e564cd72fab11e820516008600a5c0402f1630000004c585d00";
|
||||
|
||||
byte[] contractAddrB = Hex.decode(contractAddr);
|
||||
byte[] callerAddrB = Hex.decode(callerAddr);
|
||||
|
|
|
@ -0,0 +1,561 @@
|
|||
package org.ethereum.vm;
|
||||
|
||||
import org.ethereum.vm.Program.OutOfGasException;
|
||||
import org.ethereum.vm.Program.StackTooSmallException;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* www.ethereumJ.com
|
||||
* @author: Roman Mandeleil
|
||||
* Created on: 01/06/2014 11:05
|
||||
*/
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class VMCustomTest {
|
||||
|
||||
private ProgramInvokeMockImpl invoke;
|
||||
private Program program;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
byte[] ownerAddress = Hex.decode("77045E71A7A2C50903D88E564CD72FAB11E82051");
|
||||
byte[] msgData = Hex.decode("00000000000000000000000000000000000000000000000000000000000000A1" +
|
||||
"00000000000000000000000000000000000000000000000000000000000000B1");
|
||||
|
||||
invoke = new ProgramInvokeMockImpl(msgData);
|
||||
invoke.setOwnerAddress(ownerAddress);
|
||||
|
||||
invoke.getRepository().createAccount(ownerAddress);
|
||||
invoke.getRepository().addBalance(ownerAddress, BigInteger.valueOf(1000L));
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
invoke.getRepository().close();
|
||||
}
|
||||
|
||||
@Test // CALLDATASIZE OP
|
||||
public void testCALLDATASIZE_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program = new Program(Hex.decode("36"), invoke);
|
||||
String s_expected_1 = "0000000000000000000000000000000000000000000000000000000000000040";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATALOAD OP
|
||||
public void testCALLDATALOAD_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("600035"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000000000A1";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLDATALOAD OP
|
||||
public void testCALLDATALOAD_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("600235"), invoke);
|
||||
String s_expected_1 = "0000000000000000000000000000000000000000000000000000000000A10000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATALOAD OP
|
||||
public void testCALLDATALOAD_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("602035"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000000000B1";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATALOAD OP
|
||||
public void testCALLDATALOAD_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("602335"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000B1000000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLDATALOAD OP
|
||||
public void testCALLDATALOAD_5() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("603F35"), invoke);
|
||||
String s_expected_1 = "B100000000000000000000000000000000000000000000000000000000000000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test(expected=RuntimeException.class) // CALLDATALOAD OP mal
|
||||
public void testCALLDATALOAD_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("35"), invoke);
|
||||
try {
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
}
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60206000600037"), invoke);
|
||||
String m_expected = "00000000000000000000000000000000000000000000000000000000000000A1";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60406000600037"), invoke);
|
||||
String m_expected = "00000000000000000000000000000000000000000000000000000000000000A1" +
|
||||
"00000000000000000000000000000000000000000000000000000000000000B1";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60406004600037"), invoke);
|
||||
String m_expected = "000000000000000000000000000000000000000000000000000000A100000000" +
|
||||
"000000000000000000000000000000000000000000000000000000B100000000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60406000600437"), invoke);
|
||||
String m_expected = "0000000000000000000000000000000000000000000000000000000000000000" +
|
||||
"000000A100000000000000000000000000000000000000000000000000000000" +
|
||||
"000000B100000000000000000000000000000000000000000000000000000000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_5() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60406000600437"), invoke);
|
||||
String m_expected = "0000000000000000000000000000000000000000000000000000000000000000" +
|
||||
"000000A100000000000000000000000000000000000000000000000000000000" +
|
||||
"000000B100000000000000000000000000000000000000000000000000000000";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test(expected=StackTooSmallException.class) // CALLDATACOPY OP mal
|
||||
public void testCALLDATACOPY_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("6040600037"), invoke);
|
||||
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=OutOfGasException.class) // CALLDATACOPY OP mal
|
||||
public void testCALLDATACOPY_7() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("6020600073CC0929EB16730E7C14FEFC63006AC2D794C5795637"), invoke);
|
||||
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
}
|
||||
|
||||
@Test // ADDRESS OP
|
||||
public void testADDRESS_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program = new Program(Hex.decode("30"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000077045E71A7A2C50903D88E564CD72FAB11E82051";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
program.getResult().getRepository().close();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // BALANCE OP
|
||||
public void testBALANCE_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("3031"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000000003E8";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // ORIGIN OP
|
||||
public void testORIGIN_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("32"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000013978AEE95F38490E9769C39B2773ED763D9CD5F";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLER OP
|
||||
public void testCALLER_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("33"), invoke);
|
||||
String s_expected_1 = "000000000000000000000000885F93EED577F2FC341EBB9A5C9B2CE4465D96C4";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLVALUE OP
|
||||
public void testCALLVALUE_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("34"), invoke);
|
||||
String s_expected_1 = "0000000000000000000000000000000000000000000000000DE0B6B3A7640000";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SHA3 OP
|
||||
public void testSHA3_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("60016000556001600020"), invoke);
|
||||
String s_expected_1 = "5FE7F977E71DBA2EA1A68E21057BEEBB9BE2AC30C6410AA38D4F3FBE41DCFFD2";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SHA3 OP
|
||||
public void testSHA3_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("6102016000546002601E20"), invoke);
|
||||
String s_expected_1 = "114A3FE82A0219FCC31ABD15617966A125F12B0FD3409105FC83B487A9D82DE4";
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test(expected=StackTooSmallException.class) // SHA3 OP mal
|
||||
public void testSHA3_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("610201600054600220"), invoke);
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
}
|
||||
|
||||
@Test // PREVHASH OP
|
||||
public void testPREVHASH_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("40"), invoke);
|
||||
String s_expected_1 = "961CB117ABA86D1E596854015A1483323F18883C2D745B0BC03E87F146D2BB1C";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // COINBASE OP
|
||||
public void testCOINBASE_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("41"), invoke);
|
||||
String s_expected_1 = "000000000000000000000000E559DE5527492BCB42EC68D07DF0742A98EC3F1E";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // TIMESTAMP OP
|
||||
public void testTIMESTAMP_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("42"), invoke);
|
||||
String s_expected_1 = "000000000000000000000000000000000000000000000000000000005387FE24";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // NUMBER OP
|
||||
public void testNUMBER_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("43"), invoke);
|
||||
String s_expected_1 = "0000000000000000000000000000000000000000000000000000000000000021";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // DIFFICULTY OP
|
||||
public void testDIFFICULTY_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("44"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000003ED290";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // GASPRICE OP
|
||||
public void testGASPRICE_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("3A"), invoke);
|
||||
String s_expected_1 = "000000000000000000000000000000000000000000000000000009184E72A000";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // GAS OP
|
||||
public void testGAS_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("5C"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000000F423F";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // GASLIMIT OP
|
||||
public void testGASLIMIT_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program =
|
||||
new Program(Hex.decode("45"), invoke);
|
||||
String s_expected_1 = "00000000000000000000000000000000000000000000000000000000000F4240";
|
||||
|
||||
vm.step(program);
|
||||
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
@Test(expected=Program.IllegalOperationException.class) // INVALID OP
|
||||
public void testINVALID_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
program = new Program(Hex.decode("6001516002"), invoke);
|
||||
String s_expected_1 = "0000000000000000000000000000000000000000000000000000000000000001";
|
||||
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
DataWord item1 = program.stackPop();
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
/* TEST CASE LIST END */
|
||||
|
||||
}
|
||||
|
||||
// TODO: add gas expeted and calculated to all test cases
|
||||
// TODO: considering: G_TXDATA + G_TRANSACTION
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
*
|
||||
* 22) CREATE:
|
||||
* 23) CALL:
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
|
||||
contract creation (gas usage)
|
||||
-----------------------------
|
||||
G_TRANSACTION = (500)
|
||||
60016000546006601160003960066000f261778e600054 (115)
|
||||
PUSH1 6001 (1)
|
||||
PUSH1 6000 (1)
|
||||
MSTORE 54 (1 + 1)
|
||||
PUSH1 6006 (1)
|
||||
PUSH1 6011 (1)
|
||||
PUSH1 6000 (1)
|
||||
CODECOPY 39 (1)
|
||||
PUSH1 6006 (1)
|
||||
PUSH1 6000 (1)
|
||||
RETURN f2 (1)
|
||||
61778e600054
|
||||
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
|
@ -1617,6 +1617,134 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"mul4" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9796",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x8000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mul5" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7f80000000000000000000000000000000000000000000000000000000000000007f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9896",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7f80000000000000000000000000000000000000000000000000000000000000007f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7f80000000000000000000000000000000000000000000000000000000000000007f800000000000000000000000000000000000000000000000000000000000000002600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mul6" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9796",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"neg0" : {
|
||||
"callcreates" : [
|
||||
],
|
|
@ -1128,4 +1128,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -148,7 +148,7 @@
|
|||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9796",
|
||||
"gas" : "9997",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
|
@ -156,7 +156,6 @@
|
|||
"code" : "0x60236007586001600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x02" : "0x23"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -212,6 +211,91 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"jump0_jumpdest0" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x602360085860015d600257",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9796",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x602360085860015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x02" : "0x23"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x602360085860015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jump0_jumpdest1" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x602360075860015d600257",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9997",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x602360075860015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x602360075860015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jumpi0" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
|
@ -233,7 +317,7 @@
|
|||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9795",
|
||||
"gas" : "9996",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
|
@ -241,7 +325,6 @@
|
|||
"code" : "0x602360016009596001600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x02" : "0x23"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -298,6 +381,49 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"jumpi1_jumpdest" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "1000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x60236001600a5960015d600257",
|
||||
"data" : "0x",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9795",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x60236001600a5960015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x02" : "0x23"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x60236001600a5960015d600257",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mloadError0" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
|
@ -1044,7 +1170,7 @@
|
|||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9999",
|
||||
"gas" : "10000",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
|
@ -407,7 +407,7 @@
|
|||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9998",
|
||||
"gas" : "9999",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
|
@ -2555,7 +2555,7 @@
|
|||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "1000000000000000000"
|
||||
},
|
||||
"gas" : "9997",
|
||||
"gas" : "9998",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"ABAcalls" : {
|
||||
"ABAcalls0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
|
@ -63,6 +63,198 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ABAcalls1" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"gasLimit" : "9999999998992",
|
||||
"value" : "24"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x6000600060006000601873945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f15a57",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "898727",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "999999999999999488",
|
||||
"code" : "0x6000600060006000601873945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f15a57",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x25" : "0x01"
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "535",
|
||||
"code" : "0x60006000600060006017730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f16001015a57",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x28" : "0x02"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x6000600060006000601873945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f15a57",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x60006000600060006017730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f16001015a57",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ABAcalls2" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"gasLimit" : "9999999998768",
|
||||
"value" : "1"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "1003475",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "999999999999999488",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "512",
|
||||
"code" : "0x60016000560160005760006000600060006000730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x0200"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "0",
|
||||
"code" : "0x60016000560160005760006000600060006000730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ABAcalls3" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"gasLimit" : "998768",
|
||||
"value" : "1"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"data" : "0x",
|
||||
"gas" : "1000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "864457",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1024558",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01"
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "442",
|
||||
"code" : "0x60016000560160005760006000600060006000730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01b9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1025000",
|
||||
"code" : "0x6001600056016000576000600060006000600173945304eb96065b2a98b57a48a06ae28d285a71b56103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "0",
|
||||
"code" : "0x60016000560160005760006000600060006000730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66103e85c03f1",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ABAcallsSuicide0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
|
@ -175,7 +367,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"CallRecursiveBomb" : {
|
||||
"CallRecursiveBomb0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
|
@ -239,6 +431,156 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"CallRecursiveBomb1" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"gasLimit" : "364267",
|
||||
"value" : "0"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"data" : "0x",
|
||||
"gas" : "364723",
|
||||
"gasPrice" : "1",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "104246",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x03fe",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"CallRecursiveBomb2" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"gasLimit" : "364268",
|
||||
"value" : "0"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"data" : "0x",
|
||||
"gas" : "364724",
|
||||
"gasPrice" : "1",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "104551",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x03ff",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"CallRecursiveBomb3" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"destination" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"gasLimit" : "999544",
|
||||
"value" : "0"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"data" : "0x",
|
||||
"gas" : "1000000",
|
||||
"gasPrice" : "1",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "104551",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x03ff",
|
||||
"0x01" : "0x01"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "20000000",
|
||||
"code" : "0x600160005601600057600060006000600060003060e05c03f1600157",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"CallToNameRegistrator0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
|
@ -279,7 +621,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" : "0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa"
|
||||
|
@ -296,7 +638,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -343,7 +685,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00" : "0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa"
|
||||
|
@ -360,7 +702,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -407,7 +749,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -423,7 +765,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -469,7 +811,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -485,7 +827,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -525,7 +867,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -541,7 +883,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -581,7 +923,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -597,7 +939,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -637,7 +979,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -653,7 +995,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -726,12 +1068,6 @@
|
|||
},
|
||||
"PostToNameRegistrator0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa",
|
||||
"destination" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"gasLimit" : "1000000",
|
||||
"value" : "23"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
|
@ -744,43 +1080,42 @@
|
|||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "9999998999967",
|
||||
"gas" : "9999999999991",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "999999999999999977",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" : "0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -789,12 +1124,6 @@
|
|||
},
|
||||
"PostToReturn1" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa",
|
||||
"destination" : "945304eb96065b2a98b57a48a06ae28d285a71b5",
|
||||
"gasLimit" : "1000000",
|
||||
"value" : "23"
|
||||
}
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
|
@ -807,25 +1136,25 @@
|
|||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "9999998999967",
|
||||
"gas" : "9999999999991",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "999999999999999977",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "46",
|
||||
"balance" : "23",
|
||||
"code" : "0x603760005560026000f2",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
|
@ -835,7 +1164,7 @@
|
|||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa60205460406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -863,7 +1192,7 @@
|
|||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"data" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffafffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa",
|
||||
"gas" : "10000",
|
||||
"gasPrice" : "100000000000000",
|
||||
|
@ -875,7 +1204,7 @@
|
|||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa"
|
||||
|
@ -885,14 +1214,14 @@
|
|||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"callstatelessToNameRegistrator0" : {
|
||||
"callcodeToNameRegistrator0" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa",
|
||||
|
@ -912,7 +1241,7 @@
|
|||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
|
@ -924,7 +1253,7 @@
|
|||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
|
@ -933,7 +1262,7 @@
|
|||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -942,21 +1271,21 @@
|
|||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546000604060406000601773945304eb96065b2a98b57a48a06ae28d285a71b5620f4240f3600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"callstatelessToReturn1" : {
|
||||
"callcodeToReturn1" : {
|
||||
"callcreates" : [
|
||||
{
|
||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa",
|
||||
|
@ -976,7 +1305,7 @@
|
|||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f3600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
|
@ -988,7 +1317,7 @@
|
|||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f3600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x01",
|
||||
|
@ -1006,7 +1335,121 @@
|
|||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f4600057",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546002600060406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f3600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600157603760005560026000f2",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"callstatelessToNameRegistrator0" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "9999999999790",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x80"
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"callstatelessToReturn1" : {
|
||||
"callcreates" : [
|
||||
],
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "256",
|
||||
"currentGasLimit" : "10000000",
|
||||
"currentNumber" : "0",
|
||||
"currentTimestamp" : "1",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"exec" : {
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"data" : "0x",
|
||||
"gas" : "10000000000000",
|
||||
"gasPrice" : "100000000000000",
|
||||
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||
"value" : "100000"
|
||||
},
|
||||
"gas" : "9999999999790",
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
"0x" : "0x80"
|
||||
}
|
||||
},
|
||||
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x6001600157603760005560026000f2",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"pre" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "1000000000000000000",
|
||||
"code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000547faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020546080600057",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1354,7 +1797,7 @@
|
|||
"post" : {
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "1000000000000000023",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1370,7 +1813,7 @@
|
|||
},
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1410,7 +1853,7 @@
|
|||
},
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1426,7 +1869,7 @@
|
|||
},
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1459,7 +1902,7 @@
|
|||
"post" : {
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
|
@ -1475,11 +1918,11 @@
|
|||
},
|
||||
"cd1722f3947def4cf144679da39c4c32bdc35681" : {
|
||||
"balance" : "23",
|
||||
"code" : "0x600035560f6009590060203560003557",
|
||||
"code" : "0x600035560f600a59005d60203560003557",
|
||||
"nonce" : "0",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ log4j.appender.file.RollingPolicy.FileNamePattern=./logs/ethereum_%d{yyyy-MM-dd}
|
|||
# filter noisy classes
|
||||
log4j.logger.block = ERROR
|
||||
log4j.logger.wallet = ERROR
|
||||
log4j.logger.net = DEBUG
|
||||
log4j.logger.wire = DEBUG
|
||||
log4j.logger.net = ERROR
|
||||
log4j.logger.wire = ERROR
|
||||
log4j.logger.db = ERROR
|
||||
log4j.logger.peerdiscovery = ERROR
|
||||
log4j.logger.peermonitor = ERROR
|
||||
|
@ -33,8 +33,8 @@ log4j.logger.io.netty = ERROR
|
|||
log4j.logger.VM = ERROR
|
||||
log4j.logger.main = ERROR
|
||||
log4j.logger.trie = ERROR
|
||||
log4j.logger.state = INFO
|
||||
log4j.logger.repository = INFO
|
||||
log4j.logger.state = ERROR
|
||||
log4j.logger.repository = ERROR
|
||||
log4j.logger.blockchain = INFO
|
||||
log4j.logger.blockqueue = ERROR
|
||||
log4j.logger.txs = ERROR
|
||||
|
|
Loading…
Reference in New Issue