Skip to content

Commit

Permalink
Merge branch 'main' into eip-7840
Browse files Browse the repository at this point in the history
  • Loading branch information
siladu authored Dec 19, 2024
2 parents 0b0dc53 + 14c008d commit 1f40e35
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 1f40e35

Please sign in to comment.