Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle/verification-metadata.xml
  • Loading branch information
fab-10 committed Feb 7, 2025
2 parents 271edbb + cbabf87 commit 2abc4b6
Show file tree
Hide file tree
Showing 110 changed files with 2,147 additions and 573 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Changelog

## Unreleased
### Breaking Changes
### 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
- Proof of Work consensus
- Fast Sync
### Additions and Improvements
### Bug fixes

## 25.2.0

### Breaking Changes
- `rpc-gas-cap` default value has changed from 0 (unlimited) to 50M. If you require `rpc-gas-cap` greater than 50M, you'll need to set that explicitly. [#8251](https://github.com/hyperledger/besu/issues/8251)
### Upcoming Breaking Changes
Expand Down Expand Up @@ -28,6 +46,7 @@

### Bug fixes
- Fix the simulation of txs with a future nonce [#8215](https://github.com/hyperledger/besu/pull/8215)
- Bump to besu-native 1.1.2 for ubuntu 20.04 native support[#8264](https://github.com/hyperledger/besu/pull/8264)

## 25.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static Account create(final EthTransactions eth, final String name) {
return new Account(eth, name, SIGNATURE_ALGORITHM.get().generateKeyPair());
}

static Account fromPrivateKey(
public static Account fromPrivateKey(
final EthTransactions eth, final String name, final String privateKey) {
return new Account(
eth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageFactory;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.NodeConfiguration;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationProvider;
Expand Down Expand Up @@ -133,6 +134,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
private Optional<Integer> exitCode = Optional.empty();
private final boolean isStrictTxReplayProtectionEnabled;
private final Map<String, String> environment;
private final Optional<KeyValueStorageFactory> storageFactory;

public BesuNode(
final String name,
Expand Down Expand Up @@ -169,7 +171,8 @@ public BesuNode(
final List<String> runCommand,
final Optional<KeyPair> keyPair,
final boolean isStrictTxReplayProtectionEnabled,
final Map<String, String> environment)
final Map<String, String> environment,
final Optional<KeyValueStorageFactory> maybeStorageFactory)
throws IOException {
this.homeDirectory = dataPath.orElseGet(BesuNode::createTmpDataDirectory);
this.isStrictTxReplayProtectionEnabled = isStrictTxReplayProtectionEnabled;
Expand Down Expand Up @@ -211,6 +214,7 @@ public BesuNode(
this.secp256k1Native = secp256k1Native;
this.altbn128Native = altbn128Native;
this.runCommand = runCommand;
this.storageFactory = maybeStorageFactory;
plugins.forEach(
pluginName -> {
try {
Expand Down Expand Up @@ -836,4 +840,8 @@ public Map<String, String> getEnvironment() {
public ApiConfiguration getApiConfiguration() {
return apiConfiguration;
}

public Optional<KeyValueStorageFactory> getStorageFactory() {
return storageFactory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.hyperledger.besu.plugin.services.TransactionSimulationService;
import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry;
import org.hyperledger.besu.plugin.services.mining.MiningService;
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin;
import org.hyperledger.besu.plugin.services.transactionpool.TransactionPoolService;
import org.hyperledger.besu.services.BesuConfigurationImpl;
Expand Down Expand Up @@ -283,6 +284,7 @@ public String getConsoleContents() {
}

@Module
@SuppressWarnings("CloseableProvides")
static class BesuNodeProviderModule {

private final BesuNode toProvide;
Expand Down Expand Up @@ -413,6 +415,13 @@ TransactionSimulationServiceImpl provideTransactionSimulationService(
return retval;
}

@Provides
KeyValueStorageFactory provideKeyValueStorageFactory() {
return toProvide
.getStorageFactory()
.orElse(new InMemoryStoragePlugin.InMemoryKeyValueStorageFactory("memory"));
}

@Provides
@Singleton
MetricCategoryRegistryImpl provideMetricCategoryRegistry() {
Expand Down Expand Up @@ -565,14 +574,16 @@ public BesuPluginContextImpl providePluginContext(

@Provides
public KeyValueStorageProvider provideKeyValueStorageProvider(
final BesuConfiguration commonPluginConfiguration, final MetricsSystem metricsSystem) {
final BesuConfiguration commonPluginConfiguration,
final MetricsSystem metricsSystem,
final KeyValueStorageFactory keyValueStorageFactory) {

final StorageServiceImpl storageService = new StorageServiceImpl();
storageService.registerKeyValueStorage(
new InMemoryStoragePlugin.InMemoryKeyValueStorageFactory("memory"));
final KeyValueStorageFactory storageFactory = keyValueStorageFactory;
storageService.registerKeyValueStorage(storageFactory);
final KeyValueStorageProvider storageProvider =
new KeyValueStorageProviderBuilder()
.withStorageFactory(storageService.getByName("memory").get())
.withStorageFactory(storageFactory)
.withCommonConfiguration(commonPluginConfiguration)
.withMetricsSystem(metricsSystem)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageFactory;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationProvider;

import java.nio.file.Path;
Expand Down Expand Up @@ -72,6 +73,7 @@ public class BesuNodeConfiguration {
private final Optional<KeyPair> keyPair;
private final boolean strictTxReplayProtectionEnabled;
private final Map<String, String> environment;
private final Optional<KeyValueStorageFactory> storageFactory;

BesuNodeConfiguration(
final String name,
Expand Down Expand Up @@ -108,7 +110,8 @@ public class BesuNodeConfiguration {
final List<String> runCommand,
final Optional<KeyPair> keyPair,
final boolean strictTxReplayProtectionEnabled,
final Map<String, String> environment) {
final Map<String, String> environment,
final Optional<KeyValueStorageFactory> storageFactory) {
this.name = name;
this.miningConfiguration = miningConfiguration;
this.transactionPoolConfiguration = transactionPoolConfiguration;
Expand Down Expand Up @@ -144,6 +147,7 @@ public class BesuNodeConfiguration {
this.keyPair = keyPair;
this.strictTxReplayProtectionEnabled = strictTxReplayProtectionEnabled;
this.environment = environment;
this.storageFactory = storageFactory;
}

public String getName() {
Expand Down Expand Up @@ -285,4 +289,8 @@ public boolean isStrictTxReplayProtectionEnabled() {
public Map<String, String> getEnvironment() {
return environment;
}

public Optional<KeyValueStorageFactory> storageImplementation() {
return storageFactory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageFactory;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationProvider;

import java.io.File;
Expand Down Expand Up @@ -95,6 +96,7 @@ public class BesuNodeConfigurationBuilder {
private Optional<KeyPair> keyPair = Optional.empty();
private Boolean strictTxReplayProtectionEnabled = false;
private Map<String, String> environment = new HashMap<>();
private Optional<KeyValueStorageFactory> storageImplementation = Optional.empty();

public BesuNodeConfigurationBuilder() {
// Check connections more frequently during acceptance tests to cut down on
Expand Down Expand Up @@ -459,6 +461,12 @@ public BesuNodeConfigurationBuilder dataStorageConfiguration(
return this;
}

public BesuNodeConfigurationBuilder storageImplementation(
final KeyValueStorageFactory storageFactory) {
this.storageImplementation = Optional.of(storageFactory);
return this;
}

public BesuNodeConfiguration build() {
return new BesuNodeConfiguration(
name,
Expand Down Expand Up @@ -495,6 +503,7 @@ public BesuNodeConfiguration build() {
runCommand,
keyPair,
strictTxReplayProtectionEnabled,
environment);
environment,
storageImplementation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public BesuNode create(final BesuNodeConfiguration config) throws IOException {
config.getRunCommand(),
config.getKeyPair(),
config.isStrictTxReplayProtectionEnabled(),
config.getEnvironment());
config.getEnvironment(),
config.storageImplementation());
}

public BesuNode createMinerNode(
Expand Down
1 change: 1 addition & 0 deletions acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
testImplementation project(':privacy-contracts')
testImplementation project(':testutil')
testImplementation project(':util')
implementation project(':plugins:rocksdb')

testImplementation 'commons-io:commons-io'
testImplementation 'io.grpc:grpc-all'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void shouldBeStableDuringLongTest(
} catch (RuntimeException e) {
assertThat(e.getMessage())
.contains(
"Revert reason: 'Transaction processing could not be completed due to an exception'");
"Revert reason: 'Transaction processing could not be completed due to an exception (Invalid opcode: 0x5f)'");
}

// Should initially be set to 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
*/
package org.hyperledger.besu.tests.acceptance.bootstrap;

import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBKeyValueStorageFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBMetricsFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions;
import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase;
import org.hyperledger.besu.tests.acceptance.dsl.account.Account;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNodeRunner;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
Expand All @@ -23,12 +29,14 @@
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfiguration;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder;

import java.util.List;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ClusterThreadNodeRunnerAcceptanceTest extends AcceptanceTestBase {

private Node fullNode;
private Node miner;
private Cluster noDiscoveryCluster;

@BeforeEach
Expand All @@ -38,14 +46,37 @@ public void setUp() throws Exception {
final BesuNodeRunner besuNodeRunner = new ThreadBesuNodeRunner();
noDiscoveryCluster = new Cluster(clusterConfiguration, net, besuNodeRunner);
final BesuNode noDiscoveryNode = besu.createNodeWithNoDiscovery("noDiscovery");
fullNode = besu.createArchiveNode("archive");
noDiscoveryCluster.start(noDiscoveryNode, fullNode);
miner =
besu.createMinerNode(
"miner",
(builder) -> {
KeyValueStorageFactory persistentStorageFactory =
new RocksDBKeyValueStorageFactory(
RocksDBCLIOptions.create()::toDomainObject,
List.of(KeyValueSegmentIdentifier.values()),
RocksDBMetricsFactory.PUBLIC_ROCKS_DB_METRICS);
builder.storageImplementation(persistentStorageFactory);
return builder;
});
noDiscoveryCluster.start(noDiscoveryNode, miner);
}

@Test
public void shouldVerifySomething() {
// we don't care what verifies, just that it gets to the point something can verify
fullNode.verify(net.awaitPeerCount(0));
miner.verify(net.awaitPeerCount(0));
}

@Test
void shouldMineTransactionsEvenAfterRestart() {
final Account recipient = accounts.createAccount("account1");
miner.execute(accountTransactions.createTransfer(recipient, 2));
miner.verify(recipient.balanceEquals(2));

noDiscoveryCluster.stop();
noDiscoveryCluster.start(miner);
// Checking that state is retained after restart
miner.verify(recipient.balanceEquals(2));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
public class MergeBesuControllerBuilder extends BesuControllerBuilder {
private final AtomicReference<SyncState> syncState = new AtomicReference<>();
private static final Logger LOG = LoggerFactory.getLogger(MergeBesuControllerBuilder.class);
private final PostMergeContext postMergeContext = new PostMergeContext();

/** Default constructor. */
public MergeBesuControllerBuilder() {}
Expand Down Expand Up @@ -198,7 +199,7 @@ protected MergeContext createConsensusContext(
&& blockchain.getGenesisBlockHeader().getDifficulty().isZero();

final MergeContext mergeContext =
PostMergeContext.get()
postMergeContext
.setSyncState(syncState.get())
.setTerminalTotalDifficulty(
genesisConfigOptions
Expand Down Expand Up @@ -261,7 +262,16 @@ protected List<PeerValidator> createPeerValidators(
@Override
public BesuController build() {
final BesuController controller = super.build();
PostMergeContext.get().setSyncState(controller.getSyncState());
postMergeContext.setSyncState(syncState.get());
return controller;
}

/**
* Gets post merge context.
*
* @return the post merge context
*/
public PostMergeContext getPostMergeContext() {
return postMergeContext;
}
}
Loading

0 comments on commit 2abc4b6

Please sign in to comment.