From 177503205fa7ce17f838bcc5374924223708b230 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 8 Feb 2020 11:37:20 -0700 Subject: [PATCH 1/8] trace fixes * Correct Reporting of reverts in nested calls * correct reporting and handling of value transfer in nested calls * correct handling of precompiles via DELEGATECALL & CALLCODE Signed-off-by: Danno Ferrin --- .../tracing/flat/FlatTraceGenerator.java | 19 ++++++++++--- .../results/tracing/vm/VmTraceGenerator.java | 28 +++++++++---------- .../methods/DebugTraceBlockByHashTest.java | 2 ++ .../methods/DebugTraceBlockByNumberTest.java | 2 ++ .../internal/methods/DebugTraceBlockTest.java | 2 ++ .../methods/DebugTraceTransactionTest.java | 3 ++ .../besu/ethereum/debug/TraceFrame.java | 7 +++++ .../ethereum/vm/DebugOperationTracer.java | 3 +- 8 files changed, 46 insertions(+), 20 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java index 30d2b577d41..d286a7ef171 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java @@ -18,6 +18,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.Trace; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.TracingUtils; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTrace.Context; import org.hyperledger.besu.ethereum.core.Address; import org.hyperledger.besu.ethereum.core.Gas; import org.hyperledger.besu.ethereum.core.Transaction; @@ -129,7 +130,6 @@ public static Stream generateFromTransactionTrace( } else if ("CREATE".equals(opcodeString) || "CREATE2".equals(opcodeString)) { currentContext = handleCreateOperation( - transactionTrace, smartContractAddress, flatTraces, tracesContexts, @@ -137,7 +137,7 @@ public static Stream generateFromTransactionTrace( traceFrameIndex, traceFrames); } else if ("REVERT".equals(opcodeString)) { - currentContext.getBuilder().error(Optional.of("Reverted")); + currentContext = handleRevert(tracesContexts, currentContext); } else if (!traceFrame.getExceptionalHaltReasons().isEmpty()) { currentContext .getBuilder() @@ -207,6 +207,7 @@ private static FlatTrace.Context handleReturn( final FlatTrace.Builder traceFrameBuilder = currentContext.getBuilder(); final Result.Builder resultBuilder = traceFrameBuilder.getResultBuilder(); final Action.Builder actionBuilder = traceFrameBuilder.getActionBuilder(); + actionBuilder.value(Quantity.create(traceFrame.getValue())); final Bytes outputData = traceFrame.getOutputData(); if (resultBuilder.getCode() == null) { resultBuilder.output(outputData.toHexString()); @@ -267,7 +268,6 @@ private static FlatTrace.Context handleSelfDestruct( } private static FlatTrace.Context handleCreateOperation( - final TransactionTrace transactionTrace, final Optional smartContractAddress, final List flatTraces, final Deque tracesContexts, @@ -287,7 +287,7 @@ private static FlatTrace.Context handleCreateOperation( Action.builder() .from(smartContractAddress.orElse(callingAddress)) .gas(nextTraceFrame.getGasRemaining().toHexString()) - .value(Quantity.create(transactionTrace.getTransaction().getValue())); + .value(Quantity.create(nextTraceFrame.getValue())); final FlatTrace.Context currentContext = new FlatTrace.Context(subTraceBuilder.actionBuilder(subTraceActionBuilder)); @@ -298,6 +298,17 @@ private static FlatTrace.Context handleCreateOperation( return currentContext; } + private static Context handleRevert( + final Deque tracesContexts, final FlatTrace.Context currentContext) { + currentContext.getBuilder().error(Optional.of("Reverted")); + tracesContexts.removeLast(); + final FlatTrace.Context nextContext = tracesContexts.peekLast(); + if (nextContext != null) { + nextContext.getBuilder().incSubTraces(); + } + return nextContext; + } + private static String calculateCallingAddress(final FlatTrace.Context lastContext) { if (lastContext.getBuilder().getActionBuilder().getCallType() == null) { return ZERO_ADDRESS_STRING; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index 9209265c8c2..da46d193268 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -120,6 +120,8 @@ private void handleDepthIncreased(final VmOperation op, final VmOperationExecuti // check if next frame depth has increased i.e the current operation is a call if (currentTraceFrame.depthHasIncreased() || "STATICCALL".equals(currentOperation) + || "DELEGATECALL".equals(currentOperation) + || "CALLCODE".equals(currentOperation) || "CALL".equals(currentOperation)) { findLastFrameInCall(currentTraceFrame, currentIndex) .ifPresent( @@ -131,21 +133,15 @@ private void handleDepthIncreased(final VmOperation op, final VmOperationExecuti .map(stack -> stack[stack.length - 1]) .map(last -> Quantity.create(UInt256.fromHexString(last.toHexString()))) .ifPresent(report::singlePush); - switch (currentTraceFrame.getOpcode()) { - case "DELEGATECALL": - case "CREATE": - case "CREATE2": - break; - default: - lastFrameInCall - .getMaybeUpdatedMemory() - .map( - mem -> - new Mem(mem.getValue().toHexString(), mem.getOffset().intValue())) - .ifPresent(report::setMem); + if (!currentOperation.startsWith("CREATE")) { + lastFrameInCall + .getMaybeUpdatedMemory() + .map(mem -> new Mem(mem.getValue().toHexString(), mem.getOffset().intValue())) + .ifPresent(report::setMem); } }); - if (currentTraceFrame.depthHasIncreased()) { + if (currentTraceFrame.depthHasIncreased() + && currentTraceFrame.getMaybeCode().map(Code::getSize).orElse(0) > 0) { op.setCost(currentTraceFrame.getGasRemainingPostExecution().toLong() + op.getCost()); final VmTrace newSubTrace = new VmTrace(); parentTraces.addLast(newSubTrace); @@ -238,8 +234,10 @@ private void initStep(final TraceFrame frame) { this.currentOperation = frame.getOpcode(); currentTrace = parentTraces.getLast(); // set smart contract code - currentTrace.setCode( - currentTraceFrame.getMaybeCode().orElse(new Code()).getBytes().toHexString()); + if ("0x".equals(currentTrace.getCode())) { + currentTrace.setCode( + currentTraceFrame.getMaybeCode().orElse(new Code()).getBytes().toHexString()); + } } /** diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java index 3eb113720bb..c6911eccd33 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java @@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.core.Gas; import org.hyperledger.besu.ethereum.core.Hash; +import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.debug.TraceFrame; import org.hyperledger.besu.ethereum.mainnet.TransactionProcessor; import org.hyperledger.besu.ethereum.vm.ExceptionalHaltReason; @@ -69,6 +70,7 @@ public void shouldReturnCorrectResponse() { 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, + Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java index 3974cec2ceb..ca13f4a72db 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java @@ -32,6 +32,7 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.core.Gas; import org.hyperledger.besu.ethereum.core.Hash; +import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.debug.TraceFrame; import org.hyperledger.besu.ethereum.mainnet.TransactionProcessor; import org.hyperledger.besu.ethereum.vm.ExceptionalHaltReason; @@ -74,6 +75,7 @@ public void shouldReturnCorrectResponse() { 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, + Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java index 8cd24bda824..a430f129988 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java @@ -34,6 +34,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.Gas; +import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.debug.TraceFrame; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.TransactionProcessor; @@ -87,6 +88,7 @@ public void shouldReturnCorrectResponse() { 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, + Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java index a615a32aee3..1ba3e0bec5e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java @@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.core.Gas; import org.hyperledger.besu.ethereum.core.Hash; import org.hyperledger.besu.ethereum.core.Transaction; +import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.debug.TraceFrame; import org.hyperledger.besu.ethereum.mainnet.TransactionProcessor.Result; import org.hyperledger.besu.ethereum.vm.ExceptionalHaltReason; @@ -86,6 +87,7 @@ public void shouldTraceTheTransactionUsingTheTransactionTracer() { 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, + Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), @@ -142,6 +144,7 @@ public void shouldNotTraceTheTransactionIfNotFound() { 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, + Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java index 96714e72581..c560536eed4 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java @@ -40,6 +40,7 @@ public class TraceFrame { private final int depth; private final EnumSet exceptionalHaltReasons; private final Address recipient; + private final Wei value; private final Bytes inputData; private final Bytes outputData; private final Optional stack; @@ -67,6 +68,7 @@ public TraceFrame( final int depth, final EnumSet exceptionalHaltReasons, final Address recipient, + final Wei value, final Bytes inputData, final Bytes outputData, final Optional stack, @@ -89,6 +91,7 @@ public TraceFrame( this.depth = depth; this.exceptionalHaltReasons = exceptionalHaltReasons; this.recipient = recipient; + this.value = value; this.inputData = inputData; this.outputData = outputData; this.stack = stack; @@ -135,6 +138,10 @@ public Address getRecipient() { return recipient; } + public Wei getValue() { + return value; + } + public Bytes getInputData() { return inputData; } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java index 047e417297c..01950c8fcb3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java @@ -88,6 +88,7 @@ public void traceExecution( depth, exceptionalHaltReasons, frame.getRecipientAddress(), + frame.getValue(), inputData, outputData, stack, @@ -96,7 +97,7 @@ public void traceExecution( worldUpdater, frame.getRevertReason(), maybeRefunds, - Optional.ofNullable(frame.getCode()), + Optional.ofNullable(frame.getMessageFrameStack().peek().getCode()), frame.getCurrentOperation().getStackItemsProduced(), stackPostExecution, memoryPostExecution, From 728589378ee0fbf569129c97d7f79027ab8f8ef4 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 8 Feb 2020 23:12:43 -0700 Subject: [PATCH 2/8] trace fixes * Addition of precompiled contract gas costs * Re-work handling of storage writes * Initial handling of gas refunds Signed-off-by: Danno Ferrin --- .../internal/processor/TransactionTrace.java | 4 ++ .../tracing/flat/FlatTraceGenerator.java | 13 +++- .../results/tracing/vm/VmOperation.java | 15 ++++- .../results/tracing/vm/VmTraceGenerator.java | 61 ++++--------------- .../methods/DebugTraceBlockByHashTest.java | 4 +- .../methods/DebugTraceBlockByNumberTest.java | 4 +- .../internal/methods/DebugTraceBlockTest.java | 4 +- .../methods/DebugTraceTransactionTest.java | 8 +-- .../besu/ethereum/debug/TraceFrame.java | 44 +++++++------ .../mainnet/AbstractMessageProcessor.java | 6 +- .../MainnetContractCreationProcessor.java | 3 +- .../mainnet/MainnetMessageCallProcessor.java | 8 ++- .../ethereum/vm/DebugOperationTracer.java | 17 +++--- .../besu/ethereum/vm/MessageFrame.java | 19 +++--- .../besu/ethereum/vm/OperationTracer.java | 5 ++ .../vm/operations/SStoreOperation.java | 1 + 16 files changed, 112 insertions(+), 104 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTrace.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTrace.java index c52ad659f35..94c1eb13fc0 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTrace.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTrace.java @@ -41,6 +41,10 @@ public long getGas() { return transaction.getGasLimit() - result.getGasRemaining(); } + public long getGasLimit() { + return transaction.getGasLimit(); + } + public Result getResult() { return result; } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java index d286a7ef171..0b0bc7a4a1e 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java @@ -95,13 +95,17 @@ public static Stream generateFromTransactionTrace( FlatTrace.Context currentContext = new FlatTrace.Context(firstFlatTraceBuilder); tracesContexts.addLast(currentContext); flatTraces.add(currentContext.getBuilder()); + final FlatTrace.Context firstContext = currentContext; // declare the first transactionTrace context as the previous transactionTrace context long cumulativeGasCost = 0; int traceFrameIndex = 0; final List traceFrames = transactionTrace.getTraceFrames(); + long refundCounter = traceFrames.get(traceFrames.size() - 1).getGasRefund().toLong(); for (final TraceFrame traceFrame : traceFrames) { - cumulativeGasCost += traceFrame.getGasCost().orElse(Gas.ZERO).toLong(); + cumulativeGasCost += + traceFrame.getGasCost().orElse(Gas.ZERO).toLong() + + traceFrame.getPrecompiledGasCost().orElse(Gas.ZERO).toLong(); final String opcodeString = traceFrame.getOpcode(); if ("CALL".equals(opcodeString) || "CALLCODE".equals(opcodeString) @@ -126,6 +130,7 @@ public static Stream generateFromTransactionTrace( } } else if ("SELFDESTRUCT".equals(opcodeString)) { currentContext.incGasUsed(cumulativeGasCost); + refundCounter += 24000; currentContext = handleSelfDestruct(traceFrame, flatTraces, tracesContexts); } else if ("CREATE".equals(opcodeString) || "CREATE2".equals(opcodeString)) { currentContext = @@ -148,6 +153,12 @@ public static Stream generateFromTransactionTrace( } traceFrameIndex++; } + + final TraceFrame lastTraceFrame = traceFrames.get(traceFrames.size() - 1); + firstContext.incGasUsed( + Math.min( + refundCounter, + (transactionTrace.getGasLimit() - lastTraceFrame.getGasRemaining().toLong()) / 2)); return flatTraces.stream().map(FlatTrace.Builder::build); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmOperation.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmOperation.java index b0702a535b1..7c6ff24629d 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmOperation.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmOperation.java @@ -14,14 +14,18 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.vm; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + import java.util.Objects; import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -@JsonPropertyOrder({"cost", "ex", "pc", "sub"}) +@JsonPropertyOrder({"cost", "operation", "ex", "pc", "sub"}) public class VmOperation { private long cost; + private String operation; // Information concerning the execution of the operation. private VmOperationExecutionReport vmOperationExecutionReport; private long pc; @@ -62,6 +66,15 @@ public void setSub(final VmTrace sub) { this.sub = sub; } + @JsonInclude(NON_NULL) + public String getOperation() { + return operation; + } + + public void setOperation(final String operation) { + this.operation = operation; + } + @Override public int hashCode() { return Objects.hash(cost, vmOperationExecutionReport, pc, sub); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index da46d193268..7a87d790b5b 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -24,14 +24,10 @@ import java.util.ArrayDeque; import java.util.Deque; -import java.util.HashMap; -import java.util.Map; import java.util.Optional; import java.util.stream.IntStream; import java.util.stream.Stream; -import com.google.common.collect.MapDifference; -import com.google.common.collect.Maps; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; @@ -147,6 +143,9 @@ private void handleDepthIncreased(final VmOperation op, final VmOperationExecuti parentTraces.addLast(newSubTrace); op.setSub(newSubTrace); } else { + if (currentTraceFrame.getPrecompiledGasCost().isPresent()) { + op.setCost(op.getCost() + currentTraceFrame.getPrecompiledGasCost().get().toLong()); + } op.setSub(new VmTrace()); } } @@ -164,6 +163,7 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); + op.setOperation(currentOperation); return op; } @@ -216,12 +216,14 @@ private void generateTracingPush(final VmOperationExecutionReport report) { private void generateTracingStorage(final VmOperationExecutionReport report) { // set storage if updated - updatedStorage(currentTraceFrame.getStoragePreExecution(), currentTraceFrame.getStorage()) - .map( - storageEntry -> - new Store( - storageEntry.key.toShortHexString(), storageEntry.value.toShortHexString())) - .ifPresent(report::setStore); + currentTraceFrame + .getMaybeUpdatedStorage() + .ifPresent( + entry -> + report.setStore( + new Store( + entry.getOffset().toShortHexString(), + entry.getValue().toShortHexString()))); } /** @@ -240,35 +242,6 @@ private void initStep(final TraceFrame frame) { } } - /** - * Find updated storage from 2 storage captures. - * - * @param firstCapture The first storage capture. - * @param secondCapture The second storage capture. - * @return an {@link Optional} wrapping the diff. - */ - private Optional updatedStorage( - final Optional> firstCapture, - final Optional> secondCapture) { - final Map first = firstCapture.orElse(new HashMap<>()); - final Map second = secondCapture.orElse(new HashMap<>()); - final MapDifference diff = Maps.difference(first, second); - final Map> entriesDiffering = - diff.entriesDiffering(); - if (entriesDiffering.size() > 0) { - final UInt256 firstDiffKey = entriesDiffering.keySet().iterator().next(); - final MapDifference.ValueDifference firstDiff = entriesDiffering.get(firstDiffKey); - return Optional.of(new StorageEntry(firstDiffKey, firstDiff.rightValue())); - } - final Map onlyOnRight = diff.entriesOnlyOnRight(); - if (onlyOnRight.size() > 0) { - final UInt256 firstOnlyOnRightKey = onlyOnRight.keySet().iterator().next(); - return Optional.of( - new StorageEntry(firstOnlyOnRightKey, onlyOnRight.get(firstOnlyOnRightKey))); - } - return Optional.empty(); - } - /** * Find the last frame in the call. * @@ -288,14 +261,4 @@ private Optional findLastFrameInCall( } return Optional.empty(); } - - static class StorageEntry { - private final UInt256 key; - private final UInt256 value; - - StorageEntry(final UInt256 key, final UInt256 value) { - this.key = key; - this.value = value; - } - } } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java index c6911eccd33..ae9a9b82d97 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java @@ -67,6 +67,7 @@ public void shouldReturnCorrectResponse() { "NONE", Gas.of(45), Optional.of(Gas.of(56)), + Gas.ZERO, 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, @@ -82,9 +83,8 @@ public void shouldReturnCorrectResponse() { Optional.empty(), 0, Optional.empty(), - Optional.empty(), - Optional.empty(), false, + Optional.empty(), Optional.empty()); final TransactionProcessor.Result transaction1Result = mock(TransactionProcessor.Result.class); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java index ca13f4a72db..521cf129958 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java @@ -72,6 +72,7 @@ public void shouldReturnCorrectResponse() { "NONE", Gas.of(45), Optional.of(Gas.of(56)), + Gas.ZERO, 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, @@ -87,9 +88,8 @@ public void shouldReturnCorrectResponse() { Optional.empty(), 0, Optional.empty(), - Optional.empty(), - Optional.empty(), false, + Optional.empty(), Optional.empty()); final TransactionProcessor.Result transaction1Result = mock(TransactionProcessor.Result.class); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java index a430f129988..6b0d3340a53 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java @@ -85,6 +85,7 @@ public void shouldReturnCorrectResponse() { "NONE", Gas.of(45), Optional.of(Gas.of(56)), + Gas.ZERO, 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, @@ -100,9 +101,8 @@ public void shouldReturnCorrectResponse() { Optional.empty(), 0, Optional.empty(), - Optional.empty(), - Optional.empty(), false, + Optional.empty(), Optional.empty()); final TransactionProcessor.Result transaction1Result = mock(TransactionProcessor.Result.class); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java index 1ba3e0bec5e..7a3b574e1c8 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java @@ -84,6 +84,7 @@ public void shouldTraceTheTransactionUsingTheTransactionTracer() { "NONE", Gas.of(45), Optional.of(Gas.of(56)), + Gas.ZERO, 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, @@ -99,9 +100,8 @@ public void shouldTraceTheTransactionUsingTheTransactionTracer() { Optional.empty(), 0, Optional.empty(), - Optional.empty(), - Optional.empty(), false, + Optional.empty(), Optional.empty()); final List traceFrames = Collections.singletonList(traceFrame); final TransactionTrace transactionTrace = @@ -141,6 +141,7 @@ public void shouldNotTraceTheTransactionIfNotFound() { "NONE", Gas.of(45), Optional.of(Gas.of(56)), + Gas.ZERO, 2, EnumSet.noneOf(ExceptionalHaltReason.class), null, @@ -156,9 +157,8 @@ public void shouldNotTraceTheTransactionIfNotFound() { Optional.empty(), 0, Optional.empty(), - Optional.empty(), - Optional.empty(), false, + Optional.empty(), Optional.empty()); final List traceFrames = Collections.singletonList(traceFrame); final TransactionTrace transactionTrace = diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java index c560536eed4..b8e2132f555 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java @@ -37,6 +37,7 @@ public class TraceFrame { private final String opcode; private final Gas gasRemaining; private final Optional gasCost; + private final Gas gasRefund; private final int depth; private final EnumSet exceptionalHaltReasons; private final Address recipient; @@ -52,19 +53,20 @@ public class TraceFrame { private final Optional maybeCode; private final int stackItemsProduced; private final Optional stackPostExecution; - private final Optional memoryPostExecution; private Optional maybeNextDepth; private Gas gasRemainingPostExecution; - private final Optional> storagePreExecution; private final boolean virtualOperation; private final Optional maybeUpdatedMemory; + private final Optional maybeUpdatedStorage; + private Optional precompiledGasCost; public TraceFrame( final int pc, final String opcode, final Gas gasRemaining, final Optional gasCost, + final Gas gasRefund, final int depth, final EnumSet exceptionalHaltReasons, final Address recipient, @@ -80,14 +82,14 @@ public TraceFrame( final Optional maybeCode, final int stackItemsProduced, final Optional stackPostExecution, - final Optional memoryPostExecution, - final Optional> storagePreExecution, final boolean virtualOperation, - final Optional maybeUpdatedMemory) { + final Optional maybeUpdatedMemory, + final Optional maybeUpdatedStorage) { this.pc = pc; this.opcode = opcode; this.gasRemaining = gasRemaining; this.gasCost = gasCost; + this.gasRefund = gasRefund; this.depth = depth; this.exceptionalHaltReasons = exceptionalHaltReasons; this.recipient = recipient; @@ -103,11 +105,11 @@ public TraceFrame( this.maybeCode = maybeCode; this.stackItemsProduced = stackItemsProduced; this.stackPostExecution = stackPostExecution; - this.memoryPostExecution = memoryPostExecution; this.maybeNextDepth = Optional.empty(); - this.storagePreExecution = storagePreExecution; this.virtualOperation = virtualOperation; this.maybeUpdatedMemory = maybeUpdatedMemory; + this.maybeUpdatedStorage = maybeUpdatedStorage; + precompiledGasCost = Optional.empty(); } public int getPc() { @@ -126,6 +128,10 @@ public Optional getGasCost() { return gasCost; } + public Gas getGasRefund() { + return gasRefund; + } + public int getDepth() { return depth; } @@ -201,10 +207,6 @@ public Optional getStackPostExecution() { return stackPostExecution; } - public Optional getMemoryPostExecution() { - return memoryPostExecution; - } - public boolean depthHasIncreased() { return maybeNextDepth.map(next -> next > depth).orElse(false); } @@ -213,10 +215,6 @@ public boolean depthHasDecreased() { return maybeNextDepth.map(next -> next < depth).orElse(false); } - public Optional getMaybeNextDepth() { - return maybeNextDepth; - } - public void setMaybeNextDepth(final Optional maybeNextDepth) { this.maybeNextDepth = maybeNextDepth; } @@ -225,10 +223,6 @@ public Gas getGasRemainingPostExecution() { return gasRemainingPostExecution; } - public Optional> getStoragePreExecution() { - return storagePreExecution; - } - public void setGasRemainingPostExecution(final Gas gasRemainingPostExecution) { this.gasRemainingPostExecution = gasRemainingPostExecution; } @@ -240,4 +234,16 @@ public boolean isVirtualOperation() { public Optional getMaybeUpdatedMemory() { return maybeUpdatedMemory; } + + public Optional getMaybeUpdatedStorage() { + return maybeUpdatedStorage; + } + + public Optional getPrecompiledGasCost() { + return precompiledGasCost; + } + + public void setPrecompiledGasCost(final Optional precompiledGasCost) { + this.precompiledGasCost = precompiledGasCost; + } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractMessageProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractMessageProcessor.java index e52a1322238..3b0ccb8dcd6 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractMessageProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractMessageProcessor.java @@ -42,7 +42,7 @@ * * * {@link MessageFrame.State#NOT_STARTED} - * {@link AbstractMessageProcessor#start(MessageFrame)} + * {@link AbstractMessageProcessor#start(MessageFrame, OperationTracer)} * * * {@link MessageFrame.State#CODE_EXECUTING} @@ -74,7 +74,7 @@ protected AbstractMessageProcessor( this.forceDeleteAccountsWhenEmpty = forceDeleteAccountsWhenEmpty; } - protected abstract void start(MessageFrame frame); + protected abstract void start(MessageFrame frame, final OperationTracer operationTracer); /** * Gets called when the message frame code executes successfully. @@ -163,7 +163,7 @@ private void codeExecute(final MessageFrame frame, final OperationTracer operati public void process(final MessageFrame frame, final OperationTracer operationTracer) { if (frame.getState() == MessageFrame.State.NOT_STARTED) { - start(frame); + start(frame, operationTracer); } if (frame.getState() == MessageFrame.State.CODE_EXECUTING) { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetContractCreationProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetContractCreationProcessor.java index 712950082e2..b7dd4814c65 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetContractCreationProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetContractCreationProcessor.java @@ -22,6 +22,7 @@ import org.hyperledger.besu.ethereum.vm.EVM; import org.hyperledger.besu.ethereum.vm.GasCalculator; import org.hyperledger.besu.ethereum.vm.MessageFrame; +import org.hyperledger.besu.ethereum.vm.OperationTracer; import java.util.Collection; import java.util.List; @@ -102,7 +103,7 @@ private static boolean accountExists(final Account account) { } @Override - public void start(final MessageFrame frame) { + public void start(final MessageFrame frame, final OperationTracer operationTracer) { if (LOG.isTraceEnabled()) { LOG.trace("Executing contract-creation"); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java index d88b176d50c..8ccad29312c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java @@ -21,6 +21,7 @@ import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.vm.EVM; import org.hyperledger.besu.ethereum.vm.MessageFrame; +import org.hyperledger.besu.ethereum.vm.OperationTracer; import java.util.Collection; @@ -48,7 +49,7 @@ public MainnetMessageCallProcessor(final EVM evm, final PrecompileContractRegist } @Override - public void start(final MessageFrame frame) { + public void start(final MessageFrame frame, final OperationTracer operationTracer) { LOG.trace("Executing message-call"); try { transferValue(frame); @@ -57,7 +58,7 @@ public void start(final MessageFrame frame) { final PrecompiledContract precompile = precompiles.get(frame.getContractAddress(), frame.getContractAccountVersion()); if (precompile != null) { - executePrecompile(precompile, frame); + executePrecompile(precompile, frame, operationTracer); } else { frame.setState(MessageFrame.State.CODE_EXECUTING); } @@ -114,7 +115,7 @@ private void transferValue(final MessageFrame frame) { * * @param contract The contract this is a message call to. */ - private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame) { + private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame, final OperationTracer operationTracer) { final Gas gasRequirement = contract.gasRequirement(frame.getInputData()); if (frame.getRemainingGas().compareTo(gasRequirement) < 0) { LOG.trace( @@ -127,6 +128,7 @@ private void executePrecompile(final PrecompiledContract contract, final Message } else { frame.decrementRemainingGas(gasRequirement); final Bytes output = contract.compute(frame.getInputData(), frame); + operationTracer.tracePrecompileCall(frame, gasRequirement, output); if (output != null) { if (contract.getName().equals("Privacy")) { // do not decrement the gas requirement for a privacy pre-compile contract call -> leads diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java index 01950c8fcb3..590794d2131 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java @@ -61,17 +61,14 @@ public void traceExecution( EnumSet.copyOf(frame.getExceptionalHaltReasons()); final Bytes inputData = frame.getInputData(); final Optional stack = captureStack(frame); - final Optional> storagePreExecution = captureStorage(frame); final WorldUpdater worldUpdater = frame.getWorldState(); final Optional stackPostExecution; - final Optional memoryPostExecution; try { executeOperation.execute(); } finally { final Bytes outputData = frame.getOutputData(); final Optional memory = captureMemory(frame); stackPostExecution = captureStack(frame); - memoryPostExecution = captureMemory(frame); if (lastFrame != null) { lastFrame.setMaybeNextDepth(Optional.of(depth)); lastFrame.setGasRemainingPostExecution(gasRemaining); @@ -85,10 +82,11 @@ public void traceExecution( opcode, gasRemaining, currentGasCost, + frame.getGasRefund(), depth, exceptionalHaltReasons, frame.getRecipientAddress(), - frame.getValue(), + frame.getApparentValue(), inputData, outputData, stack, @@ -100,15 +98,20 @@ public void traceExecution( Optional.ofNullable(frame.getMessageFrameStack().peek().getCode()), frame.getCurrentOperation().getStackItemsProduced(), stackPostExecution, - memoryPostExecution, - storagePreExecution, currentOperation.isVirtualOperation(), - frame.getMaybeUpdatedMemory()); + frame.getMaybeUpdatedMemory(), + frame.getMaybeUpdatedStorage()); traceFrames.add(lastFrame); } frame.reset(); } + @Override + public void tracePrecompileCall( + final MessageFrame frame, final Gas gasRequirement, final Bytes output) { + traceFrames.get(traceFrames.size() - 1).setPrecompiledGasCost(Optional.of(gasRequirement)); + } + private Optional> captureStorage(final MessageFrame frame) { if (!options.isStorageEnabled()) { return Optional.empty(); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/MessageFrame.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/MessageFrame.java index 3d8e1f9bd8c..411f7294b79 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/MessageFrame.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/MessageFrame.java @@ -235,6 +235,7 @@ public enum Type { private Operation currentOperation; private final Consumer completer; private Optional maybeUpdatedMemory = Optional.empty(); + private Optional maybeUpdatedStorage = Optional.empty(); public static Builder builder() { return new Builder(); @@ -556,16 +557,6 @@ public Bytes readMemory( return value; } - /** - * Write byte to memory - * - * @param offset The offset in memory - * @param value The value to set in memory - */ - public void writeMemory(final UInt256 offset, final byte value) { - writeMemory(offset, value, false); - } - /** * Write byte to memory * @@ -668,6 +659,9 @@ private void setUpdatedMemory(final UInt256 offset, final Bytes value) { maybeUpdatedMemory = Optional.of(new MemoryEntry(offset, value)); } + public void storageWasUpdated(final UInt256 storageAddress, final Bytes value) { + maybeUpdatedStorage = Optional.of(new MemoryEntry(storageAddress, value)); + } /** * Accumulate a log. * @@ -978,8 +972,13 @@ Optional getMaybeUpdatedMemory() { return maybeUpdatedMemory; } + public Optional getMaybeUpdatedStorage() { + return maybeUpdatedStorage; + } + public void reset() { maybeUpdatedMemory = Optional.empty(); + maybeUpdatedStorage = Optional.empty(); } public static class Builder { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/OperationTracer.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/OperationTracer.java index e5c3c96cb83..05be408bdde 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/OperationTracer.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/OperationTracer.java @@ -19,6 +19,8 @@ import java.util.Optional; +import org.apache.tuweni.bytes.Bytes; + public interface OperationTracer { OperationTracer NO_TRACING = @@ -28,6 +30,9 @@ void traceExecution( MessageFrame frame, Optional currentGasCost, ExecuteOperation executeOperation) throws ExceptionalHaltException; + default void tracePrecompileCall( + final MessageFrame frame, final Gas gasRequirement, final Bytes output) {}; + interface ExecuteOperation { void execute() throws ExceptionalHaltException; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/operations/SStoreOperation.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/operations/SStoreOperation.java index deb92d1c65f..04144cb748a 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/operations/SStoreOperation.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/operations/SStoreOperation.java @@ -62,6 +62,7 @@ public void execute(final MessageFrame frame) { frame.incrementGasRefund(gasCalculator().calculateStorageRefundAmount(account, key, value)); account.setStorageValue(key, value); + frame.storageWasUpdated(key, value.toBytes()); } @Override From 7e31ea5afaea5b31d20f56c9a9d0d2dde8d8cdf0 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 8 Feb 2020 23:18:52 -0700 Subject: [PATCH 3/8] spotles Signed-off-by: Danno Ferrin --- .../internal/results/tracing/vm/VmTraceGenerator.java | 1 - .../besu/ethereum/mainnet/MainnetMessageCallProcessor.java | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index 7a87d790b5b..f84f5c6b31a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -163,7 +163,6 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); - op.setOperation(currentOperation); return op; } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java index 8ccad29312c..c21ee2ebe09 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetMessageCallProcessor.java @@ -115,7 +115,10 @@ private void transferValue(final MessageFrame frame) { * * @param contract The contract this is a message call to. */ - private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame, final OperationTracer operationTracer) { + private void executePrecompile( + final PrecompiledContract contract, + final MessageFrame frame, + final OperationTracer operationTracer) { final Gas gasRequirement = contract.gasRequirement(frame.getInputData()); if (frame.getRemainingGas().compareTo(gasRequirement) < 0) { LOG.trace( From ab00f0ac67e79bcc5fb841c46beb4194b1b92ada Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sun, 9 Feb 2020 23:08:35 -0700 Subject: [PATCH 4/8] gas refund and delegatecall - Roll back the refund calculaitons. * I think the reference impl is wrong - fix bug in DELEGATECALL tests, we don't need gas * this has a cascading effect on balances in diff tests - rework depth detection in flat trace - two new tests blocks Signed-off-by: Danno Ferrin --- .../tracing/flat/FlatTraceGenerator.java | 8 - .../results/tracing/vm/VmTraceGenerator.java | 108 +- .../api/jsonrpc/trace/chain-data/blocks.json | 76 +- .../api/jsonrpc/trace/chain-data/genesis.json | 4 +- ...race_replayBlockTransactions_all_0x10.json | 24 +- ...race_replayBlockTransactions_all_0x11.json | 8 +- ...race_replayBlockTransactions_all_0x12.json | 16 +- ...race_replayBlockTransactions_all_0x13.json | 24 +- ...race_replayBlockTransactions_all_0x14.json | 16 +- ...race_replayBlockTransactions_all_0x15.json | 1870 +++++++++++++++++ ...race_replayBlockTransactions_all_0x16.json | 1818 ++++++++++++++++ ...trace_replayBlockTransactions_all_0xB.json | 92 +- ...trace_replayBlockTransactions_all_0xC.json | 8 +- ...trace_replayBlockTransactions_all_0xD.json | 8 +- ...trace_replayBlockTransactions_all_0xE.json | 24 +- ...trace_replayBlockTransactions_all_0xF.json | 16 +- ...replayBlockTransactions_traceOnly_0xB.json | 12 +- ..._replayBlockTransactions_diffOnly_0xB.json | 6 +- ..._replayBlockTransactions_diffOnly_0xC.json | 8 +- ..._replayBlockTransactions_diffOnly_0xD.json | 8 +- ..._replayBlockTransactions_diffOnly_0xE.json | 24 +- .../trace_replayBlockTransactions_0xB.json | 78 +- .../besu/ethereum/debug/TraceFrame.java | 14 - .../ethereum/vm/DebugOperationTracer.java | 1 - 24 files changed, 4001 insertions(+), 270 deletions(-) create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x15.json create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x16.json diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java index 0b0bc7a4a1e..257fca9411d 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java @@ -95,13 +95,11 @@ public static Stream generateFromTransactionTrace( FlatTrace.Context currentContext = new FlatTrace.Context(firstFlatTraceBuilder); tracesContexts.addLast(currentContext); flatTraces.add(currentContext.getBuilder()); - final FlatTrace.Context firstContext = currentContext; // declare the first transactionTrace context as the previous transactionTrace context long cumulativeGasCost = 0; int traceFrameIndex = 0; final List traceFrames = transactionTrace.getTraceFrames(); - long refundCounter = traceFrames.get(traceFrames.size() - 1).getGasRefund().toLong(); for (final TraceFrame traceFrame : traceFrames) { cumulativeGasCost += traceFrame.getGasCost().orElse(Gas.ZERO).toLong() @@ -130,7 +128,6 @@ public static Stream generateFromTransactionTrace( } } else if ("SELFDESTRUCT".equals(opcodeString)) { currentContext.incGasUsed(cumulativeGasCost); - refundCounter += 24000; currentContext = handleSelfDestruct(traceFrame, flatTraces, tracesContexts); } else if ("CREATE".equals(opcodeString) || "CREATE2".equals(opcodeString)) { currentContext = @@ -154,11 +151,6 @@ public static Stream generateFromTransactionTrace( traceFrameIndex++; } - final TraceFrame lastTraceFrame = traceFrames.get(traceFrames.size() - 1); - firstContext.incGasUsed( - Math.min( - refundCounter, - (transactionTrace.getGasLimit() - lastTraceFrame.getGasRemaining().toLong()) / 2)); return flatTraces.stream().map(FlatTrace.Builder::build); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index f84f5c6b31a..e59dfdb4a8c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -40,6 +40,7 @@ public class VmTraceGenerator { private final TransactionTrace transactionTrace; private final VmTrace rootVmTrace = new VmTrace(); private final Deque parentTraces = new ArrayDeque<>(); + int lastDepth = 0; public VmTraceGenerator(final TransactionTrace transactionTrace) { this.transactionTrace = transactionTrace; @@ -78,18 +79,18 @@ private Trace generateTrace() { * @param frame the current trace frame */ private void addFrame(final TraceFrame frame) { - if (mustIgnore(frame)) { - return; + handleDepthDecreased(frame); + if (!mustIgnore(frame)) { + initStep(frame); + final VmOperation op = buildVmOperation(); + final VmOperationExecutionReport report = generateExecutionReport(); + generateTracingMemory(report); + generateTracingPush(report); + generateTracingStorage(report); + handleDepthIncreased(op, report); + completeStep(op, report); } - initStep(frame); - final VmOperation op = buildVmOperation(); - final VmOperationExecutionReport report = generateExecutionReport(); - generateTracingMemory(report); - generateTracingPush(report); - generateTracingStorage(report); - handleDepthIncreased(op, report); - handleDepthDecreased(); - completeStep(op, report); + lastDepth = frame.getDepth(); } private boolean mustIgnore(final TraceFrame frame) { @@ -108,52 +109,62 @@ private boolean mustIgnore(final TraceFrame frame) { private void completeStep(final VmOperation op, final VmOperationExecutionReport report) { // add the operation representation to the list of traces op.setVmOperationExecutionReport(report); - currentTrace.add(op); + if (currentTrace != null) { + currentTrace.add(op); + } currentIndex++; } private void handleDepthIncreased(final VmOperation op, final VmOperationExecutionReport report) { // check if next frame depth has increased i.e the current operation is a call - if (currentTraceFrame.depthHasIncreased() - || "STATICCALL".equals(currentOperation) - || "DELEGATECALL".equals(currentOperation) - || "CALLCODE".equals(currentOperation) - || "CALL".equals(currentOperation)) { - findLastFrameInCall(currentTraceFrame, currentIndex) - .ifPresent( - lastFrameInCall -> { - report.setUsed(lastFrameInCall.getGasRemaining().toLong()); - lastFrameInCall - .getStack() - .filter(stack -> stack.length > 0) - .map(stack -> stack[stack.length - 1]) - .map(last -> Quantity.create(UInt256.fromHexString(last.toHexString()))) - .ifPresent(report::singlePush); - if (!currentOperation.startsWith("CREATE")) { + switch (currentOperation) { + case "STATICCALL": + case "DELEGATECALL": + case "CALLCODE": + case "CALL": + case "CREATE": + case "CREATE2": + findLastFrameInCall(currentTraceFrame, currentIndex) + .ifPresent( + lastFrameInCall -> { + report.setUsed(lastFrameInCall.getGasRemaining().toLong()); lastFrameInCall - .getMaybeUpdatedMemory() - .map(mem -> new Mem(mem.getValue().toHexString(), mem.getOffset().intValue())) - .ifPresent(report::setMem); - } - }); - if (currentTraceFrame.depthHasIncreased() - && currentTraceFrame.getMaybeCode().map(Code::getSize).orElse(0) > 0) { - op.setCost(currentTraceFrame.getGasRemainingPostExecution().toLong() + op.getCost()); - final VmTrace newSubTrace = new VmTrace(); - parentTraces.addLast(newSubTrace); - op.setSub(newSubTrace); - } else { - if (currentTraceFrame.getPrecompiledGasCost().isPresent()) { - op.setCost(op.getCost() + currentTraceFrame.getPrecompiledGasCost().get().toLong()); + .getStack() + .filter(stack -> stack.length > 0) + .map(stack -> stack[stack.length - 1]) + .map(last -> Quantity.create(UInt256.fromHexString(last.toHexString()))) + .ifPresent(report::singlePush); + if (!currentOperation.startsWith("CREATE")) { + lastFrameInCall + .getMaybeUpdatedMemory() + .map( + mem -> + new Mem(mem.getValue().toHexString(), mem.getOffset().intValue())) + .ifPresent(report::setMem); + } + }); + if ( + /*(currentTraceFrame.getDepth() > lastDepth) + && */ currentTraceFrame.getMaybeCode().map(Code::getSize).orElse(0) > 0) { + op.setCost(currentTraceFrame.getGasRemainingPostExecution().toLong() + op.getCost()); + final VmTrace newSubTrace = new VmTrace(); + parentTraces.addLast(newSubTrace); + op.setSub(newSubTrace); + } else { + if (currentTraceFrame.getPrecompiledGasCost().isPresent()) { + op.setCost(op.getCost() + currentTraceFrame.getPrecompiledGasCost().get().toLong()); + } + op.setSub(new VmTrace()); } - op.setSub(new VmTrace()); - } + break; + default: + break; } } - private void handleDepthDecreased() { + private void handleDepthDecreased(final TraceFrame frame) { // check if next frame depth has decreased i.e the current operation closes the parent trace - if (currentTraceFrame.depthHasDecreased()) { + if (currentTraceFrame != null && frame.getDepth() < lastDepth) { currentTrace = parentTraces.removeLast(); } } @@ -163,6 +174,7 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); + //op.setOperation(currentOperation); return op; } @@ -233,9 +245,9 @@ private void generateTracingStorage(final VmOperationExecutionReport report) { private void initStep(final TraceFrame frame) { this.currentTraceFrame = frame; this.currentOperation = frame.getOpcode(); - currentTrace = parentTraces.getLast(); + currentTrace = parentTraces.peekLast(); // set smart contract code - if ("0x".equals(currentTrace.getCode())) { + if (currentTrace != null && "0x".equals(currentTrace.getCode())) { currentTrace.setCode( currentTraceFrame.getMaybeCode().orElse(new Code()).getBytes().toHexString()); } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.json index d8fe87656f7..b7a025dcc4e 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.json @@ -341,6 +341,80 @@ "to": "0x0140000000000000000000000000000000000000" } ] + }, + { + "number": "0x15", + "transactions": [ + { + "comment": "Set contract storage (key,value)'s: (1,1),(2,2)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0040000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002" + }, + { + "comment": "Set contract storage (key,value)'s: (1,3),(2,4)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0040000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004" + }, + { + "comment": "Set contract storage (key,value)'s: (1,3),(1,0)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0040000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000" + }, + { + "comment": "Clear contract storage keys 1 and 2", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0040000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000" + } + ] + }, + { + "number": "0x16", + "transactions": [ + { + "comment": "Set contract storage (key,value)'s: (1,1),(2,2)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0060000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002" + }, + { + "comment": "Set contract storage (key,value)'s: (1,3),(2,4)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0060000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004" + }, + { + "comment": "Set contract storage (key,value)'s: (1,3),(1,0)", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0060000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000" + }, + { + "comment": "Clear contract storage keys 1 and 2", + "secretKey": "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "gasLimit": "0xFFFFF2", + "gasPrice": "0xEF", + "to": "0x0060000000000000000000000000000000000000", + "data": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000" + } + ] } ] -} \ No newline at end of file +} diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json index 74b084b4a04..f6cf2fb99e8 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json @@ -51,8 +51,8 @@ }, "0060000000000000000000000000000000000000": { "comment": "Proxy a call to the address in the first 32 bytes, sending the rest of the input data to this address. Return 32 bytes from sub-call.", - "comment": "0x outSize 6020 outOffset 6000 inputSize 60203603 inputToMem(dupSize 80)6020600037 inOffset 6000 val 34 to 600035 gas 5A DELEGATECALL F4 Return 60206000F3", - "code": "0x60206000602036038060206000376000346000355AF460206000F3", + "comment": "0x outSize 6020 outOffset 6000 inputSize 60203603 inputToMem(dupSize 80)6020600037 inOffset 6000 to 600035 gas 5A DELEGATECALL F4 Return 60206000F3", + "code": "0x602060006020360380602060003760006000355AF460206000F3", "balance": "0x0" }, "0070000000000000000000000000000000000000": { diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x10.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x10.json index bf682a79b7f..2e259453f58 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x10.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x10.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1a055690e93c2f67b", - "to": "0x1a055690f82c2e969" + "from": "0x1a055690e93c2f49d", + "to": "0x1a055690f82c2e78b" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0babcdea", - "to": "0xffffffffffffffffffffffffffffffffe1cabdafc" + "from": "0xfffffffffffffffffffffffffffffffff0babcfc8", + "to": "0xffffffffffffffffffffffffffffffffe1cabdcda" } }, "code": "=", @@ -88,8 +88,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1a055690f82c2e969", - "to": "0x1a055691071c2dc57" + "from": "0x1a055690f82c2e78b", + "to": "0x1a055691071c2da79" } }, "code": "=", @@ -99,8 +99,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffe1cabdafc", - "to": "0xffffffffffffffffffffffffffffffffd2dabe80e" + "from": "0xffffffffffffffffffffffffffffffffe1cabdcda", + "to": "0xffffffffffffffffffffffffffffffffd2dabe9ec" } }, "code": "=", @@ -155,8 +155,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1a055691071c2dc57", - "to": "0x1a055691160c2cf45" + "from": "0x1a055691071c2da79", + "to": "0x1a055691160c2cd67" } }, "code": "=", @@ -166,8 +166,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffd2dabe80e", - "to": "0xffffffffffffffffffffffffffffffffc3eabf520" + "from": "0xffffffffffffffffffffffffffffffffd2dabe9ec", + "to": "0xffffffffffffffffffffffffffffffffc3eabf6fe" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x11.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x11.json index 6848ccbdfea..4557c67336e 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x11.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x11.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1bc16d678af8acf45", - "to": "0x1bc16d678afd772be" + "from": "0x1bc16d678af8acd67", + "to": "0x1bc16d678afd770e0" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffc3eabf520", - "to": "0xffffffffffffffffffffffffffffffffc3e5f51a7" + "from": "0xffffffffffffffffffffffffffffffffc3eabf6fe", + "to": "0xffffffffffffffffffffffffffffffffc3e5f5385" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x12.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x12.json index a56819abe13..2429fd436a8 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x12.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x12.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1d7d843dffe9f72be", - "to": "0x1d7d843dffeec2438" + "from": "0x1d7d843dffe9f70e0", + "to": "0x1d7d843dffeec225a" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffc3e5f51a7", - "to": "0xffffffffffffffffffffffffffffffffc3e12a02d" + "from": "0xffffffffffffffffffffffffffffffffc3e5f5385", + "to": "0xffffffffffffffffffffffffffffffffc3e12a20b" } }, "code": "=", @@ -187,8 +187,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1d7d843dffeec2438", - "to": "0x1d7d843dfff38d5b2" + "from": "0x1d7d843dffeec225a", + "to": "0x1d7d843dfff38d3d4" } }, "code": "=", @@ -198,8 +198,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffc3e12a02d", - "to": "0xffffffffffffffffffffffffffffffffc3dc5eeb3" + "from": "0xffffffffffffffffffffffffffffffffc3e12a20b", + "to": "0xffffffffffffffffffffffffffffffffc3dc5f091" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x13.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x13.json index c1065e28b13..09c2a2a617a 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x13.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x13.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b1474e00d5b2", - "to": "0x1f399b1474ec5ecd6" + "from": "0x1f399b1474e00d3d4", + "to": "0x1f399b1474ec5eaf8" } }, "code": "=", @@ -179,8 +179,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b1474ec5ecd6", - "to": "0x1f399b1474f4c9d41" + "from": "0x1f399b1474ec5eaf8", + "to": "0x1f399b1474f4c9b63" } }, "code": "=", @@ -654,8 +654,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b1474f4c9d41", - "to": "0x1f399b1475011b465" + "from": "0x1f399b1474f4c9b63", + "to": "0x1f399b1475011b287" } }, "code": "=", @@ -812,8 +812,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b1475011b465", - "to": "0x1f399b147509864d0" + "from": "0x1f399b1475011b287", + "to": "0x1f399b147509862f2" } }, "code": "=", @@ -1263,8 +1263,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b147509864d0", - "to": "0x1f399b147515d7bf4" + "from": "0x1f399b147509862f2", + "to": "0x1f399b147515d7a16" } }, "code": "=", @@ -1421,8 +1421,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1f399b147515d7bf4", - "to": "0x1f399b14751e4016d" + "from": "0x1f399b147515d7a16", + "to": "0x1f399b14751e3ff8f" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x14.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x14.json index e685a38b897..883946dac3a 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x14.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x14.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x20f5b1eaea0ac016d", - "to": "0x20f5b1eaea24cac3f" + "from": "0x20f5b1eaea0abff8f", + "to": "0x20f5b1eaea24caa61" } }, "code": "=", @@ -69,8 +69,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffc3dc5eeb3", - "to": "0xffffffffffffffffffffffffffffffffc3c2543e1" + "from": "0xffffffffffffffffffffffffffffffffc3dc5f091", + "to": "0xffffffffffffffffffffffffffffffffc3c2545bf" } }, "code": "=", @@ -437,8 +437,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x20f5b1eaea24cac3f", - "to": "0x20f5b1eaea3eca4c0" + "from": "0x20f5b1eaea24caa61", + "to": "0x20f5b1eaea3eca2e2" } }, "code": "=", @@ -485,8 +485,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffc3c2543e1", - "to": "0xffffffffffffffffffffffffffffffffc3a854b60" + "from": "0xffffffffffffffffffffffffffffffffc3c2545bf", + "to": "0xffffffffffffffffffffffffffffffffc3a854d3e" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x15.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x15.json new file mode 100644 index 00000000000..65503780515 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x15.json @@ -0,0 +1,1870 @@ +{ + "request": { + "jsonrpc": "2.0", + "method": "trace_replayBlockTransactions", + "params": [ + "0x15", + [ + "trace", + "vmTrace", + "stateDiff" + ] + ], + "id": 415 + }, + "response": { + "jsonrpc": "2.0", + "result": [ + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x22b1c8c15f2b4a2e2", + "to": "0x22b1c8c15f39889f5" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0010000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0000000000000000000000000000000000000000000000000000000000000001" + } + }, + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0000000000000000000000000000000000000000000000000000000000000002" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffffa660fde", + "to": "0xefffffffffffffffff98228cb" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xa", + "to": "0xb" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab2e", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0040000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x9f59", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "call", + "from": "0x0040000000000000000000000000000000000000", + "gas": "0xfba993", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x9c58", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x7ab106c58a1c4d5c5f545f94ad266a945e3ed82835528fd3adbf7973d2c0c953", + "vmTrace": { + "code": "0x60206000602036038060206000376000346000355af160206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755499 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755496 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755493 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755491 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755488 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755485 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755482 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755479 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755452 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755449 + }, + "pc": 14, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755447 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755444 + }, + "pc": 17, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755441 + }, + "pc": 19, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaaef" + ], + "store": null, + "used": 16755439 + }, + "pc": 20, + "sub": null + }, + { + "cost": 16493647, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16714715 + }, + "pc": 21, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492944 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492941 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492938 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492935 + }, + "pc": 5, + "sub": null + }, + { + "cost": 20000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x1" + }, + "used": 16472935 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16472932 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16472929 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16472926 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16472923 + }, + "pc": 12, + "sub": null + }, + { + "cost": 20000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x2" + }, + "used": 16452923 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16714712 + }, + "pc": 22, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16714709 + }, + "pc": 24, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16714709 + }, + "pc": 26, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x22b1c8c15f39889f5", + "to": "0x22b1c8c15f40f0938" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0010000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000001", + "to": "0x0000000000000000000000000000000000000000000000000000000000000003" + } + }, + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0000000000000000000000000000000000000000000000000000000000000004" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff98228cb", + "to": "0xefffffffffffffffff90ba988" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xb", + "to": "0xc" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab2e", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0040000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x2a29", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "call", + "from": "0x0040000000000000000000000000000000000000", + "gas": "0xfba993", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x2728", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x2b701e0b45e80f1c179a3696786aff2a411a51b03153528d1579f20915def5e4", + "vmTrace": { + "code": "0x60206000602036038060206000376000346000355af160206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755499 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755496 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755493 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755491 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755488 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755485 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755482 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755479 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755452 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755449 + }, + "pc": 14, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755447 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755444 + }, + "pc": 17, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755441 + }, + "pc": 19, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaaef" + ], + "store": null, + "used": 16755439 + }, + "pc": 20, + "sub": null + }, + { + "cost": 16493647, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16744715 + }, + "pc": 21, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492944 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x3" + ], + "store": null, + "used": 16492941 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492938 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492935 + }, + "pc": 5, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x3" + }, + "used": 16487935 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16487932 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x4" + ], + "store": null, + "used": 16487929 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16487926 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16487923 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x4" + }, + "used": 16482923 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16744712 + }, + "pc": 22, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16744709 + }, + "pc": 24, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16744709 + }, + "pc": 26, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x22b1c8c15f40f0938", + "to": "0x22b1c8c15f4429b2b" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0010000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000003", + "to": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff90ba988", + "to": "0xefffffffffffffffff8d81795" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xc", + "to": "0xd" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab3a", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0040000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x19c1", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "call", + "from": "0x0040000000000000000000000000000000000000", + "gas": "0xfba99f", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x16c0", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0xcc81ab56669a97c5debfff3e23ab5ffb366f04c8c7eaf83f259c975c1816cb41", + "vmTrace": { + "code": "0x60206000602036038060206000376000346000355af160206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755511 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755508 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755505 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755503 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755500 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755497 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755494 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755491 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755464 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755461 + }, + "pc": 14, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755459 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755456 + }, + "pc": 17, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755453 + }, + "pc": 19, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaafb" + ], + "store": null, + "used": 16755451 + }, + "pc": 20, + "sub": null + }, + { + "cost": 16493659, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16748927 + }, + "pc": 21, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492956 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x3" + ], + "store": null, + "used": 16492953 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492950 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492947 + }, + "pc": 5, + "sub": null + }, + { + "cost": 800, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x3" + }, + "used": 16492147 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16492144 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492141 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16492138 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492135 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x0" + }, + "used": 16487135 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16748924 + }, + "pc": 22, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16748921 + }, + "pc": 24, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16748921 + }, + "pc": 26, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x22b1c8c15f4429b2b", + "to": "0x22b1c8c15f4762784" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0010000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff8d81795", + "to": "0xefffffffffffffffff8a48b3c" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xd", + "to": "0xe" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab46", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0040000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x19c1", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "call", + "from": "0x0040000000000000000000000000000000000000", + "gas": "0xfba9aa", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x16c0", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x422edfe209e8b97f77a8e879db5182158f23e823ba7f59725d463d99d7ae66bd", + "vmTrace": { + "code": "0x60206000602036038060206000376000346000355af160206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755523 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755520 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755517 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755515 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755512 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755509 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755506 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755503 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755476 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755473 + }, + "pc": 14, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755471 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755468 + }, + "pc": 17, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755465 + }, + "pc": 19, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffab07" + ], + "store": null, + "used": 16755463 + }, + "pc": 20, + "sub": null + }, + { + "cost": 16493670, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16748939 + }, + "pc": 21, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492967 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492964 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492961 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492958 + }, + "pc": 5, + "sub": null + }, + { + "cost": 800, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x0" + }, + "used": 16492158 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16492155 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492152 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16492149 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16492146 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x0" + }, + "used": 16487146 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16748936 + }, + "pc": 22, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16748933 + }, + "pc": 24, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16748933 + }, + "pc": 26, + "sub": null + } + ] + } + } + ], + "id": 415 + }, + "statusCode": 200 +} diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x16.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x16.json new file mode 100644 index 00000000000..ad20ec57a05 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x16.json @@ -0,0 +1,1818 @@ +{ + "request": { + "jsonrpc": "2.0", + "method": "trace_replayBlockTransactions", + "params": [ + "0x16", + [ + "trace", + "vmTrace", + "stateDiff" + ] + ], + "id": 415 + }, + "response": { + "jsonrpc": "2.0", + "result": [ + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x246ddf97d433e2784", + "to": "0x246ddf97d44220cb9" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0060000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0000000000000000000000000000000000000000000000000000000000000001" + } + }, + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0000000000000000000000000000000000000000000000000000000000000002" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff8a48b3c", + "to": "0xefffffffffffffffff7c0a607" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xe", + "to": "0xf" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab2e", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0060000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x9f57", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "delegatecall", + "from": "0x0060000000000000000000000000000000000000", + "gas": "0xfba995", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x9c58", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x1f74ac428df5427f3a5576869e870cfff6712e4cffb1506bb4ef8f36c5e48162", + "vmTrace": { + "code": "0x602060006020360380602060003760006000355af460206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755499 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755496 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755493 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755491 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755488 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755485 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755482 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755479 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755452 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755449 + }, + "pc": 14, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755446 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755443 + }, + "pc": 18, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaaf1" + ], + "store": null, + "used": 16755441 + }, + "pc": 19, + "sub": null + }, + { + "cost": 16493649, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16714717 + }, + "pc": 20, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492946 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492943 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492940 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492937 + }, + "pc": 5, + "sub": null + }, + { + "cost": 20000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x1" + }, + "used": 16472937 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16472934 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16472931 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16472928 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16472925 + }, + "pc": 12, + "sub": null + }, + { + "cost": 20000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x2" + }, + "used": 16452925 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16714714 + }, + "pc": 21, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16714711 + }, + "pc": 23, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16714711 + }, + "pc": 25, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x246ddf97d44220cb9", + "to": "0x246ddf97d44988a1e" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0060000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000001", + "to": "0x0000000000000000000000000000000000000000000000000000000000000003" + } + }, + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000002", + "to": "0x0000000000000000000000000000000000000000000000000000000000000004" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff7c0a607", + "to": "0xefffffffffffffffff74a28a2" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0xf", + "to": "0x10" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab2e", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0060000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x2a27", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "delegatecall", + "from": "0x0060000000000000000000000000000000000000", + "gas": "0xfba995", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x2728", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x43d6ba1caeced03b6fa8cc3549c0557eea52917f1de50f4da23c9642beca95ee", + "vmTrace": { + "code": "0x602060006020360380602060003760006000355af460206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755499 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755496 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755493 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755491 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755488 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755485 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755482 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755479 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755452 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755449 + }, + "pc": 14, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755446 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755443 + }, + "pc": 18, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaaf1" + ], + "store": null, + "used": 16755441 + }, + "pc": 19, + "sub": null + }, + { + "cost": 16493649, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16744717 + }, + "pc": 20, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492946 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x3" + ], + "store": null, + "used": 16492943 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492940 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492937 + }, + "pc": 5, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x3" + }, + "used": 16487937 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16487934 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x4" + ], + "store": null, + "used": 16487931 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16487928 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16487925 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x4" + }, + "used": 16482925 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16744714 + }, + "pc": 21, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16744711 + }, + "pc": 23, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16744711 + }, + "pc": 25, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x246ddf97d44988a1e", + "to": "0x246ddf97d44cc1b22" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0060000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000003", + "to": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff74a28a2", + "to": "0xefffffffffffffffff716979e" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0x10", + "to": "0x11" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab3a", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0060000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x19bf", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "delegatecall", + "from": "0x0060000000000000000000000000000000000000", + "gas": "0xfba9a0", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x16c0", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0x9eb50f31fc1d953e27331cd923f6b2f7fa11827d399c70aec00a04cf98cfd2ac", + "vmTrace": { + "code": "0x602060006020360380602060003760006000355af460206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755511 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755508 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755505 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755503 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755500 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755497 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755494 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755491 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755464 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755461 + }, + "pc": 14, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755458 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755455 + }, + "pc": 18, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffaafd" + ], + "store": null, + "used": 16755453 + }, + "pc": 19, + "sub": null + }, + { + "cost": 16493660, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16748929 + }, + "pc": 20, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492957 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x3" + ], + "store": null, + "used": 16492954 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492951 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492948 + }, + "pc": 5, + "sub": null + }, + { + "cost": 800, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x3" + }, + "used": 16492148 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16492145 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492142 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16492139 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492136 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x0" + }, + "used": 16487136 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16748926 + }, + "pc": 21, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16748923 + }, + "pc": 23, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16748923 + }, + "pc": 25, + "sub": null + } + ] + } + }, + { + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", + "stateDiff": { + "0x0000000000000000000000000000000000000000": { + "balance": { + "*": { + "from": "0x246ddf97d44cc1b22", + "to": "0x246ddf97d44ffa68c" + } + }, + "code": "=", + "nonce": "=", + "storage": {} + }, + "0x0060000000000000000000000000000000000000": { + "balance": "=", + "code": "=", + "nonce": "=", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "*": { + "from": "0x0000000000000000000000000000000000000000000000000000000000000004", + "to": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + }, + "0x627306090abab3a6e1400e9345bc60c78a8bef57": { + "balance": { + "*": { + "from": "0xefffffffffffffffff716979e", + "to": "0xefffffffffffffffff6e30c34" + } + }, + "code": "=", + "nonce": { + "*": { + "from": "0x11", + "to": "0x12" + } + }, + "storage": {} + } + }, + "trace": [ + { + "action": { + "callType": "call", + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gas": "0xffab46", + "input": "0x00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0060000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x19bf", + "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "subtraces": 1, + "traceAddress": [], + "type": "call" + }, + { + "action": { + "callType": "delegatecall", + "from": "0x0060000000000000000000000000000000000000", + "gas": "0xfba9ac", + "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "to": "0x0010000000000000000000000000000000000000", + "value": "0x0" + }, + "result": { + "gasUsed": "0x16c0", + "output": "0x" + }, + "subtraces": 0, + "traceAddress": [ + 0 + ], + "type": "call" + } + ], + "transactionHash": "0xe2ef09a0b71f50947bd0bd1cacac77903d2a5fce80f34862bd4559727e0f608c", + "vmTrace": { + "code": "0x602060006020360380602060003760006000355af460206000f3", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755523 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755520 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755517 + }, + "pc": 4, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xa0" + ], + "store": null, + "used": 16755515 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80" + ], + "store": null, + "used": 16755512 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x80", + "0x80" + ], + "store": null, + "used": 16755509 + }, + "pc": 8, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16755506 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755503 + }, + "pc": 11, + "sub": null + }, + { + "cost": 27, + "ex": { + "mem": { + "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000", + "off": 0 + }, + "push": [], + "store": null, + "used": 16755476 + }, + "pc": 13, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755473 + }, + "pc": 14, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16755470 + }, + "pc": 16, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x10000000000000000000000000000000000000" + ], + "store": null, + "used": 16755467 + }, + "pc": 18, + "sub": null + }, + { + "cost": 2, + "ex": { + "mem": null, + "push": [ + "0xffab09" + ], + "store": null, + "used": 16755465 + }, + "pc": 19, + "sub": null + }, + { + "cost": 16493672, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16748941 + }, + "pc": 20, + "sub": { + "code": "0x6020356000355560603560403555", + "ops": [ + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16492969 + }, + "pc": 0, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492966 + }, + "pc": 2, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492963 + }, + "pc": 3, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x1" + ], + "store": null, + "used": 16492960 + }, + "pc": 5, + "sub": null + }, + { + "cost": 800, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x1", + "val": "0x0" + }, + "used": 16492160 + }, + "pc": 6, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x60" + ], + "store": null, + "used": 16492157 + }, + "pc": 7, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16492154 + }, + "pc": 9, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x40" + ], + "store": null, + "used": 16492151 + }, + "pc": 10, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x2" + ], + "store": null, + "used": 16492148 + }, + "pc": 12, + "sub": null + }, + { + "cost": 5000, + "ex": { + "mem": null, + "push": [], + "store": { + "key": "0x2", + "val": "0x0" + }, + "used": 16487148 + }, + "pc": 13, + "sub": null + } + ] + } + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x20" + ], + "store": null, + "used": 16748938 + }, + "pc": 21, + "sub": null + }, + { + "cost": 3, + "ex": { + "mem": null, + "push": [ + "0x0" + ], + "store": null, + "used": 16748935 + }, + "pc": 23, + "sub": null + }, + { + "cost": 0, + "ex": { + "mem": null, + "push": [], + "store": null, + "used": 16748935 + }, + "pc": 25, + "sub": null + } + ] + } + } + ], + "id": 415 + }, + "statusCode": 200 +} diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xB.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xB.json index b29e7b46b92..4a54813786e 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xB.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xB.json @@ -16,13 +16,13 @@ "jsonrpc": "2.0", "result": [ { - "output": "0xf000000000000000000000000000000000000000000000000000000000000001", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002", "stateDiff": { "0x0000000000000000000000000000000000000000": { "balance": { "*": { "from": "0x1158e460918415e6b", - "to": "0x1158e46091891dad5" + "to": "0x1158e46091891d8f7" } }, "code": "=", @@ -33,7 +33,7 @@ "balance": { "*": { "from": "0xffffffffffffffffffffffffffffffffffd4565fa", - "to": "0xffffffffffffffffffffffffffffffffffcf4e990" + "to": "0xffffffffffffffffffffffffffffffffffcf4eb6e" } }, "code": "=", @@ -57,8 +57,8 @@ "value": "0x0" }, "result": { - "gasUsed": "0x30a", - "output": "0xf000000000000000000000000000000000000000000000000000000000000001" + "gasUsed": "0x308", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002" }, "subtraces": 1, "traceAddress": [], @@ -68,14 +68,14 @@ "action": { "callType": "delegatecall", "from": "0x0060000000000000000000000000000000000000", - "gas": "0xfbab36", - "input": "0x", + "gas": "0xfbab38", + "input": "0xf000000000000000000000000000000000000000000000000000000000000001", "to": "0x0030000000000000000000000000000000000000", "value": "0x0" }, "result": { "gasUsed": "0x1b", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + "output": "0xf000000000000000000000000000000000000000000000000000000000000002" }, "subtraces": 0, "traceAddress": [ @@ -86,7 +86,7 @@ ], "transactionHash": "0x6f77512ee9d43474a884c0703c86712fb98dca772fa6e12252786e3e23f196c1", "vmTrace": { - "code": "0x60206000602036038060206000376000346000355af460206000f3", + "code": "0x602060006020360380602060003760006000355af460206000f3", "ops": [ { "cost": 3, @@ -220,19 +220,6 @@ "pc": 14, "sub": null }, - { - "cost": 2, - "ex": { - "mem": null, - "push": [ - "0x0" - ], - "store": null, - "used": 16755873 - }, - "pc": 16, - "sub": null - }, { "cost": 3, "ex": { @@ -241,9 +228,9 @@ "0x0" ], "store": null, - "used": 16755870 + "used": 16755872 }, - "pc": 17, + "pc": 16, "sub": null }, { @@ -254,9 +241,9 @@ "0x30000000000000000000000000000000000000" ], "store": null, - "used": 16755867 + "used": 16755869 }, - "pc": 19, + "pc": 18, "sub": null }, { @@ -264,25 +251,28 @@ "ex": { "mem": null, "push": [ - "0xffac99" + "0xffac9b" ], "store": null, - "used": 16755865 + "used": 16755867 }, - "pc": 20, + "pc": 19, "sub": null }, { - "cost": 16494066, + "cost": 16494068, "ex": { - "mem": null, + "mem": { + "data": "0xf000000000000000000000000000000000000000000000000000000000000002", + "off": 0 + }, "push": [ "0x1" ], "store": null, - "used": 16755138 + "used": 16755140 }, - "pc": 21, + "pc": 20, "sub": { "code": "0x60003560010160005260206000f3", "ops": [ @@ -294,7 +284,7 @@ "0x0" ], "store": null, - "used": 16493363 + "used": 16493365 }, "pc": 0, "sub": null @@ -304,10 +294,10 @@ "ex": { "mem": null, "push": [ - "0x0" + "0xf000000000000000000000000000000000000000000000000000000000000001" ], "store": null, - "used": 16493360 + "used": 16493362 }, "pc": 2, "sub": null @@ -320,7 +310,7 @@ "0x1" ], "store": null, - "used": 16493357 + "used": 16493359 }, "pc": 3, "sub": null @@ -330,10 +320,10 @@ "ex": { "mem": null, "push": [ - "0x1" + "0xf000000000000000000000000000000000000000000000000000000000000002" ], "store": null, - "used": 16493354 + "used": 16493356 }, "pc": 5, "sub": null @@ -346,7 +336,7 @@ "0x0" ], "store": null, - "used": 16493351 + "used": 16493353 }, "pc": 6, "sub": null @@ -355,12 +345,12 @@ "cost": 6, "ex": { "mem": { - "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "data": "0xf000000000000000000000000000000000000000000000000000000000000002", "off": 0 }, "push": [], "store": null, - "used": 16493345 + "used": 16493347 }, "pc": 8, "sub": null @@ -373,7 +363,7 @@ "0x20" ], "store": null, - "used": 16493342 + "used": 16493344 }, "pc": 9, "sub": null @@ -386,7 +376,7 @@ "0x0" ], "store": null, - "used": 16493339 + "used": 16493341 }, "pc": 11, "sub": null @@ -397,7 +387,7 @@ "mem": null, "push": [], "store": null, - "used": 16493339 + "used": 16493341 }, "pc": 13, "sub": null @@ -413,9 +403,9 @@ "0x20" ], "store": null, - "used": 16755135 + "used": 16755137 }, - "pc": 22, + "pc": 21, "sub": null }, { @@ -426,9 +416,9 @@ "0x0" ], "store": null, - "used": 16755132 + "used": 16755134 }, - "pc": 24, + "pc": 23, "sub": null }, { @@ -437,9 +427,9 @@ "mem": null, "push": [], "store": null, - "used": 16755132 + "used": 16755134 }, - "pc": 26, + "pc": 25, "sub": null } ] diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xC.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xC.json index 6b3631a799b..b4ca52c3bcc 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xC.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xC.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1314fb3706759dad5", - "to": "0x1314fb37067a68c4f" + "from": "0x1314fb3706759d8f7", + "to": "0x1314fb37067a68a71" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffffcf4e990", - "to": "0xffffffffffffffffffffffffffffffffffca83816" + "from": "0xffffffffffffffffffffffffffffffffffcf4eb6e", + "to": "0xffffffffffffffffffffffffffffffffffca839f4" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xD.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xD.json index 282e1627bae..c5ef972bd0d 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xD.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xD.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x14d1120d7b66e8c4f", - "to": "0x14d1120d8a56e7f3d" + "from": "0x14d1120d7b66e8a71", + "to": "0x14d1120d8a56e7d5f" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffffca83816", - "to": "0xfffffffffffffffffffffffffffffffff0da84528" + "from": "0xffffffffffffffffffffffffffffffffffca839f4", + "to": "0xfffffffffffffffffffffffffffffffff0da84706" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xE.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xE.json index c426eae37a9..d3d700c80c7 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xE.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xE.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff4367f3d", - "to": "0x168d28e3ff4cf0b77" + "from": "0x168d28e3ff4367d5f", + "to": "0x168d28e3ff4cf0999" } }, "code": "=", @@ -45,8 +45,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0da84528", - "to": "0xfffffffffffffffffffffffffffffffff0d0fb8ee" + "from": "0xfffffffffffffffffffffffffffffffff0da84706", + "to": "0xfffffffffffffffffffffffffffffffff0d0fbacc" } }, "code": "=", @@ -248,8 +248,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff4cf0b77", - "to": "0x168d28e3ff530e3c9" + "from": "0x168d28e3ff4cf0999", + "to": "0x168d28e3ff530e1eb" } }, "code": "=", @@ -272,8 +272,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0d0fb8ee", - "to": "0xfffffffffffffffffffffffffffffffff0cade09c" + "from": "0xfffffffffffffffffffffffffffffffff0d0fbacc", + "to": "0xfffffffffffffffffffffffffffffffff0cade27a" } }, "code": "=", @@ -475,8 +475,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff530e3c9", - "to": "0x168d28e3ff592bc1b" + "from": "0x168d28e3ff530e1eb", + "to": "0x168d28e3ff592ba3d" } }, "code": "=", @@ -499,8 +499,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0cade09c", - "to": "0xfffffffffffffffffffffffffffffffff0c4c084a" + "from": "0xfffffffffffffffffffffffffffffffff0cade27a", + "to": "0xfffffffffffffffffffffffffffffffff0c4c0a28" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xF.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xF.json index b84c7871ae0..78a95548e82 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xF.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0xF.json @@ -21,8 +21,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x18493fba7445abc1b", - "to": "0x18493fba744aa28d8" + "from": "0x18493fba7445aba3d", + "to": "0x18493fba744aa26fa" } }, "code": "=", @@ -32,8 +32,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0c4c084a", - "to": "0xfffffffffffffffffffffffffffffffff0bfc9b8d" + "from": "0xfffffffffffffffffffffffffffffffff0c4c0a28", + "to": "0xfffffffffffffffffffffffffffffffff0bfc9d6b" } }, "code": "=", @@ -168,8 +168,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x18493fba744aa28d8", - "to": "0x18493fba744faf67b" + "from": "0x18493fba744aa26fa", + "to": "0x18493fba744faf49d" } }, "code": "=", @@ -179,8 +179,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0bfc9b8d", - "to": "0xfffffffffffffffffffffffffffffffff0babcdea" + "from": "0xfffffffffffffffffffffffffffffffff0bfc9d6b", + "to": "0xfffffffffffffffffffffffffffffffff0babcfc8" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/flat/trace_replayBlockTransactions_traceOnly_0xB.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/flat/trace_replayBlockTransactions_traceOnly_0xB.json index 2d2fa4ba218..df936cecb1c 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/flat/trace_replayBlockTransactions_traceOnly_0xB.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/flat/trace_replayBlockTransactions_traceOnly_0xB.json @@ -14,7 +14,7 @@ "jsonrpc": "2.0", "result": [ { - "output": "0xf000000000000000000000000000000000000000000000000000000000000001", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002", "stateDiff": null, "trace": [ { @@ -27,8 +27,8 @@ "value": "0x0" }, "result": { - "gasUsed": "0x30a", - "output": "0xf000000000000000000000000000000000000000000000000000000000000001" + "gasUsed": "0x308", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002" }, "subtraces": 1, "traceAddress": [], @@ -38,14 +38,14 @@ "action": { "callType": "delegatecall", "from": "0x0060000000000000000000000000000000000000", - "gas": "0xfbab36", - "input": "0x", + "gas": "0xfbab38", + "input": "0xf000000000000000000000000000000000000000000000000000000000000001", "to": "0x0030000000000000000000000000000000000000", "value": "0x0" }, "result": { "gasUsed": "0x1b", - "output": "0x0000000000000000000000000000000000000000000000000000000000000001" + "output": "0xf000000000000000000000000000000000000000000000000000000000000002" }, "subtraces": 0, "traceAddress": [ diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xB.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xB.json index 58a2f8724bd..862269a7543 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xB.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xB.json @@ -14,13 +14,13 @@ "jsonrpc": "2.0", "result": [ { - "output": "0xf000000000000000000000000000000000000000000000000000000000000001", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002", "stateDiff": { "0x0000000000000000000000000000000000000000": { "balance": { "*": { "from": "0x1158e460918415e6b", - "to": "0x1158e46091891dad5" + "to": "0x1158e46091891d8f7" } }, "code": "=", @@ -31,7 +31,7 @@ "balance": { "*": { "from": "0xffffffffffffffffffffffffffffffffffd4565fa", - "to": "0xffffffffffffffffffffffffffffffffffcf4e990" + "to": "0xffffffffffffffffffffffffffffffffffcf4eb6e" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xC.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xC.json index cd39358dded..c81db19c5b0 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xC.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xC.json @@ -19,8 +19,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x1314fb3706759dad5", - "to": "0x1314fb37067a68c4f" + "from": "0x1314fb3706759d8f7", + "to": "0x1314fb37067a68a71" } }, "code": "=", @@ -30,8 +30,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffffcf4e990", - "to": "0xffffffffffffffffffffffffffffffffffca83816" + "from": "0xffffffffffffffffffffffffffffffffffcf4eb6e", + "to": "0xffffffffffffffffffffffffffffffffffca839f4" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xD.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xD.json index b12755265ef..fc619f11e66 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xD.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xD.json @@ -19,8 +19,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x14d1120d7b66e8c4f", - "to": "0x14d1120d8a56e7f3d" + "from": "0x14d1120d7b66e8a71", + "to": "0x14d1120d8a56e7d5f" } }, "code": "=", @@ -30,8 +30,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xffffffffffffffffffffffffffffffffffca83816", - "to": "0xfffffffffffffffffffffffffffffffff0da84528" + "from": "0xffffffffffffffffffffffffffffffffffca839f4", + "to": "0xfffffffffffffffffffffffffffffffff0da84706" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xE.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xE.json index 8e4d803f21f..ee6862e7f53 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xE.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/statediff/trace_replayBlockTransactions_diffOnly_0xE.json @@ -19,8 +19,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff4367f3d", - "to": "0x168d28e3ff4cf0b77" + "from": "0x168d28e3ff4367d5f", + "to": "0x168d28e3ff4cf0999" } }, "code": "=", @@ -43,8 +43,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0da84528", - "to": "0xfffffffffffffffffffffffffffffffff0d0fb8ee" + "from": "0xfffffffffffffffffffffffffffffffff0da84706", + "to": "0xfffffffffffffffffffffffffffffffff0d0fbacc" } }, "code": "=", @@ -67,8 +67,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff4cf0b77", - "to": "0x168d28e3ff530e3c9" + "from": "0x168d28e3ff4cf0999", + "to": "0x168d28e3ff530e1eb" } }, "code": "=", @@ -91,8 +91,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0d0fb8ee", - "to": "0xfffffffffffffffffffffffffffffffff0cade09c" + "from": "0xfffffffffffffffffffffffffffffffff0d0fbacc", + "to": "0xfffffffffffffffffffffffffffffffff0cade27a" } }, "code": "=", @@ -115,8 +115,8 @@ "0x0000000000000000000000000000000000000000": { "balance": { "*": { - "from": "0x168d28e3ff530e3c9", - "to": "0x168d28e3ff592bc1b" + "from": "0x168d28e3ff530e1eb", + "to": "0x168d28e3ff592ba3d" } }, "code": "=", @@ -139,8 +139,8 @@ "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { "balance": { "*": { - "from": "0xfffffffffffffffffffffffffffffffff0cade09c", - "to": "0xfffffffffffffffffffffffffffffffff0c4c084a" + "from": "0xfffffffffffffffffffffffffffffffff0cade27a", + "to": "0xfffffffffffffffffffffffffffffffff0c4c0a28" } }, "code": "=", diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/vm-trace/trace_replayBlockTransactions_0xB.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/vm-trace/trace_replayBlockTransactions_0xB.json index d3858d5a9db..ce46a14e1c2 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/vm-trace/trace_replayBlockTransactions_0xB.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/vm-trace/trace_replayBlockTransactions_0xB.json @@ -14,12 +14,12 @@ "jsonrpc": "2.0", "result": [ { - "output": "0xf000000000000000000000000000000000000000000000000000000000000001", + "output": "0xf000000000000000000000000000000000000000000000000000000000000002", "stateDiff": null, "trace": [], "transactionHash": "0x6f77512ee9d43474a884c0703c86712fb98dca772fa6e12252786e3e23f196c1", "vmTrace": { - "code": "0x60206000602036038060206000376000346000355af460206000f3", + "code": "0x602060006020360380602060003760006000355af460206000f3", "ops": [ { "cost": 3, @@ -153,19 +153,6 @@ "pc": 14, "sub": null }, - { - "cost": 2, - "ex": { - "mem": null, - "push": [ - "0x0" - ], - "store": null, - "used": 16755873 - }, - "pc": 16, - "sub": null - }, { "cost": 3, "ex": { @@ -174,9 +161,9 @@ "0x0" ], "store": null, - "used": 16755870 + "used": 16755872 }, - "pc": 17, + "pc": 16, "sub": null }, { @@ -187,9 +174,9 @@ "0x30000000000000000000000000000000000000" ], "store": null, - "used": 16755867 + "used": 16755869 }, - "pc": 19, + "pc": 18, "sub": null }, { @@ -197,25 +184,28 @@ "ex": { "mem": null, "push": [ - "0xffac99" + "0xffac9b" ], "store": null, - "used": 16755865 + "used": 16755867 }, - "pc": 20, + "pc": 19, "sub": null }, { - "cost": 16494066, + "cost": 16494068, "ex": { - "mem": null, + "mem": { + "data": "0xf000000000000000000000000000000000000000000000000000000000000002", + "off": 0 + }, "push": [ "0x1" ], "store": null, - "used": 16755138 + "used": 16755140 }, - "pc": 21, + "pc": 20, "sub": { "code": "0x60003560010160005260206000f3", "ops": [ @@ -227,7 +217,7 @@ "0x0" ], "store": null, - "used": 16493363 + "used": 16493365 }, "pc": 0, "sub": null @@ -237,10 +227,10 @@ "ex": { "mem": null, "push": [ - "0x0" + "0xf000000000000000000000000000000000000000000000000000000000000001" ], "store": null, - "used": 16493360 + "used": 16493362 }, "pc": 2, "sub": null @@ -253,7 +243,7 @@ "0x1" ], "store": null, - "used": 16493357 + "used": 16493359 }, "pc": 3, "sub": null @@ -263,10 +253,10 @@ "ex": { "mem": null, "push": [ - "0x1" + "0xf000000000000000000000000000000000000000000000000000000000000002" ], "store": null, - "used": 16493354 + "used": 16493356 }, "pc": 5, "sub": null @@ -279,7 +269,7 @@ "0x0" ], "store": null, - "used": 16493351 + "used": 16493353 }, "pc": 6, "sub": null @@ -288,12 +278,12 @@ "cost": 6, "ex": { "mem": { - "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "data": "0xf000000000000000000000000000000000000000000000000000000000000002", "off": 0 }, "push": [], "store": null, - "used": 16493345 + "used": 16493347 }, "pc": 8, "sub": null @@ -306,7 +296,7 @@ "0x20" ], "store": null, - "used": 16493342 + "used": 16493344 }, "pc": 9, "sub": null @@ -319,7 +309,7 @@ "0x0" ], "store": null, - "used": 16493339 + "used": 16493341 }, "pc": 11, "sub": null @@ -330,7 +320,7 @@ "mem": null, "push": [], "store": null, - "used": 16493339 + "used": 16493341 }, "pc": 13, "sub": null @@ -346,9 +336,9 @@ "0x20" ], "store": null, - "used": 16755135 + "used": 16755137 }, - "pc": 22, + "pc": 21, "sub": null }, { @@ -359,9 +349,9 @@ "0x0" ], "store": null, - "used": 16755132 + "used": 16755134 }, - "pc": 24, + "pc": 23, "sub": null }, { @@ -370,9 +360,9 @@ "mem": null, "push": [], "store": null, - "used": 16755132 + "used": 16755134 }, - "pc": 26, + "pc": 25, "sub": null } ] diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java index b8e2132f555..a992e70d13e 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/debug/TraceFrame.java @@ -53,7 +53,6 @@ public class TraceFrame { private final Optional maybeCode; private final int stackItemsProduced; private final Optional stackPostExecution; - private Optional maybeNextDepth; private Gas gasRemainingPostExecution; private final boolean virtualOperation; @@ -105,7 +104,6 @@ public TraceFrame( this.maybeCode = maybeCode; this.stackItemsProduced = stackItemsProduced; this.stackPostExecution = stackPostExecution; - this.maybeNextDepth = Optional.empty(); this.virtualOperation = virtualOperation; this.maybeUpdatedMemory = maybeUpdatedMemory; this.maybeUpdatedStorage = maybeUpdatedStorage; @@ -207,18 +205,6 @@ public Optional getStackPostExecution() { return stackPostExecution; } - public boolean depthHasIncreased() { - return maybeNextDepth.map(next -> next > depth).orElse(false); - } - - public boolean depthHasDecreased() { - return maybeNextDepth.map(next -> next < depth).orElse(false); - } - - public void setMaybeNextDepth(final Optional maybeNextDepth) { - this.maybeNextDepth = maybeNextDepth; - } - public Gas getGasRemainingPostExecution() { return gasRemainingPostExecution; } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java index 590794d2131..24ebc026239 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java @@ -70,7 +70,6 @@ public void traceExecution( final Optional memory = captureMemory(frame); stackPostExecution = captureStack(frame); if (lastFrame != null) { - lastFrame.setMaybeNextDepth(Optional.of(depth)); lastFrame.setGasRemainingPostExecution(gasRemaining); } final Optional> storage = captureStorage(frame); From 9586a2fe08cef55132b003ac3de8c1d71b64326f Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sun, 9 Feb 2020 23:29:58 -0700 Subject: [PATCH 5/8] spotless Signed-off-by: Danno Ferrin --- .../internal/results/tracing/vm/VmTraceGenerator.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index e59dfdb4a8c..86b1b1cf962 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -143,9 +143,7 @@ private void handleDepthIncreased(final VmOperation op, final VmOperationExecuti .ifPresent(report::setMem); } }); - if ( - /*(currentTraceFrame.getDepth() > lastDepth) - && */ currentTraceFrame.getMaybeCode().map(Code::getSize).orElse(0) > 0) { + if (currentTraceFrame.getMaybeCode().map(Code::getSize).orElse(0) > 0) { op.setCost(currentTraceFrame.getGasRemainingPostExecution().toLong() + op.getCost()); final VmTrace newSubTrace = new VmTrace(); parentTraces.addLast(newSubTrace); @@ -174,7 +172,7 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); - //op.setOperation(currentOperation); + // op.setOperation(currentOperation); return op; } From 945047efd3ac95c8d03012164aa4d3d4ecd13952 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 10 Feb 2020 08:10:01 -0700 Subject: [PATCH 6/8] NEw place for an NPE. Signed-off-by: Danno Ferrin --- .../org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java index 24ebc026239..f65a36a1aed 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/DebugOperationTracer.java @@ -94,7 +94,7 @@ public void traceExecution( worldUpdater, frame.getRevertReason(), maybeRefunds, - Optional.ofNullable(frame.getMessageFrameStack().peek().getCode()), + Optional.ofNullable(frame.getMessageFrameStack().peek()).map(MessageFrame::getCode), frame.getCurrentOperation().getStackItemsProduced(), stackPostExecution, currentOperation.isVirtualOperation(), From 4acaa74f16edc876223d4173832b528e0b8abd8c Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 10 Feb 2020 10:31:37 -0700 Subject: [PATCH 7/8] Don't adjust depth when processing virtual instructions Signed-off-by: Danno Ferrin --- .../jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index 86b1b1cf962..a7e38ecd90b 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -89,8 +89,8 @@ private void addFrame(final TraceFrame frame) { generateTracingStorage(report); handleDepthIncreased(op, report); completeStep(op, report); + lastDepth = frame.getDepth(); } - lastDepth = frame.getDepth(); } private boolean mustIgnore(final TraceFrame frame) { @@ -172,7 +172,7 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); - // op.setOperation(currentOperation); + //op.setOperation(currentOperation); return op; } From 552ea215772dc97517106c7af5e8e865c8129798 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 10 Feb 2020 10:37:15 -0700 Subject: [PATCH 8/8] spotless Signed-off-by: Danno Ferrin --- .../jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java index a7e38ecd90b..6c8a2db6e80 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmTraceGenerator.java @@ -172,7 +172,7 @@ private VmOperation buildVmOperation() { // set gas cost and program counter op.setCost(currentTraceFrame.getGasCost().orElse(Gas.ZERO).toLong()); op.setPc(currentTraceFrame.getPc()); - //op.setOperation(currentOperation); + // op.setOperation(currentOperation); return op; }