Outline VM log
This commit is contained in:
parent
adc2313308
commit
ac8d2a96f9
|
@ -306,7 +306,7 @@ public class Program {
|
||||||
this.refundGas(refundGas, "remain gas from the internal call");
|
this.refundGas(refundGas, "remain gas from the internal call");
|
||||||
if (logger.isInfoEnabled()){
|
if (logger.isInfoEnabled()){
|
||||||
|
|
||||||
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
|
logger.info("The remaining gas is refunded, account: [ {} ], gas: [ {} ] ",
|
||||||
Hex.toHexString(this.getOwnerAddress().getLast20Bytes()),
|
Hex.toHexString(this.getOwnerAddress().getLast20Bytes()),
|
||||||
refundGas);
|
refundGas);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ public class Program {
|
||||||
* That method implement internal calls
|
* That method implement internal calls
|
||||||
* and code invocations
|
* and code invocations
|
||||||
*
|
*
|
||||||
* @param gas - gas to pay for the call, remain gas will be refunded to the caller
|
* @param gas - gas to pay for the call, remaining gas will be refunded to the caller
|
||||||
* @param toAddressDW - address to call
|
* @param toAddressDW - address to call
|
||||||
* @param endowmentValue - the value that can be transfer along with the code execution
|
* @param endowmentValue - the value that can be transfer along with the code execution
|
||||||
* @param inDataOffs - start of memory to be input data to the call
|
* @param inDataOffs - start of memory to be input data to the call
|
||||||
|
@ -431,13 +431,13 @@ public class Program {
|
||||||
BigInteger refundGas = gas.value().subtract(BigInteger.valueOf(result.getGasUsed()));
|
BigInteger refundGas = gas.value().subtract(BigInteger.valueOf(result.getGasUsed()));
|
||||||
if (refundGas.compareTo(BigInteger.ZERO) == 1) {
|
if (refundGas.compareTo(BigInteger.ZERO) == 1) {
|
||||||
|
|
||||||
this.refundGas(refundGas.intValue(), "remain gas from the internal call");
|
this.refundGas(refundGas.intValue(), "remaining gas from the internal call");
|
||||||
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
|
logger.info("The remaining gas refunded, account: [ {} ], gas: [ {} ] ",
|
||||||
refundGas.toString(), refundGas.toString());
|
Hex.toHexString(senderAddress), refundGas.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.refundGas(gas.intValue(), "remain gas from the internal call");
|
this.refundGas(gas.intValue(), "remaining gas from the internal call");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class VM {
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger("VM");
|
private Logger logger = LoggerFactory.getLogger("VM");
|
||||||
private static BigInteger _32_ = BigInteger.valueOf(32);
|
private static BigInteger _32_ = BigInteger.valueOf(32);
|
||||||
|
private static String logString = "[ {} ]\t Op: [ {} ]\t Gas: [ {} ]\t Deep: [ {} ] Hint: [ {} ]";
|
||||||
|
|
||||||
public void step(Program program) {
|
public void step(Program program) {
|
||||||
|
|
||||||
|
@ -699,10 +700,10 @@ public class VM {
|
||||||
DataWord inSize = program.stackPop();
|
DataWord inSize = program.stackPop();
|
||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]",
|
logger.info(logString, program.getPC(), OpCode.code(op)
|
||||||
program.getPC(), OpCode.code(op).name(), program
|
.name(), program.getGas().longValue(),
|
||||||
.getGas().longValue(), program.invokeData
|
program.invokeData.getCallDeep(), hint);
|
||||||
.getCallDeep(), hint);
|
|
||||||
program.createContract(value, inOffset, inSize);
|
program.createContract(value, inOffset, inSize);
|
||||||
|
|
||||||
program.step();
|
program.step();
|
||||||
|
@ -719,8 +720,8 @@ public class VM {
|
||||||
DataWord outDataSize = program.stackPop();
|
DataWord outDataSize = program.stackPop();
|
||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]" ,program.getPC(),
|
logger.info(logString, program.getPC(), OpCode.code(op)
|
||||||
OpCode.code(op).name(), program.getGas().longValue(),
|
.name(), program.getGas().longValue(),
|
||||||
program.invokeData.getCallDeep(), hint);
|
program.invokeData.getCallDeep(), hint);
|
||||||
|
|
||||||
program.callToAddress(gas, toAddress, value, inDataOffs, inDataSize, outDataOffs, outDataSize);
|
program.callToAddress(gas, toAddress, value, inDataOffs, inDataSize, outDataOffs, outDataSize);
|
||||||
|
@ -751,9 +752,8 @@ public class VM {
|
||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
if (!OpCode.code(op).equals(CALL) && !OpCode.code(op).equals(CREATE))
|
if (!OpCode.code(op).equals(CALL) && !OpCode.code(op).equals(CREATE))
|
||||||
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]",
|
logger.info(logString, stepBefore, OpCode.code(op).name(),
|
||||||
stepBefore, OpCode.code(op).name(), gasBefore, program.invokeData
|
gasBefore, program.invokeData.getCallDeep(), hint);
|
||||||
.getCallDeep(), hint);
|
|
||||||
|
|
||||||
// memory gas calc
|
// memory gas calc
|
||||||
int newMemSize = program.getMemSize();
|
int newMemSize = program.getMemSize();
|
||||||
|
|
Loading…
Reference in New Issue