Skip to content

Commit

Permalink
Merge branch 'main' into feature/fix_ethcall_response
Browse files Browse the repository at this point in the history
  • Loading branch information
matkt authored Jan 17, 2025
2 parents ffd3f4e + a98e950 commit 5f8b615
Show file tree
Hide file tree
Showing 34 changed files with 230 additions and 92 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions acceptance-tests/tests/src/test/resources/dev/dev_prague.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9
"max": 9,
"baseFeeUpdateFraction": 5007716
},
"osaka": {
"target": 9,
"max": 12
"max": 12,
"baseFeeUpdateFraction": 5007716
}
},
"clique": {
Expand Down
7 changes: 7 additions & 0 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,13 @@ private MiningConfiguration getMiningParameters() {
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;
}

Expand Down
52 changes: 52 additions & 0 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,58 @@ public void holeskyValuesAreUsed() {
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStoragePrefixedKeyBlockchainStorage;
Expand Down Expand Up @@ -106,7 +106,7 @@ public class MergeBesuControllerBuilderTest {

BigInteger networkId = BigInteger.ONE;
private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture();
private final BaseFeeMarket feeMarket = new LondonFeeMarket(0, Optional.of(Wei.of(42)));
private final BaseFeeMarket feeMarket = FeeMarket.london(0, Optional.of(Wei.of(42)));
private final TransactionPoolConfiguration poolConfiguration =
TransactionPoolConfiguration.DEFAULT;
private final ObservableMetricsSystem observableMetricsSystem = new NoOpMetricsSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ public Map<String, Object> asMap() {
public static class BlobSchedule {
private final int target;
private final int max;
private final int baseFeeUpdateFraction;

/** The constant CANCUN_DEFAULT. */
public static final BlobSchedule CANCUN_DEFAULT = new BlobSchedule(3, 6);
public static final BlobSchedule CANCUN_DEFAULT = new BlobSchedule(3, 6, 3338477);

/** The constant PRAGUE_DEFAULT. */
public static final BlobSchedule PRAGUE_DEFAULT = new BlobSchedule(6, 9);
public static final BlobSchedule PRAGUE_DEFAULT = new BlobSchedule(6, 9, 5007716);

/** The constant OSAKA_DEFAULT. */
public static final BlobSchedule OSAKA_DEFAULT = new BlobSchedule(9, 12);
public static final BlobSchedule OSAKA_DEFAULT = new BlobSchedule(9, 12, 5007716);

/**
* Instantiates a new Blob schedule.
Expand All @@ -100,11 +101,14 @@ public static class BlobSchedule {
public BlobSchedule(final ObjectNode blobScheduleConfigRoot) {
this.target = JsonUtil.getInt(blobScheduleConfigRoot, "target").orElseThrow();
this.max = JsonUtil.getInt(blobScheduleConfigRoot, "max").orElseThrow();
this.baseFeeUpdateFraction =
JsonUtil.getInt(blobScheduleConfigRoot, "basefeeupdatefraction").orElseThrow();
}

private BlobSchedule(final int target, final int max) {
private BlobSchedule(final int target, final int max, final int baseFeeUpdateFraction) {
this.target = target;
this.max = max;
this.baseFeeUpdateFraction = baseFeeUpdateFraction;
}

/**
Expand All @@ -125,13 +129,22 @@ public int getMax() {
return max;
}

/**
* Gets base fee update fraction.
*
* @return the base fee update fraction
*/
public int getBaseFeeUpdateFraction() {
return baseFeeUpdateFraction;
}

/**
* As map.
*
* @return the map
*/
Map<String, Object> asMap() {
return Map.of("target", target, "max", max);
return Map.of("target", target, "max", max, "baseFeeUpdateFraction", baseFeeUpdateFraction);
}
}
}
12 changes: 12 additions & 0 deletions config/src/main/resources/holesky.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
"terminalTotalDifficulty": 0,
"shanghaiTime": 1696000704,
"cancunTime": 1707305664,
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": 5007716
}
},
"ethash": {},
"discovery": {
"dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.holesky.ethdisco.net",
Expand Down
6 changes: 4 additions & 2 deletions config/src/main/resources/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9
"max": 9,
"baseFeeUpdateFraction": 5007716
}
},
"ethash": {
Expand Down
12 changes: 12 additions & 0 deletions config/src/main/resources/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
"terminalTotalDifficulty": 17000000000000000,
"shanghaiTime": 1677557088,
"cancunTime": 1706655072,
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": 5007716
}
},
"ethash":{},
"discovery": {
"dns": "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ public void blobScheduleIsParsed() {
assertThat(blobScheduleOptions.getCancun()).isNotEmpty();
assertThat(blobScheduleOptions.getCancun().get().getTarget()).isEqualTo(4);
assertThat(blobScheduleOptions.getCancun().get().getMax()).isEqualTo(7);
assertThat(blobScheduleOptions.getCancun().get().getBaseFeeUpdateFraction()).isEqualTo(3338477);
assertThat(blobScheduleOptions.getPrague()).isNotEmpty();
assertThat(blobScheduleOptions.getPrague().get().getTarget()).isEqualTo(7);
assertThat(blobScheduleOptions.getPrague().get().getMax()).isEqualTo(10);
assertThat(blobScheduleOptions.getPrague().get().getBaseFeeUpdateFraction()).isEqualTo(5007716);
assertThat(blobScheduleOptions.getOsaka()).isNotEmpty();
assertThat(blobScheduleOptions.getOsaka().get().getTarget()).isEqualTo(10);
assertThat(blobScheduleOptions.getOsaka().get().getMax()).isEqualTo(13);
assertThat(blobScheduleOptions.getOsaka().get().getBaseFeeUpdateFraction()).isEqualTo(5007716);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,18 @@ void asMapIncludesBlobFeeSchedule() {
+ " \"blobSchedule\": {\n"
+ " \"cancun\": {\n"
+ " \"target\": 1,\n"
+ " \"max\": 2\n"
+ " \"max\": 2,\n"
+ " \"baseFeeUpdateFraction\": 3\n"
+ " },\n"
+ " \"prague\": {\n"
+ " \"target\": 3,\n"
+ " \"max\": 4\n"
+ " \"target\": 4,\n"
+ " \"max\": 5,\n"
+ " \"baseFeeUpdateFraction\": 6\n"
+ " },\n"
+ " \"osaka\": {\n"
+ " \"target\": 4,\n"
+ " \"max\": 5\n"
+ " \"target\": 7,\n"
+ " \"max\": 8,\n"
+ " \"baseFeeUpdateFraction\": 9\n"
+ " }\n"
+ " }\n"
+ " }\n"
Expand All @@ -438,14 +441,14 @@ void asMapIncludesBlobFeeSchedule() {
final Map<String, Object> blobSchedule = (Map<String, Object>) map.get("blobSchedule");
assertThat(blobSchedule).containsOnlyKeys("cancun", "prague", "osaka");
assertThat((Map<String, Object>) blobSchedule.get("cancun"))
.containsOnlyKeys("target", "max")
.containsValues(1, 2);
.containsOnlyKeys("target", "max", "baseFeeUpdateFraction")
.containsValues(1, 2, 3);
assertThat((Map<String, Object>) blobSchedule.get("prague"))
.containsOnlyKeys("target", "max")
.containsValues(3, 4);
.containsOnlyKeys("target", "max", "baseFeeUpdateFraction")
.containsValues(4, 5, 6);
assertThat((Map<String, Object>) blobSchedule.get("osaka"))
.containsOnlyKeys("target", "max")
.containsValues(4, 5);
.containsOnlyKeys("target", "max", "baseFeeUpdateFraction")
.containsValues(7, 8, 9);
}

private GenesisConfigOptions fromConfigOptions(final Map<String, Object> configOptions) {
Expand Down
9 changes: 6 additions & 3 deletions config/src/test/resources/mainnet_with_blob_schedule.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
"blobSchedule": {
"cancun": {
"target": 4,
"max": 7
"max": 7,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 7,
"max": 10
"max": 10,
"baseFeeUpdateFraction": 5007716
},
"osaka": {
"target": 10,
"max": 13
"max": 13,
"baseFeeUpdateFraction": 5007716
}
},
"depositContractAddress": "0x4242424242424242424242424242424242424242",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import org.hyperledger.besu.ethereum.eth.transactions.sorter.BaseFeePendingTransactionsSorter;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.trie.MerkleTrieException;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.StubMetricsSystem;
Expand Down Expand Up @@ -158,7 +158,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper {
private final Address suggestedFeeRecipient = Address.ZERO;
private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture();
private final BaseFeeMarket feeMarket =
new LondonFeeMarket(0, genesisState.getBlock().getHeader().getBaseFee());
FeeMarket.london(0, genesisState.getBlock().getHeader().getBaseFee());

private final org.hyperledger.besu.metrics.StubMetricsSystem metricsSystem =
new StubMetricsSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.testutil.DeterministicEthScheduler;
import org.hyperledger.besu.util.LogConfigurator;
Expand Down Expand Up @@ -81,7 +81,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper {
private final Address coinbase = genesisAllocations(getPowGenesisConfig()).findFirst().get();
private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture();
private final BaseFeeMarket feeMarket =
new LondonFeeMarket(0, genesisState.getBlock().getHeader().getBaseFee());
FeeMarket.london(0, genesisState.getBlock().getHeader().getBaseFee());

@BeforeEach
public void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.LegacyFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.feemarket.LondonFeeMarket;
import org.hyperledger.besu.evm.log.LogsBloomFilter;

import java.util.HashMap;
Expand Down Expand Up @@ -289,11 +286,11 @@ private void verifyGasPriceLimit(
}

private void mockBaseFeeMarket() {
mockFeeMarket(new LondonFeeMarket(0));
mockFeeMarket(FeeMarket.london(0));
}

private void mockGasPriceMarket() {
mockFeeMarket(new LegacyFeeMarket());
mockFeeMarket(FeeMarket.legacy());
}

private void mockFeeMarket(final FeeMarket feeMarket) {
Expand All @@ -313,7 +310,7 @@ private void mockBlockchain(
final var genesisBlock = createFakeBlock(0, 0, genesisBaseFee);
blocksByNumber.put(0L, genesisBlock);

final var baseFeeMarket = new CancunFeeMarket(0, Optional.empty());
final var baseFeeMarket = FeeMarket.cancun(0, Optional.empty());

var baseFee = genesisBaseFee;
for (long i = 1; i <= chainHeadBlockNumber; i++) {
Expand Down
Loading

0 comments on commit 5f8b615

Please sign in to comment.