diff --git a/CHANGELOG.md b/CHANGELOG.md index 970e5103e5f..7c8f6713743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java index 538cb89e126..2b80ebea568 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java @@ -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; @@ -109,6 +112,13 @@ public void startNode(final BesuNode node) { .build()) .getCLIOptions()); + params.addAll( + DataStorageOptions.fromConfig( + ImmutableDataStorageConfiguration.builder() + .from(DataStorageConfiguration.DEFAULT_FOREST_CONFIG) + .build()) + .getCLIOptions()); + if (node.getMiningParameters().isMiningEnabled()) { params.add("--miner-enabled"); params.add("--miner-coinbase"); diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index a29a7b0ee60..1cfacc15c4b 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -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; @@ -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) .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .clock(Clock.systemUTC()) .isRevertReasonEnabled(node.isRevertReasonEnabled()) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java index e2f6d5fcfab..787fb9f66b6 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java @@ -49,7 +49,7 @@ public class DataStorageOptions implements CLIOptions 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"}, @@ -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(); diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java index c9e16baeecc..241e18ce09f 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java @@ -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; @@ -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()) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index 63841f12a86..961d69c2a59 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -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(); diff --git a/besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java index 73e3ca888c7..225b4ea62d3 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java @@ -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()) diff --git a/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java index 9506a35f402..8489867994c 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java @@ -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()) @@ -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) diff --git a/besu/src/test/java/org/hyperledger/besu/controller/QbftBesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/QbftBesuControllerBuilderTest.java index fc1b2f55f3f..13c712f04ea 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/QbftBesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/QbftBesuControllerBuilderTest.java @@ -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)); @@ -156,6 +157,7 @@ public void setup() { .dataDirectory(tempDir) .clock(clock) .transactionPoolConfiguration(poolConfiguration) + .dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG) .nodeKey(nodeKey) .storageProvider(storageProvider) .gasLimitCalculator(gasLimitCalculator) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java index 548ef60b6de..33304d53a98 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java @@ -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(); @@ -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(); diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java index 3f501704786..3e4543e3b63 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java @@ -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); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java index db69d0ca079..ee69c7e3611 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java @@ -57,7 +57,7 @@ static class GenesisStateTestArguments implements ArgumentsProvider { @Override public Stream provideArguments(final ExtensionContext context) { return Stream.of( - Arguments.of(DataStorageConfiguration.DEFAULT_CONFIG), + Arguments.of(DataStorageConfiguration.DEFAULT_FOREST_CONFIG), Arguments.of(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG)); } } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/PersistDataStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/PersistDataStepTest.java index 7306cf30107..367e279a6fa 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/PersistDataStepTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/PersistDataStepTest.java @@ -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);