Add logging for Program and VM

This commit is contained in:
nicksavers 2014-08-06 01:08:04 +02:00
parent 0299d42f39
commit 237d538f52
7 changed files with 15 additions and 12 deletions

View File

@ -42,7 +42,7 @@ public class ContractDetails {
public void put(DataWord key, DataWord value) {
if (value.equals(DataWord.ZERO)){
if (value.equals(DataWord.ZERO)) {
storageTrie.delete(key.getData());
int index = storageKeys.indexOf(key);
@ -50,7 +50,7 @@ public class ContractDetails {
storageKeys.remove(index);
storageValues.remove(index);
}
} else{
} else {
storageTrie.update(key.getData(), RLP.encodeElement(value.getNoLeadZeroesData()));
int index = storageKeys.indexOf(key);

View File

@ -39,8 +39,8 @@ public class JSONHelper {
JSONArray orderFields = new JSONArray();
orderFields.add("address: " + Hex.toHexString(address));
orderFields.add(" nonce: " + (nonce == null ? "00" : Hex.toHexString(nonce)));
orderFields.add(" balance: " + (balance == null ? "00" : Hex.toHexString(balance).toString()));
orderFields.add(" nonce: " + (nonce == null ? "00" : new BigInteger(1, nonce).toString()));
orderFields.add(" balance: " + (balance == null ? "00" : new BigInteger(1, balance).toString()));
orderFields.add(" stateRoot: " + (stateRoot == null ? "" : Hex.toHexString(stateRoot)));
orderFields.add(" codeHash: " + (codeHash == null ? "" : Hex.toHexString(codeHash)));
orderFields.add(" code: " + (code == null ? "" : Hex.toHexString(code)));

View File

@ -11,6 +11,4 @@ public interface TrieFacade {
public void update(byte[] key, byte[] value);
public byte[] get(byte[] key);
public void delete(byte[] key);
public void sync();
}

View File

@ -221,8 +221,9 @@ public class Program {
DataWord balance = getBalance(this.getOwnerAddress());
// 1) pass full endowment to the obtainer
if (logger.isInfoEnabled())
logger.info("Transfer to: [ {} ] heritage: [ {} ]", Hex.toHexString(obtainer.getLast20Bytes())
, balance.longValue());
logger.info("Transfer to: [ {} ] heritage: [ {} ]",
Hex.toHexString(obtainer.getLast20Bytes()),
balance.longValue());
this.result.getRepository().addBalance(obtainer.getLast20Bytes(), balance.value());
this.result.getRepository().addBalance(this.getOwnerAddress().getLast20Bytes(), balance.value().negate());

View File

@ -171,7 +171,7 @@ public class ProgramInvokeFactory {
Hex.toHexString(coinbase.getLast20Bytes()),
timestamp.longValue(),
number.longValue(),
difficulty.longValue(),
Hex.toHexString(difficulty.getNoLeadZeroesData()),
gasLimit.longValue());
}

View File

@ -744,6 +744,10 @@ public class VM {
case SUICIDE:{
DataWord address = program.stackPop();
program.suicide(address);
if (logger.isInfoEnabled())
hint = "address: " + Hex.toHexString(program.getOwnerAddress().getLast20Bytes());
program.stop();
} break;
default:{

View File

@ -81,7 +81,7 @@ samples.dir = samples
# the existing database will be
# destroyed and all the data will be
# downloaded from peers again
database.reset = false
database.reset = true
# place to save physical storage files
database.dir = database
@ -96,7 +96,7 @@ coinbase.secret = monkey
# in JSON form to [dump.dir]
# if [dump.full] = true
# posible values [true/false]
dump.full = false
dump.full = true
dump.dir = dmp
# clean the dump dir each start
@ -105,7 +105,7 @@ dump.clean.on.restart = true
# make changes to tracing options
# starting from certain block
# -1 don't make any tracing changes
trace.startblock = -1
trace.startblock = 1500
# invoke vm program on
# message received,