Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
fab-10 committed Jan 20, 2025
2 parents 1bb7624 + 702ce74 commit 448d1a9
Showing 397 changed files with 1,447 additions and 1,059 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,10 @@
### Upcoming Breaking Changes
- `MetricSystem::createLabelledGauge` is deprecated and will be removed in a future release, replace it with `MetricSystem::createLabelledSuppliedGauge`
- k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release. Use docker or none instead.
- `--Xsnapsync-synchronizer-flat-db-healing-enabled` is deprecated, use `--Xbonsai-full-flat-db-enabled` instead.
- `--Xbonsai-limit-trie-logs-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead.
- `--Xbonsai-trie-log-pruning-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead.
- `--Xbonsai-trie-logs-pruning-window-size` is deprecated, use `--bonsai-trie-logs-pruning-window-size` instead.
- 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)
- Tessera privacy
- Smart-contract-based (onchain) permissioning
@@ -25,6 +29,9 @@
- 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)
- Add nonce to transaction call object [#8139](https://github.com/hyperledger/besu/pull/8139)

### Bug fixes
- Fix serialization of state overrides when `movePrecompileToAddress` is present [#8204](https://github.com/hyperledger/besu/pull/8024)
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@
*/
package org.hyperledger.besu.tests.acceptance.dsl.transaction.eth;

import static org.web3j.protocol.core.DefaultBlockParameterName.LATEST;

import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction;

@@ -36,11 +38,13 @@ public EthEstimateGasTransaction(final String contractAddress, final String func
public EthEstimateGas execute(final NodeRequests node) {
try {

var nonce = node.eth().ethGetTransactionCount(from, LATEST).send().getTransactionCount();

return node.eth()
.ethEstimateGas(
new org.web3j.protocol.core.methods.request.Transaction(
from,
BigInteger.ONE,
nonce,
BigInteger.ZERO,
BigInteger.ZERO,
contractAddress,
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
@@ -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": {
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
@@ -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;
}

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
@@ -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");
Original file line number Diff line number Diff line change
@@ -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;
@@ -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();
Original file line number Diff line number Diff line change
@@ -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.
@@ -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;
}

/**
@@ -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
@@ -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",
6 changes: 4 additions & 2 deletions config/src/main/resources/mainnet.json
Original file line number Diff line number Diff line change
@@ -19,11 +19,13 @@
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6
"max": 6,
"baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9
"max": 9,
"baseFeeUpdateFraction": 5007716
}
},
"ethash": {
12 changes: 12 additions & 0 deletions config/src/main/resources/sepolia.json
Original file line number Diff line number Diff line change
@@ -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",
Original file line number Diff line number Diff line change
@@ -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
@@ -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"
@@ -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) {
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
@@ -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",
Original file line number Diff line number Diff line change
@@ -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;
@@ -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();
Original file line number Diff line number Diff line change
@@ -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;
@@ -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() {
Original file line number Diff line number Diff line change
@@ -356,6 +356,7 @@ private Optional<CallResult> executeCall(final DataFetchingEnvironment environme
maxFeePerGas,
valueParam,
data,
Optional.empty(),
Optional.empty());

return transactionSimulator.process(
Loading

0 comments on commit 448d1a9

Please sign in to comment.