Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default storage format now Bonsai #6536

Merged
merged 23 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
451d4d9
snap default
macfarla Feb 6, 2024
b0714e5
default bonsai
macfarla Feb 6, 2024
44c1425
snap by default to replace fast
macfarla Feb 6, 2024
7795f2c
default snap
macfarla Feb 6, 2024
5c8bce9
removed dup test / merge snafu
macfarla Feb 6, 2024
2f92139
default bonsai
macfarla Feb 6, 2024
e6fa9cb
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 7, 2024
b8a6702
be explicit about config in tests
macfarla Feb 7, 2024
872593a
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 7, 2024
ece0c7c
fixed test support in-memory storage
macfarla Feb 7, 2024
b321346
default (forest) config for runner test
macfarla Feb 7, 2024
a722135
default (forest) config for ATs
macfarla Feb 7, 2024
a23fec0
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 9, 2024
8bb3c18
default forest storage for fast sync tests
macfarla Feb 9, 2024
a7638bb
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 9, 2024
c40de90
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 15, 2024
5fd4efd
added upcoming breaking changes section
macfarla Feb 15, 2024
79f5181
changelog
macfarla Feb 15, 2024
131792f
added db mismatch message
macfarla Feb 16, 2024
673ab7f
Merge branch 'main' of github.com:hyperledger/besu into bonsai-default
macfarla Feb 16, 2024
0824e50
reword changelog
macfarla Feb 16, 2024
dcd3bae
Update CHANGELOG.md
macfarla Feb 16, 2024
d42908f
Merge branch 'main' into bonsai-default
macfarla Feb 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
## 24.2.0-SNAPSHOT

