From d6c1aa31a0cc43e9883917d5e452110d68558da0 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 9 Dec 2024 10:05:39 -0700 Subject: [PATCH 1/5] EIP-7756 Trace updates Update tracing for EIP-7756 changes, mostly swapping hex format and numbers for opcode and gas members. Signed-off-by: Danno Ferrin --- .../internal/processor/TransactionTracer.java | 4 +- .../besu/evmtool/EvmToolCommand.java | 10 +- .../besu/evmtool/StateTestSubCommand.java | 9 +- .../besu/evmtool/T8nServerSubCommand.java | 3 +- .../besu/evmtool/T8nSubCommand.java | 3 +- .../state-test/all-trace-flags-disabled.json | 50 ++++---- .../evmtool/state-test/all-trace-flags.json | 1 + .../besu/evmtool/state-test/blockhash.json | 52 ++++----- .../besu/evmtool/state-test/create-eof.json | 22 ++-- .../state-test/create-invalid-eof.json | 6 +- .../besu/evmtool/state-test/no-memory.json | 50 ++++---- .../state-test/shanghai-blockhash.json | 28 ++--- .../besu/evmtool/trace/badcode.json | 4 +- .../besu/evmtool/trace/charge-intrinsic.json | 108 +++++++++--------- .../besu/evmtool/trace/coinbase-cold.json | 6 +- .../besu/evmtool/trace/coinbase-warm.json | 6 +- .../besu/evmtool/trace/create-eof.json | 16 +-- .../besu/evmtool/trace/eof-section.json | 14 +-- .../hyperledger/besu/evmtool/trace/eof.json | 2 +- .../besu/evmtool/trace/revert.json | 12 +- .../besu/evmtool/trace/warm-contract.json | 108 +++++++++--------- .../besu/evm/tracing/StandardJsonTracer.java | 93 ++++++++++++--- .../besu/evm/StandardJsonTracerTest.java | 77 ++++++++++--- 23 files changed, 402 insertions(+), 282 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTracer.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTracer.java index 6524109ac6f..460ee2a6427 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTracer.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/processor/TransactionTracer.java @@ -136,7 +136,9 @@ public List traceTransactionToFile( stackedUpdater, transaction, transactionProcessor, - new StandardJsonTracer(out, showMemory, true, true, false), + // FIXME // REVIEWME do we want to change the JSON + // debug calls to use EIP-7756 values for gas and opcode? + new StandardJsonTracer(out, showMemory, true, true, false, true), blobGasPrice); out.println( summaryTrace( diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java index 2574d4b8e39..607d7cf6626 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java @@ -200,6 +200,13 @@ void setBytes(final String optionValue) { scope = INHERIT) final Boolean showJsonAlloc = false; + @Option( + names = {"--eip-3155", "--trace.eip-3155"}, + description = "Produce a trace with types strictly compatible with EIP-3155.", + scope = INHERIT, + negatable = true) + final Boolean eip3155strict = false; + @Option( names = {"--memory", "--trace.memory"}, description = @@ -441,7 +448,8 @@ public void run() { final OperationTracer tracer = // You should have picked Mercy. lastLoop && showJsonResults - ? new StandardJsonTracer(out, showMemory, !hideStack, showReturnData, showStorage) + ? new StandardJsonTracer( + out, showMemory, !hideStack, showReturnData, showStorage, eip3155strict) : OperationTracer.NO_TRACING; WorldUpdater updater = component.getWorldUpdater(); diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java index f6e05b5a498..9e99eae4986 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java @@ -208,7 +208,8 @@ private void traceTestSpecs(final String test, final List stack; - private String gas; + private long gas; private Bytes memory; private int memorySize; private int depth; - private int subdepth; + private int functionDepth; private String storageString; /** @@ -65,11 +66,32 @@ public StandardJsonTracer( final boolean showStack, final boolean showReturnData, final boolean showStorage) { + this(out, showMemory, showStack, showReturnData, showStorage, false); + } + + /** + * Instantiates a new Standard json tracer. + * + * @param out the out + * @param showMemory show memory in trace lines + * @param showStack show the stack in trace lines + * @param showReturnData show return data in trace lines + * @param showStorage show the updated storage + * @param eip3155strict Output EIP-3155 compatible traces + */ + public StandardJsonTracer( + final PrintWriter out, + final boolean showMemory, + final boolean showStack, + final boolean showReturnData, + final boolean showStorage, + final boolean eip3155strict) { this.out = out; this.showMemory = showMemory; this.showStack = showStack; this.showReturnData = showReturnData; this.showStorage = showStorage; + this.eip3155strict = eip3155strict; } /** @@ -95,6 +117,32 @@ public StandardJsonTracer( showStorage); } + /** + * Instantiates a new Standard json tracer. + * + * @param out the out + * @param showMemory show memory in trace lines + * @param showStack show the stack in trace lines + * @param showReturnData show return data in trace lines + * @param showStorage show updated storage + * @param eip3155strict Output eip-3155 compatible traces + */ + public StandardJsonTracer( + final PrintStream out, + final boolean showMemory, + final boolean showStack, + final boolean showReturnData, + final boolean showStorage, + final boolean eip3155strict) { + this( + new PrintWriter(out, true, StandardCharsets.UTF_8), + showMemory, + showStack, + showReturnData, + showStorage, + eip3155strict); + } + /** * Short as hex string. * @@ -125,9 +173,9 @@ public void tracePreExecution(final MessageFrame messageFrame) { for (int i = messageFrame.stackSize() - 1; i >= 0; i--) { stack.add("\"" + shortBytes(messageFrame.getStackItem(i)) + "\""); } - pc = messageFrame.getPC() - messageFrame.getCode().getCodeSection(0).getEntryPoint(); + pc = messageFrame.getPC(); section = messageFrame.getSection(); - gas = shortNumber(messageFrame.getRemainingGas()); + gas = messageFrame.getRemainingGas(); memorySize = messageFrame.memoryWordSize() * 32; if (showMemory && memorySize > 0) { memory = messageFrame.readMemory(0, messageFrame.memoryWordSize() * 32L); @@ -135,7 +183,7 @@ public void tracePreExecution(final MessageFrame messageFrame) { memory = null; } depth = messageFrame.getMessageStackSize(); - subdepth = messageFrame.returnStackSize(); + functionDepth = messageFrame.returnStackSize() + 1; StringBuilder sb = new StringBuilder(); if (showStorage) { @@ -186,20 +234,23 @@ public void tracePostExecution( if (eofContract) { sb.append("\"section\":").append(section).append(","); } - sb.append("\"op\":").append(opcode).append(","); + if (eip3155strict) { + sb.append("\"op\":").append(opcode).append(","); + } else { + sb.append("\"op\":\"").append(fastHexByte(opcode)).append("\","); + } OpcodeInfo opInfo = OpcodeInfo.getOpcode(opcode); if (eofContract && opInfo.pcAdvance() > 1) { - var immediate = - messageFrame - .getCode() - .getBytes() - .slice( - pc + messageFrame.getCode().getCodeSection(0).getEntryPoint() + 1, - opInfo.pcAdvance() - 1); + var immediate = messageFrame.getCode().getBytes().slice(pc + 1, opInfo.pcAdvance() - 1); sb.append("\"immediate\":\"").append(immediate.toHexString()).append("\","); } - sb.append("\"gas\":\"").append(gas).append("\","); - sb.append("\"gasCost\":\"").append(shortNumber(thisGasCost)).append("\","); + if (eip3155strict) { + sb.append("\"gas\":\"").append(shortNumber(gas)).append("\","); + sb.append("\"gasCost\":\"").append(shortNumber(thisGasCost)).append("\","); + } else { + sb.append("\"gas\":").append(Long.toUnsignedString(gas)).append(","); + sb.append("\"gasCost\":").append(Long.toUnsignedString(thisGasCost)).append(","); + } if (memory != null) { sb.append("\"memory\":\"").append(memory.toHexString()).append("\","); } @@ -211,8 +262,8 @@ public void tracePostExecution( sb.append("\"returnData\":\"").append(returnData.toHexString()).append("\","); } sb.append("\"depth\":").append(depth).append(","); - if (subdepth >= 1) { - sb.append("\"functionDepth\":").append(subdepth).append(","); + if (functionDepth > 1) { + sb.append("\"functionDepth\":").append(functionDepth).append(","); } sb.append("\"refund\":").append(messageFrame.getGasRefund()).append(","); sb.append("\"opName\":\"").append(currentOp.getName()).append("\""); @@ -241,4 +292,12 @@ public void traceAccountCreationResult( final MessageFrame frame, final Optional haltReason) { // precompile calls are not part of the standard trace } + + private String fastHexByte(final int b) { + char[] result = new char[] {'0', 'x', '-', '-'}; + result[2] = "0123456789abcdef".charAt(b >> 4 & 15); + result[3] = "0123456789abcdef".charAt(b & 15); + + return new String(result); + } } diff --git a/evm/src/test/java/org/hyperledger/besu/evm/StandardJsonTracerTest.java b/evm/src/test/java/org/hyperledger/besu/evm/StandardJsonTracerTest.java index 4f18f582d1a..8b18d70ac8e 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/StandardJsonTracerTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/StandardJsonTracerTest.java @@ -30,12 +30,12 @@ class StandardJsonTracerTest { @Test - void eip3155ModifiedTestCase() { + void eip3155ModifiedTestCaseStrictTypes() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); var executor = EVMExecutor.evm(EvmSpecVersion.ISTANBUL); - StandardJsonTracer tracer = new StandardJsonTracer(out, true, true, true, false); + StandardJsonTracer tracer = new StandardJsonTracer(out, true, true, true, false, true); executor.tracer(tracer); executor.gas(10_000_000_000L); @@ -72,6 +72,49 @@ void eip3155ModifiedTestCase() { """); } + @Test + void eip3155ModifiedTestCase() { + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream out = new PrintStream(baos); + var executor = EVMExecutor.evm(EvmSpecVersion.ISTANBUL); + StandardJsonTracer tracer = new StandardJsonTracer(out, true, true, true, false); + executor.tracer(tracer); + executor.gas(10_000_000_000L); + + var codeBytes = Bytes.fromHexString("0x604080536040604055604060006040600060025afa6040f3"); + executor.execute(codeBytes, Bytes.EMPTY, Wei.ZERO, Address.ZERO); + + // differences from the EIP-3155 test case + // (a) the test case was written when EIP-2315 was part of the pending hard fork, so + // returnStack was a valid field. It no longer appears in any traces. + // (b) the summary line is omitted + // (c) pc:3 is in error, the size of the memory before the first MSTORE8 is zero. + // (d) if memory is zero length, it is not included even if `showMemory` is true + // (e) if return data is zero length or null, it is not included even if `showReturnData` is + // true + // (f) if error is zero length or null it is not included. + assertThat(baos) + .hasToString( + """ + {"pc":0,"op":"0x60","gas":10000000000,"gasCost":3,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":2,"op":"0x80","gas":9999999997,"gasCost":3,"memSize":0,"stack":["0x40"],"depth":1,"refund":0,"opName":"DUP1"} + {"pc":3,"op":"0x53","gas":9999999994,"gasCost":12,"memSize":0,"stack":["0x40","0x40"],"depth":1,"refund":0,"opName":"MSTORE8"} + {"pc":4,"op":"0x60","gas":9999999982,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":6,"op":"0x60","gas":9999999979,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40"],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":8,"op":"0x55","gas":9999999976,"gasCost":20000,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x40"],"depth":1,"refund":0,"opName":"SSTORE"} + {"pc":9,"op":"0x60","gas":9999979976,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":11,"op":"0x60","gas":9999979973,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40"],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":13,"op":"0x60","gas":9999979970,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x0"],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":15,"op":"0x60","gas":9999979967,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x0","0x40"],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":17,"op":"0x60","gas":9999979964,"gasCost":3,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x0","0x40","0x0"],"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":19,"op":"0x5a","gas":9999979961,"gasCost":2,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x0","0x40","0x0","0x2"],"depth":1,"refund":0,"opName":"GAS"} + {"pc":20,"op":"0xfa","gas":9999979959,"gasCost":9843730284,"memory":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x40","0x0","0x40","0x0","0x2","0x2540b95b7"],"depth":1,"refund":0,"opName":"STATICCALL"} + {"pc":21,"op":"0x60","gas":9999979175,"gasCost":3,"memory":"0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x1"],"returnData":"0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b","depth":1,"refund":0,"opName":"PUSH1"} + {"pc":23,"op":"0xf3","gas":9999979172,"gasCost":0,"memory":"0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000","memSize":96,"stack":["0x1","0x40"],"returnData":"0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b","depth":1,"refund":0,"opName":"RETURN"} + """); + } + @Test void updatedStorageTestCase() { @@ -88,21 +131,21 @@ void updatedStorageTestCase() { assertThat(baos) .hasToString( """ - {"pc":0,"op":96,"gas":"0x2540be400","gasCost":"0x3","memSize":0,"depth":1,"refund":0,"opName":"PUSH1"} - {"pc":2,"op":128,"gas":"0x2540be3fd","gasCost":"0x3","memSize":0,"depth":1,"refund":0,"opName":"DUP1"} - {"pc":3,"op":83,"gas":"0x2540be3fa","gasCost":"0xc","memSize":0,"depth":1,"refund":0,"opName":"MSTORE8"} - {"pc":4,"op":96,"gas":"0x2540be3ee","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1"} - {"pc":6,"op":96,"gas":"0x2540be3eb","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1"} - {"pc":8,"op":85,"gas":"0x2540be3e8","gasCost":"0x4e20","memSize":96,"depth":1,"refund":0,"opName":"SSTORE"} - {"pc":9,"op":96,"gas":"0x2540b95c8","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":11,"op":96,"gas":"0x2540b95c5","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":13,"op":96,"gas":"0x2540b95c2","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":15,"op":96,"gas":"0x2540b95bf","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":17,"op":96,"gas":"0x2540b95bc","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":19,"op":90,"gas":"0x2540b95b9","gasCost":"0x2","memSize":96,"depth":1,"refund":0,"opName":"GAS","storage":{"0x40":"0x40"}} - {"pc":20,"op":250,"gas":"0x2540b95b7","gasCost":"0x24abb676c","memSize":96,"depth":1,"refund":0,"opName":"STATICCALL","storage":{"0x40":"0x40"}} - {"pc":21,"op":96,"gas":"0x2540b92a7","gasCost":"0x3","memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} - {"pc":23,"op":243,"gas":"0x2540b92a4","gasCost":"0x0","memSize":96,"depth":1,"refund":0,"opName":"RETURN","storage":{"0x40":"0x40"}} + {"pc":0,"op":"0x60","gas":10000000000,"gasCost":3,"memSize":0,"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":2,"op":"0x80","gas":9999999997,"gasCost":3,"memSize":0,"depth":1,"refund":0,"opName":"DUP1"} + {"pc":3,"op":"0x53","gas":9999999994,"gasCost":12,"memSize":0,"depth":1,"refund":0,"opName":"MSTORE8"} + {"pc":4,"op":"0x60","gas":9999999982,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":6,"op":"0x60","gas":9999999979,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1"} + {"pc":8,"op":"0x55","gas":9999999976,"gasCost":20000,"memSize":96,"depth":1,"refund":0,"opName":"SSTORE"} + {"pc":9,"op":"0x60","gas":9999979976,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":11,"op":"0x60","gas":9999979973,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":13,"op":"0x60","gas":9999979970,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":15,"op":"0x60","gas":9999979967,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":17,"op":"0x60","gas":9999979964,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":19,"op":"0x5a","gas":9999979961,"gasCost":2,"memSize":96,"depth":1,"refund":0,"opName":"GAS","storage":{"0x40":"0x40"}} + {"pc":20,"op":"0xfa","gas":9999979959,"gasCost":9843730284,"memSize":96,"depth":1,"refund":0,"opName":"STATICCALL","storage":{"0x40":"0x40"}} + {"pc":21,"op":"0x60","gas":9999979175,"gasCost":3,"memSize":96,"depth":1,"refund":0,"opName":"PUSH1","storage":{"0x40":"0x40"}} + {"pc":23,"op":"0xf3","gas":9999979172,"gasCost":0,"memSize":96,"depth":1,"refund":0,"opName":"RETURN","storage":{"0x40":"0x40"}} """); } } From f184853690a98ed5398f118aabec478b12f85e6b Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Thu, 12 Dec 2024 18:11:17 -0700 Subject: [PATCH 2/5] postHash -> stateRoot EIP-3155 and EIP-7756 call for "stateRoot" where we use "postHash". Signed-off-by: Danno Ferrin --- .../org/hyperledger/besu/evmtool/StateTestSubCommand.java | 2 +- .../besu/evmtool/state-test/all-trace-flags-disabled.json | 2 +- .../hyperledger/besu/evmtool/state-test/all-trace-flags.json | 2 +- .../org/hyperledger/besu/evmtool/state-test/blockhash.json | 2 +- .../org/hyperledger/besu/evmtool/state-test/create-eof.json | 4 ++-- .../besu/evmtool/state-test/create-invalid-eof.json | 4 ++-- .../org/hyperledger/besu/evmtool/state-test/no-memory.json | 2 +- .../besu/evmtool/state-test/shanghai-blockhash.json | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java index 9e99eae4986..2ee32a259cc 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java @@ -313,7 +313,7 @@ private void traceTestSpecs(final String test, final List logs = result.getLogs(); final Hash actualLogsHash = Hash.hash(RLP.encode(out -> out.writeList(logs, Log::writeTo))); summaryLine.put("postLogsHash", actualLogsHash.toHexString()); diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags-disabled.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags-disabled.json index 60d0c0e609a..c9337440dba 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags-disabled.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags-disabled.json @@ -101,6 +101,6 @@ {"pc":49,"op":"0x60","gas":42949649295,"gasCost":3,"memSize":32,"depth":1,"refund":0,"opName":"PUSH1"}, {"pc":51,"op":"0x55","gas":42949649292,"gasCost":5000,"memSize":32,"depth":1,"refund":0,"opName":"SSTORE"}, {"pc":52,"op":"0x00","gas":42949644292,"gasCost":0,"memSize":32,"depth":1,"refund":0,"opName":"STOP"}, - {"output":"","gasUsed":28668,"test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"postHash":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} + {"output":"","gasUsed":28668,"test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"stateRoot":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags.json index 557a2eaf4a1..3aba1a0baad 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/all-trace-flags.json @@ -102,6 +102,6 @@ {"pc":49,"op":96,"gas":"0x9ffffa38f","gasCost":"0x3","memory":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","memSize":32,"stack":["0x111122223333444455556666777788889999aaaabbbbccccddddeeeeffff"],"returnData":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","depth":1,"refund":0,"opName":"PUSH1"}, {"pc":51,"op":85,"gas":"0x9ffffa38c","gasCost":"0x1388","memory":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","memSize":32,"stack":["0x111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","0x0"],"returnData":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","depth":1,"refund":0,"opName":"SSTORE"}, {"pc":52,"op":0,"gas":"0x9ffff9004","gasCost":"0x0","memory":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","memSize":32,"stack":[],"returnData":"0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","depth":1,"refund":0,"opName":"STOP"}, - {"output":"","gasUsed":"0x6ffc","test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"postHash":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} + {"output":"","gasUsed":"0x6ffc","test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"stateRoot":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/blockhash.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/blockhash.json index cb2e233e519..2a595bf304b 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/blockhash.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/blockhash.json @@ -99,6 +99,6 @@ {"pc":81,"op":"0x48","gas":7978018,"gasCost":2,"memSize":0,"stack":["0x0","0x1","0x1","0x2","0x2","0xffff","0x1f4","0x78859e5b97166c486532b1595a673e9f9073643f1b519c6f18511b9913","0x2","0x389","0x0","0x0","0x1","0x0","0x3e3d6d5ff042148d326c1898713a76759ca273","0x44852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d","0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b"],"depth":1,"refund":0,"opName":"BASEFEE"}, {"pc":82,"op":"0x08","gas":7978016,"gasCost":8,"memSize":0,"stack":["0x0","0x1","0x1","0x2","0x2","0xffff","0x1f4","0x78859e5b97166c486532b1595a673e9f9073643f1b519c6f18511b9913","0x2","0x389","0x0","0x0","0x1","0x0","0x3e3d6d5ff042148d326c1898713a76759ca273","0x44852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d","0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b","0x10"],"depth":1,"refund":0,"opName":"ADDMOD"}, {"pc":83,"op":"0x3e","gas":7978008,"gasCost":0,"memSize":0,"stack":["0x0","0x1","0x1","0x2","0x2","0xffff","0x1f4","0x78859e5b97166c486532b1595a673e9f9073643f1b519c6f18511b9913","0x2","0x389","0x0","0x0","0x1","0x0","0x3e3d6d5ff042148d326c1898713a76759ca273","0xb94f5374fce5edbc8e2a8697c15331677e6ebf1b"],"depth":1,"refund":0,"opName":"RETURNDATACOPY","error":"Out of bounds"}, - {"output":"","gasUsed":8000000,"test":"00000936-mixed-1","fork":"Shanghai","d":0,"g":0,"v":0,"postHash":"0xd14c10ed22a1cfb642e374be985ac581c39f3969bd59249e0405aca3beb47a47","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"INVALID_RETURN_DATA_BUFFER_ACCESS"} + {"output":"","gasUsed":8000000,"test":"00000936-mixed-1","fork":"Shanghai","d":0,"g":0,"v":0,"stateRoot":"0xd14c10ed22a1cfb642e374be985ac581c39f3969bd59249e0405aca3beb47a47","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"INVALID_RETURN_DATA_BUFFER_ACCESS"} ] } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json index c21233ec59c..ba42da18c02 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json @@ -79,8 +79,8 @@ {"pc":29,"section":0,"op":"0x5f","gas":7945585,"gasCost":2,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":30,"section":0,"op":"0x5f","gas":7945583,"gasCost":2,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, {"pc":31,"section":0,"op":"0xee","immediate":"0x00","gas":7945581,"gasCost":0,"memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURNCONTRACT"}, - {"output":"","gasUsed":58419,"test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"postHash":"0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3","postLogsHash":"0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940","pass":true}, + {"output":"","gasUsed":58419,"test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"stateRoot":"0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3","postLogsHash":"0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940","pass":true}, {"pc":0,"op":"0xef","gas":7946344,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"INVALID","error":"Bad instruction"}, - {"output":"","gasUsed":8000000,"test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"postHash":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} + {"output":"","gasUsed":8000000,"test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"stateRoot":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} ] } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json index 264ee35df87..db1c276c0cb 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-invalid-eof.json @@ -71,8 +71,8 @@ } }, "stdout": [ - {"output":"","gasUsed":53656,"test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"postHash":"0x2a9c58298ba5d4ec86ca682b9fcc9ff67c3fc44dbd39f85a2f9b74bfe4e5178e","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"Invalid EOF Layout: unexpected_header_kind expected 1 actual 17"}, + {"output":"","gasUsed":53656,"test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"stateRoot":"0x2a9c58298ba5d4ec86ca682b9fcc9ff67c3fc44dbd39f85a2f9b74bfe4e5178e","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":false,"error":"Invalid EOF Layout: unexpected_header_kind expected 1 actual 17"}, {"pc":0,"op":"0xef","gas":7946344,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"INVALID","error":"Bad instruction"}, - {"output":"","gasUsed":8000000,"test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"postHash":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} + {"output":"","gasUsed":8000000,"test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"stateRoot":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} ] } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/no-memory.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/no-memory.json index ce3860bb9c8..80643b66eaa 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/no-memory.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/no-memory.json @@ -99,6 +99,6 @@ {"pc":49,"op":"0x60","gas":42949649295,"gasCost":3,"memSize":32,"stack":["0x111122223333444455556666777788889999aaaabbbbccccddddeeeeffff"],"depth":1,"refund":0,"opName":"PUSH1"}, {"pc":51,"op":"0x55","gas":42949649292,"gasCost":5000,"memSize":32,"stack":["0x111122223333444455556666777788889999aaaabbbbccccddddeeeeffff","0x0"],"depth":1,"refund":0,"opName":"SSTORE"}, {"pc":52,"op":"0x00","gas":42949644292,"gasCost":0,"memSize":32,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, - {"output":"","gasUsed":28668,"test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"postHash":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} + {"output":"","gasUsed":28668,"test":"returndatacopy_following_call","fork":"London","d":0,"g":0,"v":0,"stateRoot":"0x1c6dda42e80135b6d5ff1a664e6f85e8552d5c56888bb35e2e694f3829a500c7","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/shanghai-blockhash.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/shanghai-blockhash.json index fdd928ceeba..6e5ceb179a5 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/shanghai-blockhash.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/shanghai-blockhash.json @@ -77,6 +77,6 @@ {"pc":14,"op":"0x60","gas":7934726,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH1"}, {"pc":16,"op":"0x55","gas":7934723,"gasCost":2200,"memSize":0,"stack":["0x0","0x2"],"depth":1,"refund":0,"opName":"SSTORE"}, {"pc":17,"op":"0x00","gas":7932523,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, - {"output":"","gasUsed":67477,"test":"shanghai-blockhash","fork":"Shanghai","d":0,"g":0,"v":0,"postHash":"0xb3967c897314312cf275055d754c6742d351a2a4bcf0121ed2f896971bf56563","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} + {"output":"","gasUsed":67477,"test":"shanghai-blockhash","fork":"Shanghai","d":0,"g":0,"v":0,"stateRoot":"0xb3967c897314312cf275055d754c6742d351a2a4bcf0121ed2f896971bf56563","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true} ] } From 338e491a768af430476dcabbcb47d459a224d07f Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 14 Dec 2024 21:01:22 -0700 Subject: [PATCH 3/5] functionDepth = 1 for base level EOF Signed-off-by: Danno Ferrin --- .../org/hyperledger/besu/evm/tracing/StandardJsonTracer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java index f42d7e8bcf9..70d9c64e2eb 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java @@ -183,7 +183,7 @@ public void tracePreExecution(final MessageFrame messageFrame) { memory = null; } depth = messageFrame.getMessageStackSize(); - functionDepth = messageFrame.returnStackSize() + 1; + functionDepth = messageFrame.getCode().getEofVersion() > 0 ? messageFrame.returnStackSize() + 1 : 0; StringBuilder sb = new StringBuilder(); if (showStorage) { @@ -262,7 +262,7 @@ public void tracePostExecution( sb.append("\"returnData\":\"").append(returnData.toHexString()).append("\","); } sb.append("\"depth\":").append(depth).append(","); - if (functionDepth > 1) { + if (functionDepth > 0) { sb.append("\"functionDepth\":").append(functionDepth).append(","); } sb.append("\"refund\":").append(messageFrame.getGasRefund()).append(","); From 4d24ee44455d6a3c97dcdd0a00b3b4813836e04d Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 14 Dec 2024 21:09:27 -0700 Subject: [PATCH 4/5] spotless Signed-off-by: Danno Ferrin --- .../org/hyperledger/besu/evm/tracing/StandardJsonTracer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java index 70d9c64e2eb..a7793e15892 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/tracing/StandardJsonTracer.java @@ -183,7 +183,8 @@ public void tracePreExecution(final MessageFrame messageFrame) { memory = null; } depth = messageFrame.getMessageStackSize(); - functionDepth = messageFrame.getCode().getEofVersion() > 0 ? messageFrame.returnStackSize() + 1 : 0; + functionDepth = + messageFrame.getCode().getEofVersion() > 0 ? messageFrame.returnStackSize() + 1 : 0; StringBuilder sb = new StringBuilder(); if (showStorage) { From 988fbfc9e9f596bfd993b3cea803faa6ffd1ef4a Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sat, 14 Dec 2024 21:40:44 -0700 Subject: [PATCH 5/5] update test values Signed-off-by: Danno Ferrin --- .../besu/evmtool/state-test/create-eof.json | 16 ++++++++-------- .../besu/evmtool/trace/create-eof.json | 16 ++++++++-------- .../besu/evmtool/trace/eof-section.json | 10 +++++----- .../org/hyperledger/besu/evmtool/trace/eof.json | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json index ba42da18c02..733d310ffb2 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/state-test/create-eof.json @@ -71,14 +71,14 @@ } }, "stdout": [ - {"pc":24,"section":0,"op":"0x5f","gas":7946344,"gasCost":2,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":25,"section":0,"op":"0x35","gas":7946342,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"CALLDATALOAD"}, - {"pc":26,"section":0,"op":"0x5f","gas":7946339,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":27,"section":0,"op":"0x5f","gas":7946337,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":28,"section":0,"op":"0xa1","gas":7946335,"gasCost":750,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0","0x0"],"depth":1,"refund":0,"opName":"LOG1"}, - {"pc":29,"section":0,"op":"0x5f","gas":7945585,"gasCost":2,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":30,"section":0,"op":"0x5f","gas":7945583,"gasCost":2,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":31,"section":0,"op":"0xee","immediate":"0x00","gas":7945581,"gasCost":0,"memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURNCONTRACT"}, + {"pc":24,"section":0,"op":"0x5f","gas":7946344,"gasCost":2,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":25,"section":0,"op":"0x35","gas":7946342,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"CALLDATALOAD"}, + {"pc":26,"section":0,"op":"0x5f","gas":7946339,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":27,"section":0,"op":"0x5f","gas":7946337,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":28,"section":0,"op":"0xa1","gas":7946335,"gasCost":750,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"LOG1"}, + {"pc":29,"section":0,"op":"0x5f","gas":7945585,"gasCost":2,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":30,"section":0,"op":"0x5f","gas":7945583,"gasCost":2,"memSize":0,"stack":["0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":31,"section":0,"op":"0xee","immediate":"0x00","gas":7945581,"gasCost":0,"memSize":0,"stack":["0x0","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"RETURNCONTRACT"}, {"output":"","gasUsed":58419,"test":"create-eof","fork":"Osaka","d":0,"g":0,"v":0,"stateRoot":"0x1a8642a04dae90535f00f53d3a30284c4db051d508a653db89eb100ba9aecbf3","postLogsHash":"0xf48b954a6a6f4ce6b28e4950b7027413f4bdc8f459df6003b6e8d7a1567c8940","pass":true}, {"pc":0,"op":"0xef","gas":7946344,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"INVALID","error":"Bad instruction"}, {"output":"","gasUsed":8000000,"test":"create-eof","fork":"Cancun","d":0,"g":0,"v":0,"stateRoot":"0xaa80d89bc89f58da8de41d3894bd1a241896ff91f7a5964edaefb39e8e3a4a98","postLogsHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","pass":true,"error":"INVALID_OPERATION"} diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json index c634b7b9865..73b3950c22e 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof.json @@ -12,14 +12,14 @@ ], "stdin": "", "stdout": [ - {"pc":24,"section":0,"op":"0x5f","gas":10000000000,"gasCost":2,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":25,"section":0,"op":"0x35","gas":9999999998,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"CALLDATALOAD"}, - {"pc":26,"section":0,"op":"0x5f","gas":9999999995,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":27,"section":0,"op":"0x5f","gas":9999999993,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":28,"section":0,"op":"0xa1","gas":9999999991,"gasCost":750,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0","0x0"],"depth":1,"refund":0,"opName":"LOG1"}, - {"pc":29,"section":0,"op":"0x5f","gas":9999999241,"gasCost":2,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":30,"section":0,"op":"0x5f","gas":9999999239,"gasCost":2,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH0"}, - {"pc":31,"section":0,"op":"0xee","immediate":"0x00","gas":9999999237,"gasCost":0,"memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURNCONTRACT"}, + {"pc":24,"section":0,"op":"0x5f","gas":10000000000,"gasCost":2,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":25,"section":0,"op":"0x35","gas":9999999998,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"CALLDATALOAD"}, + {"pc":26,"section":0,"op":"0x5f","gas":9999999995,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":27,"section":0,"op":"0x5f","gas":9999999993,"gasCost":2,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":28,"section":0,"op":"0xa1","gas":9999999991,"gasCost":750,"memSize":0,"stack":["0xc0de471fe5000000000000000000000000000000000000000000000000000000","0x0","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"LOG1"}, + {"pc":29,"section":0,"op":"0x5f","gas":9999999241,"gasCost":2,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":30,"section":0,"op":"0x5f","gas":9999999239,"gasCost":2,"memSize":0,"stack":["0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH0"}, + {"pc":31,"section":0,"op":"0xee","immediate":"0x00","gas":9999999237,"gasCost":0,"memSize":0,"stack":["0x0","0x0"],"depth":1,"functionDepth":1,"refund":0,"opName":"RETURNCONTRACT"}, {"stateRoot":"0x9790b070a5749acec6a7252a867f795df3c2cb5b800fb509ea259a1c0b5d96c1","output":"0x","gasUsed":"0x129b","pass":true,"fork":"Osaka"} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json index 41ea0b8b717..f3d0b7ea94c 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof-section.json @@ -11,13 +11,13 @@ ], "stdin": "", "stdout": [ - {"pc":31,"section":0,"op":"0xe3","immediate":"0x0002","gas":10000000000,"gasCost":5,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"CALLF"}, + {"pc":31,"section":0,"op":"0xe3","immediate":"0x0002","gas":10000000000,"gasCost":5,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"CALLF"}, {"pc":42,"section":2,"op":"0xe5","immediate":"0x0001","gas":9999999995,"gasCost":5,"memSize":0,"stack":[],"depth":1,"functionDepth":2,"refund":0,"opName":"JUMPF"}, {"pc":41,"section":1,"op":"0xe4","gas":9999999990,"gasCost":3,"memSize":0,"stack":[],"depth":1,"functionDepth":2,"refund":0,"opName":"RETF"}, - {"pc":34,"section":0,"op":"0x61","immediate":"0x2015","gas":9999999987,"gasCost":3,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"}, - {"pc":37,"section":0,"op":"0x60","immediate":"0x01","gas":9999999984,"gasCost":3,"memSize":0,"stack":["0x2015"],"depth":1,"refund":0,"opName":"PUSH1"}, - {"pc":39,"section":0,"op":"0x55","gas":9999999981,"gasCost":22100,"memSize":0,"stack":["0x2015","0x1"],"depth":1,"refund":0,"opName":"SSTORE"}, - {"pc":40,"section":0,"op":"0x00","gas":9999977881,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, + {"pc":34,"section":0,"op":"0x61","immediate":"0x2015","gas":9999999987,"gasCost":3,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH2"}, + {"pc":37,"section":0,"op":"0x60","immediate":"0x01","gas":9999999984,"gasCost":3,"memSize":0,"stack":["0x2015"],"depth":1,"functionDepth":1,"refund":0,"opName":"PUSH1"}, + {"pc":39,"section":0,"op":"0x55","gas":9999999981,"gasCost":22100,"memSize":0,"stack":["0x2015","0x1"],"depth":1,"functionDepth":1,"refund":0,"opName":"SSTORE"}, + {"pc":40,"section":0,"op":"0x00","gas":9999977881,"gasCost":0,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"STOP"}, {"stateRoot":"0x761f723ceabb467d438fe74abf025c10bf65592b84ec389850038eb572f2b0fa","output":"0x","gasUsed":"0x5667","pass":true,"fork":"Osaka"} ] } \ No newline at end of file diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json index f0d7fb624dd..f5850449bbf 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json @@ -11,7 +11,7 @@ ], "stdin": "", "stdout": [ - {"pc":19,"section":0,"op":"0x00","gas":10000000000,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}, + {"pc":19,"section":0,"op":"0x00","gas":10000000000,"gasCost":0,"memSize":0,"stack":[],"depth":1,"functionDepth":1,"refund":0,"opName":"STOP"}, {"stateRoot":"0xdae5f2c233bf9fbb7413d06ce744a3345dbf971b5bb5638736c0388f43a61a4b","output":"0x","gasUsed":"0x0","pass":true,"fork":"Osaka"} ] } \ No newline at end of file