Adjust tracing calls (#4561)

* Adjust tracing calls

Restore two tracing behaviors in the EVM introduced by the unrolled loop
* change gas only on successful operations
* send post execution call after gas and PC changes.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
pull/4579/head
Danno Ferrin 2 years ago committed by GitHub
parent 3877cd2b84
commit a7383a5f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      evm/src/main/java/org/hyperledger/besu/evm/EVM.java

@ -114,7 +114,6 @@ public class EVM {
OperationResult result;
try {
switch (opcode) {
// case 0x00: // STOP
// result = StopOperation.staticOperation(frame);
@ -284,21 +283,22 @@ public class EVM {
} catch (final UnderflowException ue) {
result = UNDERFLOW_RESPONSE;
}
if (operationTracer != null) {
operationTracer.tracePostExecution(frame, result);
}
final ExceptionalHaltReason haltReason = result.getHaltReason();
if (haltReason != null) {
LOG.trace("MessageFrame evaluation halted because of {}", haltReason);
frame.setExceptionalHaltReason(Optional.of(haltReason));
frame.setState(State.EXCEPTIONAL_HALT);
} else {
frame.decrementRemainingGas(result.getGasCost());
}
frame.decrementRemainingGas(result.getGasCost());
if (frame.getState() == State.CODE_EXECUTING) {
final int currentPC = frame.getPC();
final int opSize = result.getPcIncrement();
frame.setPC(currentPC + opSize);
}
if (operationTracer != null) {
operationTracer.tracePostExecution(frame, result);
}
}
}

Loading…
Cancel
Save