### Breaking Changes
- SNAP - Snap sync is now the default for named networks [#6530](https://github.com/hyperledger/besu/pull/6530)
- if you want to use the previous default behavior, you'll need to specify `--sync-mode=FAST`
- BONSAI - Default data storage format is now Bonsai [#6536](https://github.com/hyperledger/besu/pull/6536)
- if you had previously used the default (FOREST), at startup you will get an error indicating the mismatch
`Mismatch: DB at '/your-path' is FOREST (Version 1) but config expects BONSAI (Version 2). Please check your config.`
- to fix this mismatch, specify the format explicitly using `--data-storage-format=FOREST`
- Following the OpenMetrics convention, the updated Prometheus client adds the `_total` suffix to every metrics of type counter, with the effect that some existing metrics have been renamed to have this suffix. If you are using the official Besu Grafana dashboard [(available here)](https://grafana.com/grafana/dashboards/16455-besu-full/), just update it to the latest revision, that accepts the old and the new name of the affected metrics. If you have a custom dashboard or use the metrics in other ways, then you need to manually update it to support the new naming.
- The `trace-filter` method in JSON-RPC API now has a default block range limit of 1000, adjustable with `--rpc-max-trace-filter-range` (thanks @alyokaz) [#6446](https://github.com/hyperledger/besu/pull/6446)
- Requesting the Ethereum Node Record (ENR) to acquire the fork id from bonded peers is now enabled by default, so the following change has been made [#5628](https://github.com/hyperledger/besu/pull/5628):
- `--Xfilter-on-enr-fork-id` has been removed. To disable the feature use `--filter-on-enr-fork-id=false`.
- `--engine-jwt-enabled` has been removed. Use `--engine-jwt-disabled` instead. [#6491](https://github.com/hyperledger/besu/pull/6491)
- SNAP sync is now the default for named networks [#6530](https://github.com/hyperledger/besu/pull/6530)

### Deprecations
- X_SNAP and X_CHECKPOINT are marked for deprecation and will be removed in 24.4.0 in favor of SNAP and CHECKPOINT [#6405](https://github.com/hyperledger/besu/pull/6405)
- `--Xsnapsync-synchronizer-flat-db-healing-enabled` is deprecated (always enabled). [#6499](https://github.com/hyperledger/besu/pull/6499)
- `--Xp2p-peer-lower-bound` [#6501](https://github.com/hyperledger/besu/pull/6501)
- `--Xp2p-peer-lower-bound` is deprecated. [#6501](https://github.com/hyperledger/besu/pull/6501)

### Upcoming Breaking Changes
- `--Xbonsai-limit-trie-logs-enabled` will be removed. You will need to use `--bonsai-limit-trie-logs-enabled` instead. Additionally, this limit will change to be enabled by default.
- If you do not want the limit enabled (eg you have `--bonsai-historical-block-limit` set < 512), you need to explicitly disable it using `--bonsai-limit-trie-logs-enabled=false` or increase the limit. [#6561](https://github.com/hyperledger/besu/pull/6561)

### Additions and Improvements
- Upgrade Prometheus and Opentelemetry dependencies [#6422](https://github.com/hyperledger/besu/pull/6422)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import static java.nio.charset.StandardCharsets.UTF_8;

import org.hyperledger.besu.cli.options.TransactionPoolOptions;
import org.hyperledger.besu.cli.options.stable.DataStorageOptions;
import org.hyperledger.besu.cli.options.unstable.NetworkingOptions;
import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.services.metrics.MetricCategory;
import org.hyperledger.besu.tests.acceptance.dsl.StaticNodesUtils;
Expand Down Expand Up @@ -109,6 +112,13 @@ public void startNode(final BesuNode node) {
.build())
.getCLIOptions());

params.addAll(
DataStorageOptions.fromConfig(
ImmutableDataStorageConfiguration.builder()
.from(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be better to use BONSAI in tests since it is the default?

.build())
.getCLIOptions());

if (node.getMiningParameters().isMiningEnabled()) {
params.add("--miner-enabled");
params.add("--miner-coinbase");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.MetricsSystemFactory;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
Expand Down Expand Up @@ -201,6 +202,7 @@ public void startNode(final BesuNode node) {
.nodeKey(new NodeKey(new KeyPairSecurityModule(KeyPairUtil.loadKeyPair(dataDir))))
.metricsSystem(metricsSystem)
.transactionPoolConfiguration(txPoolConfig)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

.ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig())
.clock(Clock.systemUTC())
.isRevertReasonEnabled(node.isRevertReasonEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
description =
"Format to store trie data in. Either FOREST or BONSAI (default: ${DEFAULT-VALUE}).",
arity = "1")
private DataStorageFormat dataStorageFormat = DataStorageFormat.FOREST;
private DataStorageFormat dataStorageFormat = DataStorageFormat.BONSAI;

@Option(
names = {BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD, "--bonsai-maximum-back-layers-to-load"},
Expand Down Expand Up @@ -139,7 +139,7 @@ public void validate(final CommandLine commandLine) {
}
}

static DataStorageOptions fromConfig(final DataStorageConfiguration domainObject) {
public static DataStorageOptions fromConfig(final DataStorageConfiguration domainObject) {
final DataStorageOptions dataStorageOptions = DataStorageOptions.create();
dataStorageOptions.dataStorageFormat = domainObject.getDataStorageFormat();
dataStorageOptions.bonsaiMaxLayersToLoad = domainObject.getBonsaiMaxLayersToLoad();
Expand Down
2 changes: 2 additions & 0 deletions besu/src/test/java/org/hyperledger/besu/RunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
Expand Down Expand Up @@ -457,6 +458,7 @@ private BesuController getController(
.privacyParameters(PrivacyParameters.DEFAULT)
.clock(TestClock.fixed())
.transactionPoolConfiguration(TransactionPoolConfiguration.DEFAULT)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.gasLimitCalculator(GasLimitCalculator.constant())
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
Expand Down
14 changes: 14 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 @@ -1149,6 +1149,20 @@ public void syncMode_full_by_default_for_dev() {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void storage_bonsai_by_default() {
parseCommand();
verify(mockControllerBuilder)
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());

final DataStorageConfiguration dataStorageConfig =
dataStorageConfigurationArgumentCaptor.getValue();
assertThat(dataStorageConfig.getDataStorageFormat()).isEqualTo(BONSAI);

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void syncMode_snap_by_default() {
parseCommand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public void setup() {
when(synchronizerConfiguration.getBlockPropagationRange()).thenReturn(Range.closed(1L, 2L));

lenient()
.when(storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_CONFIG))
.when(
storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_FOREST_CONFIG))
.thenReturn(worldStateStorage);
lenient()
.when(storageProvider.createWorldStatePreimageStorage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public void setup() {
.thenReturn(Range.closed(1L, 2L));

lenient()
.when(storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_CONFIG))
.when(
storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_FOREST_CONFIG))
.thenReturn(worldStateStorage);
lenient()
.when(storageProvider.createWorldStatePreimageStorage())
Expand Down Expand Up @@ -174,6 +175,7 @@ MergeBesuControllerBuilder visitWithMockConfigs(final MergeBesuControllerBuilder
.dataDirectory(tempDir)
.clock(clock)
.transactionPoolConfiguration(poolConfiguration)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.nodeKey(nodeKey)
.storageProvider(storageProvider)
.evmConfiguration(EvmConfiguration.DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public void setup() {
new VariablesKeyValueStorage(new InMemoryKeyValueStorage()),
new MainnetBlockHeaderFunctions()));
lenient()
.when(storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_CONFIG))
.when(
storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_FOREST_CONFIG))
.thenReturn(worldStateStorage);
lenient().when(worldStateStorage.isWorldStateAvailable(any(), any())).thenReturn(true);
lenient().when(worldStateStorage.updater()).thenReturn(mock(WorldStateStorage.Updater.class));
Expand Down Expand Up @@ -156,6 +157,7 @@ public void setup() {
.dataDirectory(tempDir)
.clock(clock)
.transactionPoolConfiguration(poolConfiguration)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.nodeKey(nodeKey)
.storageProvider(storageProvider)
.gasLimitCalculator(gasLimitCalculator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface DataStorageConfiguration {

DataStorageConfiguration DEFAULT_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.FOREST)
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.unstable(Unstable.DEFAULT)
.build();
Expand All @@ -37,6 +37,13 @@ public interface DataStorageConfiguration {
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build();

DataStorageConfiguration DEFAULT_FOREST_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.FOREST)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.unstable(Unstable.DEFAULT)
.build();

DataStorageFormat getDataStorageFormat();

Long getBonsaiMaxLayersToLoad();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static BonsaiWorldStateProvider createBonsaiInMemoryWorldStateArchive(
public static MutableWorldState createInMemoryWorldState() {
final InMemoryKeyValueStorageProvider provider = new InMemoryKeyValueStorageProvider();
return new ForestMutableWorldState(
provider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_CONFIG),
provider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_FOREST_CONFIG),
provider.createWorldStatePreimageStorage(),
EvmConfiguration.DEFAULT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static class GenesisStateTestArguments implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) {
return Stream.of(
Arguments.of(DataStorageConfiguration.DEFAULT_CONFIG),
Arguments.of(DataStorageConfiguration.DEFAULT_FOREST_CONFIG),
Arguments.of(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PersistDataStepTest {

private final WorldStateStorage worldStateStorage =
new InMemoryKeyValueStorageProvider()
.createWorldStateStorage(DataStorageConfiguration.DEFAULT_CONFIG);
.createWorldStateStorage(DataStorageConfiguration.DEFAULT_FOREST_CONFIG);
private final FastWorldDownloadState downloadState = mock(FastWorldDownloadState.class);

private final Bytes rootNodeData = Bytes.of(1, 1, 1, 1);
Expand Down
Loading