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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

### Breaking Changes
- Clique consensus has been removed. Besu can no longer start or mine on pure Clique networks. Syncing networks that started as Clique and have since transitioned to PoS via `terminalTotalDifficulty` (e.g. Linea Mainnet) are still supported. [#9852](https://github.com/hyperledger/besu/pull/9852)
- Deprecated `--min-block-occupancy-ratio` for removal and make it noop. That option, that is ignored on PoS networks, is related to the deprecated PoW, and allowed to broadcast a mined block as soon as it reached a satisfying fill threshold. The option is still recognized, but it has no effect and will be completely removed in a future release. [#10036](https://github.com/besu-eth/besu/pull/10036)
- Plugin API
- Removed `TransactionSelectionResult.BLOCK_OCCUPANCY_ABOVE_THRESHOLD`, in general it could be replaced with `BLOCK_FULL`

### Upcoming Breaking Changes
- RPC changes to enhance compatibility with other ELs
Expand All @@ -18,6 +21,7 @@
- Holesky network is deprecated [#9437](https://github.com/hyperledger/besu/pull/9437)
- Sunsetting features - for more context on the reasoning behind the deprecation of these features, including alternative options, read [this blog post](https://www.lfdecentralizedtrust.org/blog/sunsetting-tessera-and-simplifying-hyperledger-besu)
- Proof of Work consensus (PoW)
- `--min-block-occupancy-ratio` is deprecated and will be removed in a future release
- Plugin API
- `PluginTransactionSelectorFactory.create(final SelectorsStateManager selectorsStateManager)` is deprecated for removal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_POS_BLOCK_TXS_SELECTION_MAX_TIME;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_EXTRA_DATA;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_BLOCK_OCCUPANCY_RATIO;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_PRIORITY_FEE_PER_GAS;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_TRANSACTION_GAS_PRICE;
import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_POS_BLOCK_CREATION_MAX_TIME;
Expand Down Expand Up @@ -50,6 +49,10 @@

/** The Mining CLI options. */
public class MiningOptions implements CLIOptions<MiningConfiguration> {

private static final String DEPRECATION_PREFIX =
"Deprecated. PoW consensus is deprecated. See CHANGELOG for alternative options. ";

@Option(
names = {"--miner-extra-data"},
description =
Expand All @@ -59,8 +62,13 @@ public class MiningOptions implements CLIOptions<MiningConfiguration> {

@Option(
names = {"--min-block-occupancy-ratio"},
description = "Minimum occupancy ratio for a mined block (default: ${DEFAULT-VALUE})")
private Double minBlockOccupancyRatio = DEFAULT_MIN_BLOCK_OCCUPANCY_RATIO;
hidden = true,
description =
DEPRECATION_PREFIX
+ "Minimum occupancy ratio for a mined block (default: ${DEFAULT-VALUE})")
@SuppressWarnings("UnusedVariable")
@Deprecated
private Double minBlockOccupancyRatio = null;

@Option(
names = {"--min-gas-price"},
Expand Down Expand Up @@ -261,7 +269,6 @@ static MiningOptions fromConfig(final MiningConfiguration miningConfiguration) {
miningOptions.extraData = miningConfiguration.getExtraData();
miningOptions.minTransactionGasPrice = miningConfiguration.getMinTransactionGasPrice();
miningOptions.minPriorityFeePerGas = miningConfiguration.getMinPriorityFeePerGas();
miningOptions.minBlockOccupancyRatio = miningConfiguration.getMinBlockOccupancyRatio();
miningOptions.posBlockTxsSelectionMaxTime =
miningConfiguration.getPosBlockTxsSelectionMaxTime();
miningOptions.poaBlockTxsSelectionMaxTime =
Expand Down Expand Up @@ -296,8 +303,7 @@ public MiningConfiguration toDomainObject() {
MutableInitValues.builder()
.extraData(extraData)
.minTransactionGasPrice(minTransactionGasPrice)
.minPriorityFeePerGas(minPriorityFeePerGas)
.minBlockOccupancyRatio(minBlockOccupancyRatio);
.minPriorityFeePerGas(minPriorityFeePerGas);

if (maxBlobsPerTransaction != null) {
updatableInitValuesBuilder.maxBlobsPerTransaction(maxBlobsPerTransaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,7 @@ protected MiningConfiguration createDefaultDomainObject() {
protected MiningConfiguration createCustomizedDomainObject() {
return ImmutableMiningConfiguration.builder()
.mutableInitValues(
MutableInitValues.builder()
.extraData(Bytes.fromHexString("0xabc321"))
.minBlockOccupancyRatio(0.5)
.build())
MutableInitValues.builder().extraData(Bytes.fromHexString("0xabc321")).build())
.unstable(Unstable.builder().posBlockCreationMaxTime(1000).build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,6 @@
public class MergeCoordinator implements MergeMiningCoordinator, BadChainListener {
private static final Logger LOG = LoggerFactory.getLogger(MergeCoordinator.class);

/**
* On PoS you do not need to compete with other nodes for block production, since you have an
* allocated slot for that, so in this case make sense to always try to fill the block, if there
* are enough pending transactions, until the remaining gas is less than the minimum needed for
* the smaller transaction. So for PoS the min-block-occupancy-ratio option is set to always try
* to fill 100% of the block.
*/
private static final double TRY_FILL_BLOCK = 1.0;

/** The Mining parameters. */
protected final MiningConfiguration miningConfiguration;

Expand Down Expand Up @@ -175,7 +166,6 @@ public MergeCoordinator(
if (miningParams.getTargetGasLimit().isEmpty()) {
getDefaultGasLimit(protocolSchedule).ifPresent(miningParams::setTargetGasLimit);
}
miningParams.setMinBlockOccupancyRatio(TRY_FILL_BLOCK);
this.miningConfiguration = miningParams;

this.mergeBlockCreatorFactory = mergeBlockCreatorFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ protected MiningConfiguration createMiningConfiguration() {
MutableInitValues.builder()
.extraData(Bytes.EMPTY)
.minTransactionGasPrice(Wei.ONE)
.minBlockOccupancyRatio(0d)
.coinbase(Address.ZERO)
.build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ public TransactionSelectionResult evaluateTransactionPreProcessing(
.setMessage("Transaction {} too large to select for block creation")
.addArgument(evaluationContext.getPendingTransaction()::toTraceLog)
.log();
if (blockOccupancyAboveThreshold(state)) {
LOG.trace("Block occupancy above threshold, completing operation");
return TransactionSelectionResult.BLOCK_OCCUPANCY_ABOVE_THRESHOLD;
} else if (blockFull(state)) {
if (blockFull(state)) {
LOG.trace("Block full, completing operation");
return TransactionSelectionResult.BLOCK_FULL;
} else {
Expand Down Expand Up @@ -127,29 +124,6 @@ private boolean transactionTooLargeForBlock(final Transaction transaction, final
transaction.getGasLimit(), state.regularGas(), state.stateGas(), blockGasLimit);
}

/**
* Checks if the block occupancy is above the threshold.
*
* @param state The current gas state.
* @return True if the block occupancy is above the threshold, false otherwise.
*/
private boolean blockOccupancyAboveThreshold(final GasState state) {
final long gasUsed =
gasAccountingStrategy.effectiveGasUsed(state.regularGas(), state.stateGas());
final long gasRemaining = blockGasLimit - gasUsed;
final double occupancyRatio = (double) gasUsed / (double) blockGasLimit;

LOG.trace(
"Min block occupancy ratio {}, gas used {}, available {}, remaining {}, used/available {}",
context.miningConfiguration().getMinBlockOccupancyRatio(),
gasUsed,
blockGasLimit,
gasRemaining,
occupancyRatio);

return occupancyRatio >= context.miningConfiguration().getMinBlockOccupancyRatio();
}

/**
* Checks if the block is full.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ private CreateOn createBlockCreator(final ProtocolSpecAdapters protocolSpecAdapt
MutableInitValues.builder()
.extraData(Bytes.fromHexString("deadbeef"))
.minTransactionGasPrice(Wei.ONE)
.minBlockOccupancyRatio(0d)
.coinbase(Address.ZERO)
.build())
.build();
Expand Down
Loading
Loading