Skip to content

Commit

Permalink
Use both traceStartBlock method calls wherever suitable (#1711)
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pinto authored Jan 24, 2025
1 parent 40d1608 commit 6b7248e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void traceEndConflation(WorldView state) {}

@Override
public void traceStartBlock(
BlockHeader blockHeader, BlockBody blockBody, Address miningBeneficiary) {
BlockHeader blockHeader, BlockBody blockBody, final Address miningBeneficiary) {
this.reaper.enterBlock(blockHeader, blockBody, miningBeneficiary);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public void traceEndConflation(WorldView state) {
this.tracers.forEach(tracer -> tracer.traceEndConflation(state));
}

public void traceStartBlock(
final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) {
this.tracers.forEach(
tracer -> tracer.traceStartBlock(blockHeader, blockBody, miningBeneficiary));
}

public void traceStartBlock(
final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {
this.tracers.forEach(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ public void traceStartBlock(
}
}

@Override
public void traceStartBlock(
final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) {
try {
this.hub.traceStartBlock(blockHeader, miningBeneficiary);
this.debugMode.ifPresent(x -> x.traceStartBlock(blockHeader, blockBody, miningBeneficiary));
} catch (final Exception e) {
this.tracingExceptions.add(e);
}
}

@Override
public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.consensys.linea.zktracer.opcode.OpCode;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.DelegatingBytes;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Quantity;
import org.hyperledger.besu.datatypes.Transaction;
import org.hyperledger.besu.evm.frame.MessageFrame;
Expand Down Expand Up @@ -159,7 +160,10 @@ public void traceEndConflation() {
log.info("=== Stop conflation ===");
}

public void traceStartBlock(ProcessableBlockHeader processableBlockHeader, final BlockBody body) {
public void traceStartBlock(
ProcessableBlockHeader processableBlockHeader,
final BlockBody body,
final Address miningBeneficiary) {
if (!this.l.doBlock()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) {

final ZkTracer zkTracer = new ZkTracer();
zkTracer.traceStartConflation(1);
zkTracer.traceStartBlock(blockHeader, blockHeader.getCoinbase());
zkTracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase());

final TransactionProcessingResult result =
processor.processTransaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static void executeTest(
.blobGasPricePerGas(blockHeader.getExcessBlobGas().orElse(BlobGas.ZERO));

tracer.traceStartConflation(1);
tracer.traceStartBlock(blockHeader, blockHeader.getCoinbase());
tracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase());
TransactionProcessingResult result = null;
for (Transaction transaction : blockBody.getTransactions()) {
// Several of the GeneralStateTests check if the transaction could potentially
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private static void executeFrom(
useCoinbaseAddressFromBlockHeader
? header.getCoinbase()
: CliqueHelpers.getProposerOfBlock(header);
tracer.traceStartBlock(header, miningBeneficiary);
tracer.traceStartBlock(header, body, miningBeneficiary);

for (TransactionSnapshot txs : blockSnapshot.txs()) {
final Transaction tx = txs.toTransaction();
Expand Down

0 comments on commit 6b7248e

Please sign in to comment.