Skip to content

Commit

Permalink
Revert "update trace logique to fix journal updater issue (#7758)" (#…
Browse files Browse the repository at this point in the history
…8054)

This reverts commit 6a546c5.

Signed-off-by: Karim Taam <karim.t2am@gmail.com>
  • Loading branch information
matkt authored Dec 19, 2024
1 parent a03c98b commit 14c008d
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<TransactionProcessingResult> 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);
});
}
Expand All @@ -177,15 +178,15 @@ private Optional<List<TransactionProcessingResult>> trace(
blockchainQueries,
block.getHash(),
traceableState ->
Optional.of(trace(blockchain, block, traceableState.updater(), tracer)));
Optional.of(trace(blockchain, block, new ChainUpdater(traceableState), tracer)));

return results;
}

private List<TransactionProcessingResult> trace(
final Blockchain blockchain,
final Block block,
final WorldUpdater worldUpdater,
final ChainUpdater chainUpdater,
final BlockAwareOperationTracer tracer) {
final List<TransactionProcessingResult> results = new ArrayList<>();
final ProtocolSpec protocolSpec = protocolSchedule.getByBlockHeader(block.getHeader());
Expand All @@ -208,6 +209,7 @@ private List<TransactionProcessingResult> trace(
.map(parent -> calculateExcessBlobGasForParent(protocolSpec, parent))
.orElse(BlobGas.ZERO));

final WorldUpdater worldUpdater = chainUpdater.getNextUpdater();
final TransactionProcessingResult result =
transactionProcessor.processTransaction(
worldUpdater,
Expand Down

0 comments on commit 14c008d

Please sign in to comment.