Skip to content

Commit 870f3b7

Browse files
macfarlajflo
andauthored
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>
1 parent 1e7f6f6 commit 870f3b7

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Improve debug_traceBlock calls performance and reduce output size [#8076](https://github.com/hyperledger/besu/pull/8076)
3030
- 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)
3131
- Add support for `movePrecompileToAddress` in `StateOverrides` (`eth_call`)[8115](https://github.com/hyperledger/besu/pull/8115)
32+
- Default target-gas-limit to 36M for holesky [#8125](https://github.com/hyperledger/besu/pull/8125)
3233
- Add EIP-7623 - Increase calldata cost [#8093](https://github.com/hyperledger/besu/pull/8093)
3334

3435
### Bug fixes

besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,13 @@ private MiningConfiguration getMiningParameters() {
21322132
getGenesisBlockPeriodSeconds(genesisConfigOptionsSupplier.get())
21332133
.ifPresent(miningParameters::setBlockPeriodSeconds);
21342134
initMiningParametersMetrics(miningParameters);
2135+
// if network = holesky, set targetGasLimit to 36,000,000 unless otherwise specified
2136+
if (miningParameters.getTargetGasLimit().isEmpty() && NetworkName.HOLESKY.equals(network)) {
2137+
logger.info(
2138+
"Setting target gas limit for holesky: {}",
2139+
MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
2140+
miningParameters.setTargetGasLimit(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
2141+
}
21352142
return miningParameters;
21362143
}
21372144

besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,58 @@ public void holeskyValuesAreUsed() {
19111911
verify(mockLogger, never()).warn(contains("Holesky is deprecated and will be shutdown"));
19121912
}
19131913

1914+
@Test
1915+
public void holeskyTargetGasLimitIsSetToHoleskyDefaultWhenNoValueSpecified() {
1916+
parseCommand("--network", "holesky");
1917+
1918+
final ArgumentCaptor<EthNetworkConfig> networkArg =
1919+
ArgumentCaptor.forClass(EthNetworkConfig.class);
1920+
1921+
final ArgumentCaptor<MiningConfiguration> miningArg =
1922+
ArgumentCaptor.forClass(MiningConfiguration.class);
1923+
1924+
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
1925+
verify(mockControllerBuilder).miningParameters(miningArg.capture());
1926+
verify(mockControllerBuilder).build();
1927+
1928+
assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY));
1929+
1930+
assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty());
1931+
assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000));
1932+
assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY);
1933+
assertThat(miningArg.getValue().getTargetGasLimit().getAsLong())
1934+
.isEqualTo(MiningConfiguration.DEFAULT_TARGET_GAS_LIMIT_HOLESKY);
1935+
1936+
assertThat(commandOutput.toString(UTF_8)).isEmpty();
1937+
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
1938+
}
1939+
1940+
@Test
1941+
public void holeskyTargetGasLimitIsSetToSpecifiedValueWhenValueSpecified() {
1942+
long customGasLimit = 99000000;
1943+
parseCommand("--network", "holesky", "--target-gas-limit", String.valueOf(customGasLimit));
1944+
1945+
final ArgumentCaptor<EthNetworkConfig> networkArg =
1946+
ArgumentCaptor.forClass(EthNetworkConfig.class);
1947+
1948+
final ArgumentCaptor<MiningConfiguration> miningArg =
1949+
ArgumentCaptor.forClass(MiningConfiguration.class);
1950+
1951+
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
1952+
verify(mockControllerBuilder).miningParameters(miningArg.capture());
1953+
verify(mockControllerBuilder).build();
1954+
1955+
assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY));
1956+
1957+
assertThat(miningArg.getValue().getCoinbase()).isEqualTo(Optional.empty());
1958+
assertThat(miningArg.getValue().getMinTransactionGasPrice()).isEqualTo(Wei.of(1000));
1959+
assertThat(miningArg.getValue().getExtraData()).isEqualTo(Bytes.EMPTY);
1960+
assertThat(miningArg.getValue().getTargetGasLimit().getAsLong()).isEqualTo(customGasLimit);
1961+
1962+
assertThat(commandOutput.toString(UTF_8)).isEmpty();
1963+
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
1964+
}
1965+
19141966
@Test
19151967
public void luksoValuesAreUsed() {
19161968
parseCommand("--network", "lukso");

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@Value.Immutable
3636
@Value.Enclosing
3737
public abstract class MiningConfiguration {
38+
public static final long DEFAULT_TARGET_GAS_LIMIT_HOLESKY = 36_000_000L;
3839
public static final PositiveNumber DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME =
3940
PositiveNumber.fromInt((int) Duration.ofSeconds(5).toMillis());
4041
public static final PositiveNumber DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME =

0 commit comments

Comments
 (0)