default target gas limit for holesky (#8125)

* default target gas limit for holesky

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
This commit is contained in:
Sally MacFarlane
2025-01-17 05:55:29 +10:00
committed by GitHub
parent 1e7f6f6bf3
commit 870f3b7857
4 changed files with 61 additions and 0 deletions

View File

@@ -29,6 +29,7 @@
- Improve debug_traceBlock calls performance and reduce output size [#8076](https://github.com/hyperledger/besu/pull/8076)
- Add support for EIP-7702 transaction in the txpool [#8018](https://github.com/hyperledger/besu/pull/8018) [#7984](https://github.com/hyperledger/besu/pull/7984)
- Add support for `movePrecompileToAddress` in `StateOverrides` (`eth_call`)[8115](https://github.com/hyperledger/besu/pull/8115)
- Default target-gas-limit to 36M for holesky [#8125](https://github.com/hyperledger/besu/pull/8125)
- Add EIP-7623 - Increase calldata cost [#8093](https://github.com/hyperledger/besu/pull/8093)
### Bug fixes

View File

@@ -2132,6 +2132,13 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
getGenesisBlockPeriodSeconds(genesisConfigOptionsSupplier.get())
.ifPresent(miningParameters::setBlockPeriodSeconds);
initMiningParametersMetrics(miningParameters);
// if network = holesky, set targetGasLimit to 36,000,000 unless otherwise specified
if (miningParameters.getTargetGasLimit().isEmpty() && NetworkName.HOLESKY.equals(network)) {
logger.info(
"Setting target gas limit for holesky: {}",
MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
miningParameters.setTargetGasLimit(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
}
return miningParameters;
}

View File

@@ -1911,6 +1911,58 @@ public class BesuCommandTest extends CommandTestAbstract {
verify(mockLogger, never()).warn(contains("Holesky is deprecated and will be shutdown"));
}
@Test
public void holeskyTargetGasLimitIsSetToHoleskyDefaultWhenNoValueSpecified() {
parseCommand("--network", "holesky");
final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);
final ArgumentCaptor<MiningConfiguration> miningArg =
ArgumentCaptor.forClass(MiningConfiguration.class);
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).miningParameters(miningArg.capture());
verify(mockControllerBuilder).build();
assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY));
assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty());
assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000));
assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY);
assertThat(miningArg.getValue().getTargetGasLimit().getAsLong())
.isEqualTo(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void holeskyTargetGasLimitIsSetToSpecifiedValueWhenValueSpecified() {
long customGasLimit = 99000000;
parseCommand("--network", "holesky", "--target-gas-limit", String.valueOf(customGasLimit));
final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);
final ArgumentCaptor<MiningConfiguration> miningArg =
ArgumentCaptor.forClass(MiningConfiguration.class);
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).miningParameters(miningArg.capture());
verify(mockControllerBuilder).build();
assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY));
assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty());
assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000));
assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY);
assertThat(miningArg.getValue().getTargetGasLimit().getAsLong()).isEqualTo(customGasLimit);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void luksoValuesAreUsed() {
parseCommand("--network", "lukso");

View File

@@ -35,6 +35,7 @@ import org.immutables.value.Value;
@Value.Immutable
@Value.Enclosing
public abstract class MiningConfiguration {
public static final long DEFAULT_TARGET_GAS_LIMIT_HOLESKY = 36_000_000L;
public static final PositiveNumber DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME =
PositiveNumber.fromInt((int) Duration.ofSeconds(5).toMillis());
public static final PositiveNumber DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME =