diff --git a/CHANGELOG.md b/CHANGELOG.md index 919ce04db1e..56fc53e1666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Bug Fixes - Make smart contract permissioning features work with london fork [#5727](https://github.com/hyperledger/besu/pull/5727) - Add type to PendingTransactionDetail, fix eth_subscribe [#5729](https://github.com/hyperledger/besu/pull/5729) +- EvmTool "run" mode did not reflect contracts created within the transaction. [#5755](https://github.com/hyperledger/besu/pull/5755) ### Download Links diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java index a87a35d7257..64a8450cd38 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java @@ -506,21 +506,17 @@ public TransactionProcessingResult processTransaction( } } - protected void process(final MessageFrame frame, final OperationTracer operationTracer) { + public void process(final MessageFrame frame, final OperationTracer operationTracer) { final AbstractMessageProcessor executor = getMessageProcessor(frame.getType()); executor.process(frame, operationTracer); } private AbstractMessageProcessor getMessageProcessor(final MessageFrame.Type type) { - switch (type) { - case MESSAGE_CALL: - return messageCallProcessor; - case CONTRACT_CREATION: - return contractCreationProcessor; - default: - throw new IllegalStateException("Request for unsupported message processor type " + type); - } + return switch (type) { + case MESSAGE_CALL -> messageCallProcessor; + case CONTRACT_CREATION -> contractCreationProcessor; + }; } protected long refunded( 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 269f4c2b7d2..0bd393b4fa9 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 @@ -36,8 +36,6 @@ import org.hyperledger.besu.evm.code.CodeInvalid; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.log.LogsBloomFilter; -import org.hyperledger.besu.evm.precompile.PrecompileContractRegistry; -import org.hyperledger.besu.evm.processor.MessageCallProcessor; import org.hyperledger.besu.evm.tracing.OperationTracer; import org.hyperledger.besu.evm.tracing.StandardJsonTracer; import org.hyperledger.besu.evm.worldstate.WorldState; @@ -344,8 +342,6 @@ public void run() { .orElse(0L); long txGas = gas - intrinsicGasCost - accessListCost; - final PrecompileContractRegistry precompileContractRegistry = - protocolSpec.getPrecompileContractRegistry(); final EVM evm = protocolSpec.getEvm(); Code code = evm.getCode(Hash.hash(codeBytes), codeBytes); if (!code.isValid()) { @@ -385,13 +381,12 @@ public void run() { .miningBeneficiary(blockHeader.getCoinbase()) .blockHashLookup(new CachingBlockHashLookup(blockHeader, component.getBlockchain())) .build(); + Deque messageFrameStack = initialMessageFrame.getMessageFrameStack(); - final MessageCallProcessor mcp = new MessageCallProcessor(evm, precompileContractRegistry); - final Deque messageFrameStack = initialMessageFrame.getMessageFrameStack(); stopwatch.start(); while (!messageFrameStack.isEmpty()) { final MessageFrame messageFrame = messageFrameStack.peek(); - mcp.process(messageFrame, tracer); + protocolSpec.getTransactionProcessor().process(messageFrame, tracer); if (messageFrameStack.isEmpty()) { stopwatch.stop(); if (lastTime == 0) {