@ -35,6 +35,7 @@ import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldState;
import org.hyperledger.besu.ethereum.trie.bonsai.worldview.BonsaiWorldStateUpdateAccumulator ;
import org.hyperledger.besu.ethereum.vm.BlockHashLookup ;
import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup ;
import org.hyperledger.besu.evm.gascalculator.CancunGasCalculator ;
import org.hyperledger.besu.evm.tracing.OperationTracer ;
import org.hyperledger.besu.evm.worldstate.WorldState ;
import org.hyperledger.besu.evm.worldstate.WorldUpdater ;
@ -101,6 +102,7 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
final PrivateMetadataUpdater privateMetadataUpdater ) {
final List < TransactionReceipt > receipts = new ArrayList < > ( ) ;
long currentGasUsed = 0 ;
long currentBlobGasUsed = 0 ;
final ProtocolSpec protocolSpec = protocolSchedule . getByBlockHeader ( blockHeader ) ;
@ -127,7 +129,7 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
Wei blobGasPrice =
maybeParentHeader
. map (
( parentHeader ) - >
parentHeader - >
protocolSpec
. getFeeMarket ( )
. blobGasPricePerGas (
@ -163,12 +165,25 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
worldStateUpdater . commit ( ) ;
currentGasUsed + = transaction . getGasLimit ( ) - result . getGasRemaining ( ) ;
if ( transaction . getVersionedHashes ( ) . isPresent ( ) ) {
currentBlobGasUsed + =
( transaction . getVersionedHashes ( ) . get ( ) . size ( ) * CancunGasCalculator . BLOB_GAS_PER_BLOB ) ;
}
final TransactionReceipt transactionReceipt =
transactionReceiptFactory . create (
transaction . getType ( ) , result , worldState , currentGasUsed ) ;
receipts . add ( transactionReceipt ) ;
}
if ( blockHeader . getBlobGasUsed ( ) . isPresent ( )
& & currentBlobGasUsed ! = blockHeader . getBlobGasUsed ( ) . get ( ) ) {
String errorMessage =
String . format (
"block did not consume expected blob gas: header %d, transactions %d" ,
blockHeader . getBlobGasUsed ( ) . get ( ) , currentBlobGasUsed ) ;
LOG . error ( errorMessage ) ;
return new BlockProcessingResult ( Optional . empty ( ) , errorMessage ) ;
}
final Optional < WithdrawalsProcessor > maybeWithdrawalsProcessor =
protocolSpec . getWithdrawalsProcessor ( ) ;
if ( maybeWithdrawalsProcessor . isPresent ( ) & & maybeWithdrawals . isPresent ( ) ) {