From 14c008d648fe218d907b1c9419fa79476b690a73 Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Thu, 19 Dec 2024 12:54:53 +0300 Subject: [PATCH] Revert "update trace logique to fix journal updater issue (#7758)" (#8054) This reverts commit 6a546c5e6f5cb961891fbe3ab2f14da29796c242. Signed-off-by: Karim Taam --- .../hyperledger/besu/services/TraceServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/services/TraceServiceImpl.java b/besu/src/main/java/org/hyperledger/besu/services/TraceServiceImpl.java index f512bf35402..6a0804b6f46 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/TraceServiceImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/TraceServiceImpl.java @@ -20,6 +20,7 @@ import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.TraceBlock.ChainUpdater; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.Tracer; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.Blockchain; @@ -155,14 +156,14 @@ public void trace( blocks.get(0).getHash(), traceableState -> { final WorldUpdater worldStateUpdater = traceableState.updater(); + final ChainUpdater chainUpdater = new ChainUpdater(traceableState, worldStateUpdater); beforeTracing.accept(worldStateUpdater); final List results = new ArrayList<>(); blocks.forEach( block -> { - results.addAll(trace(blockchain, block, worldStateUpdater, tracer)); - worldStateUpdater.commit(); + results.addAll(trace(blockchain, block, chainUpdater, tracer)); }); - afterTracing.accept(worldStateUpdater); + afterTracing.accept(chainUpdater.getNextUpdater()); return Optional.of(results); }); } @@ -177,7 +178,7 @@ private Optional> trace( blockchainQueries, block.getHash(), traceableState -> - Optional.of(trace(blockchain, block, traceableState.updater(), tracer))); + Optional.of(trace(blockchain, block, new ChainUpdater(traceableState), tracer))); return results; } @@ -185,7 +186,7 @@ private Optional> trace( private List trace( final Blockchain blockchain, final Block block, - final WorldUpdater worldUpdater, + final ChainUpdater chainUpdater, final BlockAwareOperationTracer tracer) { final List results = new ArrayList<>(); final ProtocolSpec protocolSpec = protocolSchedule.getByBlockHeader(block.getHeader()); @@ -208,6 +209,7 @@ private List trace( .map(parent -> calculateExcessBlobGasForParent(protocolSpec, parent)) .orElse(BlobGas.ZERO)); + final WorldUpdater worldUpdater = chainUpdater.getNextUpdater(); final TransactionProcessingResult result = transactionProcessor.processTransaction( worldUpdater,