Skip to content

Commit

Permalink
fix excess blob gas calculation when creating blobs
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan <[email protected]>
  • Loading branch information
pinges committed Aug 23, 2023
1 parent 47285a4 commit 614cc93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.WithdrawalsProcessor;
import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.ExcessBlobGasCalculator;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.evm.account.EvmAccount;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
Expand Down Expand Up @@ -317,9 +318,7 @@ private GasUsage computeExcessBlobGas(
// casting parent excess blob gas to long since for the moment it should be well below that
// limit
BlobGas excessBlobGas =
BlobGas.of(
gasCalculator.computeExcessBlobGas(
parentHeader.getExcessBlobGas().map(BlobGas::toLong).orElse(0L), newBlobsCount));
ExcessBlobGasCalculator.calculateExcessBlobGasForParent(newProtocolSpec, parentHeader);
BlobGas used = BlobGas.of(gasCalculator.blobGasCost(newBlobsCount));
return new GasUsage(excessBlobGas, used);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public long computeExcessBlobGas(final long parentExcessBlobGas, final int newBl
}

@Override
public long computeExcessBlobGas(final long parentExcessBlobGas, final long blobGasUsed) {
final long currentExcessBlobGas = parentExcessBlobGas + blobGasUsed;
public long computeExcessBlobGas(final long parentExcessBlobGas, final long parentBlobGasUsed) {
final long currentExcessBlobGas = parentExcessBlobGas + parentBlobGasUsed;

if (currentExcessBlobGas < TARGET_BLOB_GAS_PER_BLOCK) {
return 0L;
Expand Down

0 comments on commit 614cc93

Please sign in to comment.