Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- Introduce the `TransactionValidatorService` to allow plugins to add custom validation rules [#8793](https://github.com/hyperledger/besu/pull/8793)
- Enable parallel tx processing by default if Bonsai is used [#8668](https://github.com/hyperledger/besu/pull/8668)
- Increase mainnet gas limit to 45M [#8824](https://github.com/hyperledger/besu/pull/8824)

- Expose a method to get blob gas price from plugins [#8843](https://github.com/hyperledger/besu/pull/8843)

#### Fusaka Devnet
- EIP-7825 - Transaction gas limit cap [#8700](https://github.com/hyperledger/besu/pull/8700)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
*/
package org.hyperledger.besu.services;

import static org.hyperledger.besu.ethereum.mainnet.feemarket.ExcessBlobGasCalculator.calculateExcessBlobGasForParent;

import org.hyperledger.besu.datatypes.BlobGas;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
Expand Down Expand Up @@ -120,6 +123,18 @@ public Optional<Wei> getNextBlockBaseFee() {
feeMarket.targetGasUsed(chainHeadHeader)));
}

@Override
public Wei getBlobGasPrice(final BlockHeader blockHeader) {
final var protocolSpec = protocolSchedule.getByBlockHeader(blockHeader);
final var maybeParentHeader = blockchain.getBlockHeader(blockHeader.getParentHash());
return protocolSpec
.getFeeMarket()
.blobGasPricePerGas(
maybeParentHeader
.map(parent -> calculateExcessBlobGasForParent(protocolSpec, parent))
.orElse(BlobGas.ZERO));
}

@Override
public Optional<List<TransactionReceipt>> getReceiptsByBlockHash(final Hash blockHash) {
return blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public ProtocolSchedule getPostMergeSchedule() {
* @return the ProtocolSpec to be used by the provided block
*/
@Override
public ProtocolSpec getByBlockHeader(final ProcessableBlockHeader blockHeader) {
public ProtocolSpec getByBlockHeader(
final org.hyperledger.besu.plugin.data.ProcessableBlockHeader blockHeader) {
return this.transitionUtils.dispatchFunctionAccordingToMergeState(
protocolSchedule -> protocolSchedule.getByBlockHeader(blockHeader));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.hyperledger.besu.datatypes.HardforkId;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.PermissionTransactionFilter;
import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader;
import org.hyperledger.besu.ethereum.mainnet.ScheduledProtocolSpec.BlockNumberProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.ScheduledProtocolSpec.TimestampProtocolSpec;
import org.hyperledger.besu.plugin.data.ProcessableBlockHeader;
import org.hyperledger.besu.plugin.services.txvalidator.TransactionValidationRule;

import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
import org.hyperledger.besu.ethereum.core.PermissionTransactionFilter;
import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader;
import org.hyperledger.besu.plugin.data.ProcessableBlockHeader;
import org.hyperledger.besu.plugin.services.txvalidator.TransactionValidationRule;

import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
*/
package org.hyperledger.besu.ethereum.mainnet;

import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader;
import org.hyperledger.besu.plugin.data.ProcessableBlockHeader;

/**
* Associates a {@link ProtocolSpec} with a given block number or timestamp level starting point
* Knows how to query the timestamp or block number of a given block header
*/
public interface ScheduledProtocolSpec {
boolean isOnOrAfterMilestoneBoundary(ProcessableBlockHeader header);
boolean isOnOrAfterMilestoneBoundary(
org.hyperledger.besu.plugin.data.ProcessableBlockHeader header);

boolean isOnMilestoneBoundary(ProcessableBlockHeader header);
boolean isOnMilestoneBoundary(org.hyperledger.besu.plugin.data.ProcessableBlockHeader header);

Hardfork fork();

Expand Down Expand Up @@ -60,12 +61,14 @@ private TimestampProtocolSpec(final long timestamp, final ProtocolSpec protocolS
}

@Override
public boolean isOnOrAfterMilestoneBoundary(final ProcessableBlockHeader header) {
public boolean isOnOrAfterMilestoneBoundary(
final org.hyperledger.besu.plugin.data.ProcessableBlockHeader header) {
return Long.compareUnsigned(header.getTimestamp(), timestamp) >= 0;
}

@Override
public boolean isOnMilestoneBoundary(final ProcessableBlockHeader header) {
public boolean isOnMilestoneBoundary(
final org.hyperledger.besu.plugin.data.ProcessableBlockHeader header) {
return header.getTimestamp() == timestamp;
}

Expand Down Expand Up @@ -95,7 +98,8 @@ private BlockNumberProtocolSpec(final long blockNumber, final ProtocolSpec proto
}

@Override
public boolean isOnOrAfterMilestoneBoundary(final ProcessableBlockHeader header) {
public boolean isOnOrAfterMilestoneBoundary(
final org.hyperledger.besu.plugin.data.ProcessableBlockHeader header) {
return header.getNumber() >= blockNumber;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = '4lHVP5Gc91MkqyiTvU9HVlBZx0tOgodIdOmasEAGTtM='
knownHash = '2iFZ9OBdtl1VoQLGPdqolq8zlBIkwszjin8vO4TkTqk='
}
check.dependsOn('checkAPIChanges')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public interface BlockchainService extends BesuService {
*/
Hash getChainHeadHash();

/**
* Return the blob gas price for the specified block
*
* @param blockHeader the block header
* @return the block gas price or Wei.ZERO if blobs are not yet supported for that block header
*/
Wei getBlobGasPrice(BlockHeader blockHeader);

/**
* Get the receipts for a block by block hash
*
Expand Down
Loading