Skip to content

Commit

Permalink
Promote bonsai-limit-trie-logs-enabled and bonsai-trie-logs-pruning-w…
Browse files Browse the repository at this point in the history
…indow-size options (hyperledger#7192)

Promote option: create --bonsai-limit-trie-logs-enabled as alias of --Xbonsai-limit-trie-logs-enabled and unhide.
Also bonsai-trie-logs-pruning-window-size.
Remove --bonsai-historical-block-limit=512 from minimalist_staker profile so it inherits the default which is the same value

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
  • Loading branch information
siladu authored Jun 7, 2024
1 parent 7c21eed commit bfada7d
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 27 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

### Breaking Changes
- Java 21 has been enforced as minimum version to build and run Besu.
- With --Xbonsai-limit-trie-logs-enabled by default in this release, historic trie log data will be removed from the database unless sync-mode=FULL. It respects the --bonsai-historical-block-limit setting so shouldn't break any RPCs, but may be breaking if you are accessing this data from the database directly. Can be disabled with --Xbonsai-limit-trie-logs-enabled=false
- With --Xbonsai-limit-trie-logs-enabled by default in this release, historic trie log data will be removed from the database unless sync-mode=FULL. It respects the --bonsai-historical-block-limit setting so shouldn't break any RPCs, but may be breaking if you are accessing this data from the database directly. Can be disabled with --bonsai-limit-trie-logs-enabled=false
- In profile=ENTERPRISE, use sync-mode=FULL (instead of FAST) and data-storage-format=FOREST (instead of BONSAI) [#7186](https://github.com/hyperledger/besu/pull/7186)
- If this breaks your node, you can reset sync-mode=FAST and data-storage-format=BONSAI

### Upcoming Breaking Changes
- Receipt compaction will be enabled by default in a future version of Besu. After this change it will not be possible to downgrade to the previous Besu version.
- PKI-backed QBFT will be removed in a future version of Besu. Other forms of QBFT will remain unchanged.
- --Xbonsai-limit-trie-logs-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

### Additions and Improvements
- Add two counters to DefaultBlockchain in order to be able to calculate TPS and Mgas/s [#7105](https://github.com/hyperledger/besu/pull/7105)
- Enable --Xbonsai-limit-trie-logs-enabled by default, unless sync-mode=FULL [#7181](https://github.com/hyperledger/besu/pull/7181)
- Promote experimental --Xbonsai-limit-trie-logs-enabled to production-ready, --bonsai-limit-trie-logs-enabled [#7192](https://github.com/hyperledger/besu/pull/7192)
- Promote experimental --Xbonsai-trie-logs-pruning-window-size to production-ready, --bonsai-trie-logs-pruning-window-size [#7192](https://github.com/hyperledger/besu/pull/7192)
- `admin_nodeInfo` JSON/RPC call returns the currently active EVM version [#7127](https://github.com/hyperledger/besu/pull/7127)

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,30 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>

/** The unstable options for data storage. */
public static class Unstable {
private static final String BONSAI_LIMIT_TRIE_LOGS_ENABLED =
"--Xbonsai-limit-trie-logs-enabled";
private static final String BONSAI_LIMIT_TRIE_LOGS_ENABLED = "--bonsai-limit-trie-logs-enabled";

/** The bonsai trie logs pruning window size. */
public static final String BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE =
"--Xbonsai-trie-logs-pruning-window-size";
"--bonsai-trie-logs-pruning-window-size";

@SuppressWarnings("ExperimentalCliOptionMustBeCorrectlyDisplayed")
@CommandLine.Option(
hidden = true,
names = {BONSAI_LIMIT_TRIE_LOGS_ENABLED, "--Xbonsai-trie-log-pruning-enabled"},
names = {
BONSAI_LIMIT_TRIE_LOGS_ENABLED,
"--Xbonsai-limit-trie-logs-enabled",
"--Xbonsai-trie-log-pruning-enabled"
},
fallbackValue = "true",
description =
"Limit the number of trie logs that are retained. (default: ${DEFAULT-VALUE})")
private boolean bonsaiLimitTrieLogsEnabled = DEFAULT_BONSAI_LIMIT_TRIE_LOGS_ENABLED;
private Boolean bonsaiLimitTrieLogsEnabled = DEFAULT_BONSAI_LIMIT_TRIE_LOGS_ENABLED;

@SuppressWarnings("ExperimentalCliOptionMustBeCorrectlyDisplayed")
@CommandLine.Option(
hidden = true,
names = {BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE},
names = {BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE, "--Xbonsai-trie-logs-pruning-window-size"},
description =
"The max number of blocks to load and prune trie logs for at startup. (default: ${DEFAULT-VALUE})")
private int bonsaiTrieLogPruningWindowSize = DEFAULT_BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE;
private Integer bonsaiTrieLogPruningWindowSize = DEFAULT_BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE;

// TODO: --Xsnapsync-synchronizer-flat-db-healing-enabled is deprecated, remove it in a future
// release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ public void syncMode_fast() {

@Test
public void syncMode_full_requires_bonsaiLimitTrieLogsToBeDisabled() {
parseCommand("--sync-mode", "FULL", "--Xbonsai-limit-trie-logs-enabled=false");
parseCommand("--sync-mode", "FULL", "--bonsai-limit-trie-logs-enabled=false");
verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture());

final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue();
Expand Down Expand Up @@ -1264,13 +1264,13 @@ public void parsesInvalidDefaultBonsaiLimitTrieLogsWhenFullSyncEnabled() {
Mockito.verifyNoInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains("Cannot enable --Xbonsai-limit-trie-logs-enabled with sync-mode FULL");
.contains("Cannot enable --bonsai-limit-trie-logs-enabled with sync-mode FULL");
}

@Test
public void parsesValidBonsaiHistoricalBlockLimitOption() {
parseCommand(
"--Xbonsai-limit-trie-logs-enabled=false",
"--bonsai-limit-trie-logs-enabled=false",
"--data-storage-format",
"BONSAI",
"--bonsai-historical-block-limit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ public class DataStorageOptionsTest

@Test
public void bonsaiTrieLogPruningLimitOption() {
internalTestSuccess(
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getUnstable().getBonsaiTrieLogPruningWindowSize())
.isEqualTo(600),
"--bonsai-limit-trie-logs-enabled",
"--bonsai-trie-logs-pruning-window-size",
"600");
}

@Test
public void bonsaiTrieLogPruningLimitLegacyOption() {
internalTestSuccess(
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getUnstable().getBonsaiTrieLogPruningWindowSize())
Expand All @@ -44,24 +55,24 @@ public void bonsaiTrieLogsEnabled_explicitlySetToFalse() {
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getUnstable().getBonsaiLimitTrieLogsEnabled())
.isEqualTo(false),
"--Xbonsai-limit-trie-logs-enabled=false");
"--bonsai-limit-trie-logs-enabled=false");
}

@Test
public void bonsaiTrieLogPruningWindowSizeShouldBePositive() {
internalTestFailure(
"--Xbonsai-trie-logs-pruning-window-size=0 must be greater than 0",
"--Xbonsai-limit-trie-logs-enabled",
"--Xbonsai-trie-logs-pruning-window-size",
"--bonsai-trie-logs-pruning-window-size=0 must be greater than 0",
"--bonsai-limit-trie-logs-enabled",
"--bonsai-trie-logs-pruning-window-size",
"0");
}

@Test
public void bonsaiTrieLogPruningWindowSizeShouldBeAboveRetentionLimit() {
internalTestFailure(
"--Xbonsai-trie-logs-pruning-window-size=512 must be greater than --bonsai-historical-block-limit=512",
"--Xbonsai-limit-trie-logs-enabled",
"--Xbonsai-trie-logs-pruning-window-size",
"--bonsai-trie-logs-pruning-window-size=512 must be greater than --bonsai-historical-block-limit=512",
"--bonsai-limit-trie-logs-enabled",
"--bonsai-trie-logs-pruning-window-size",
"512");
}

Expand All @@ -71,7 +82,7 @@ public void bonsaiTrieLogRetentionLimitOption() {
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getBonsaiMaxLayersToLoad())
.isEqualTo(MINIMUM_BONSAI_TRIE_LOG_RETENTION_LIMIT + 1),
"--Xbonsai-limit-trie-logs-enabled",
"--bonsai-limit-trie-logs-enabled",
"--bonsai-historical-block-limit",
"513");
}
Expand All @@ -82,7 +93,7 @@ public void bonsaiTrieLogRetentionLimitOption_boundaryTest() {
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getBonsaiMaxLayersToLoad())
.isEqualTo(MINIMUM_BONSAI_TRIE_LOG_RETENTION_LIMIT),
"--Xbonsai-limit-trie-logs-enabled",
"--bonsai-limit-trie-logs-enabled",
"--bonsai-historical-block-limit",
"512");
}
Expand All @@ -91,7 +102,7 @@ public void bonsaiTrieLogRetentionLimitOption_boundaryTest() {
public void bonsaiTrieLogRetentionLimitShouldBeAboveMinimum() {
internalTestFailure(
"--bonsai-historical-block-limit minimum value is 512",
"--Xbonsai-limit-trie-logs-enabled",
"--bonsai-limit-trie-logs-enabled",
"--bonsai-historical-block-limit",
"511");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void trieLogPruningWindowSizeShouldBePositive() {
() ->
helper.prune(dataStorageConfiguration, inMemoryWorldState, blockchain, Path.of("")))
.isInstanceOf(RuntimeException.class)
.hasMessage("--Xbonsai-trie-logs-pruning-window-size=0 must be greater than 0");
.hasMessage("--bonsai-trie-logs-pruning-window-size=0 must be greater than 0");
}

@Test
Expand All @@ -358,7 +358,7 @@ public void trieLogPruningWindowSizeShouldBeAboveRetentionLimit() {
helper.prune(dataStorageConfiguration, inMemoryWorldState, blockchain, Path.of("")))
.isInstanceOf(RuntimeException.class)
.hasMessage(
"--Xbonsai-trie-logs-pruning-window-size=512 must be greater than --bonsai-historical-block-limit=512");
"--bonsai-trie-logs-pruning-window-size=512 must be greater than --bonsai-historical-block-limit=512");
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ ethstats-cacert-file="./root.cert"
# Data storage
data-storage-format="BONSAI"
bonsai-historical-block-limit=512
bonsai-limit-trie-logs-enabled=true
bonsai-trie-logs-pruning-window-size=100_000
receipt-compaction-enabled=true

# feature flags
Expand Down
2 changes: 1 addition & 1 deletion config/src/main/resources/profiles/enterprise-private.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tx-pool-no-local-priority=true
tx-pool-limit-by-account-percentage=0.15
rpc-http-max-active-connections=300
min-gas-price=0
Xbonsai-limit-trie-logs-enabled=false
bonsai-limit-trie-logs-enabled=false
1 change: 0 additions & 1 deletion config/src/main/resources/profiles/minimalist-staker.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sync-mode="CHECKPOINT"
data-storage-format="BONSAI"
bonsai-historical-block-limit=512
max-peers=25

0 comments on commit bfada7d

Please sign in to comment.