mirror of
https://github.com/vacp2p/status-linea-besu.git
synced 2026-01-08 21:38:15 -05:00
rename diffbased bonsai prefix (#8424)
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
This commit is contained in:
@@ -68,7 +68,7 @@ import org.hyperledger.besu.cli.options.RpcWebsocketOptions;
|
||||
import org.hyperledger.besu.cli.options.SynchronizerOptions;
|
||||
import org.hyperledger.besu.cli.options.TransactionPoolOptions;
|
||||
import org.hyperledger.besu.cli.options.storage.DataStorageOptions;
|
||||
import org.hyperledger.besu.cli.options.storage.DiffBasedSubStorageOptions;
|
||||
import org.hyperledger.besu.cli.options.storage.PathBasedExtraStorageOptions;
|
||||
import org.hyperledger.besu.cli.options.unstable.QBFTOptions;
|
||||
import org.hyperledger.besu.cli.presynctasks.PreSynchronizationTaskRunner;
|
||||
import org.hyperledger.besu.cli.presynctasks.PrivateDatabaseMigrationPreSyncTask;
|
||||
@@ -134,9 +134,9 @@ import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
|
||||
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.ethereum.worldstate.DiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutablePathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.evm.precompile.AbstractAltBnPrecompiledContract;
|
||||
import org.hyperledger.besu.evm.precompile.BigIntegerModularExponentiationPrecompiledContract;
|
||||
import org.hyperledger.besu.evm.precompile.KZGPointEvalPrecompiledContract;
|
||||
@@ -1652,7 +1652,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
|
||||
"--Xsnapsync-synchronizer-flat option can only be used when --Xbonsai-full-flat-db-enabled is true",
|
||||
dataStorageOptions
|
||||
.toDomainObject()
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getUnstable()
|
||||
.getFullFlatDbEnabled(),
|
||||
asList(
|
||||
@@ -1805,8 +1805,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
|
||||
.apiConfiguration(apiConfigurationSupplier.get())
|
||||
.besuComponent(besuComponent);
|
||||
if (DataStorageFormat.BONSAI.equals(getDataStorageConfiguration().getDataStorageFormat())) {
|
||||
final DiffBasedSubStorageConfiguration subStorageConfiguration =
|
||||
getDataStorageConfiguration().getDiffBasedSubStorageConfiguration();
|
||||
final PathBasedExtraStorageConfiguration subStorageConfiguration =
|
||||
getDataStorageConfiguration().getPathBasedExtraStorageConfiguration();
|
||||
besuControllerBuilder.isParallelTxProcessingEnabled(
|
||||
subStorageConfiguration.getUnstable().isParallelTxProcessingEnabled());
|
||||
}
|
||||
@@ -2144,30 +2144,30 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
|
||||
|
||||
if (SyncMode.FULL.equals(getDefaultSyncModeIfNotSet())
|
||||
&& DataStorageFormat.BONSAI.equals(dataStorageConfiguration.getDataStorageFormat())) {
|
||||
final DiffBasedSubStorageConfiguration diffBasedSubStorageConfiguration =
|
||||
dataStorageConfiguration.getDiffBasedSubStorageConfiguration();
|
||||
if (diffBasedSubStorageConfiguration.getLimitTrieLogsEnabled()) {
|
||||
final PathBasedExtraStorageConfiguration pathBasedExtraStorageConfiguration =
|
||||
dataStorageConfiguration.getPathBasedExtraStorageConfiguration();
|
||||
if (pathBasedExtraStorageConfiguration.getLimitTrieLogsEnabled()) {
|
||||
if (CommandLineUtils.isOptionSet(
|
||||
commandLine, DiffBasedSubStorageOptions.LIMIT_TRIE_LOGS_ENABLED)) {
|
||||
commandLine, PathBasedExtraStorageOptions.LIMIT_TRIE_LOGS_ENABLED)) {
|
||||
throw new ParameterException(
|
||||
commandLine,
|
||||
String.format(
|
||||
"Cannot enable %s with --sync-mode=%s and --data-storage-format=%s. You must set %s or use a different sync-mode",
|
||||
DiffBasedSubStorageOptions.LIMIT_TRIE_LOGS_ENABLED,
|
||||
PathBasedExtraStorageOptions.LIMIT_TRIE_LOGS_ENABLED,
|
||||
SyncMode.FULL,
|
||||
DataStorageFormat.BONSAI,
|
||||
DiffBasedSubStorageOptions.LIMIT_TRIE_LOGS_ENABLED + "=false"));
|
||||
PathBasedExtraStorageOptions.LIMIT_TRIE_LOGS_ENABLED + "=false"));
|
||||
}
|
||||
|
||||
dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.copyOf(dataStorageConfiguration)
|
||||
.withDiffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.copyOf(
|
||||
dataStorageConfiguration.getDiffBasedSubStorageConfiguration())
|
||||
.withPathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.copyOf(
|
||||
dataStorageConfiguration.getPathBasedExtraStorageConfiguration())
|
||||
.withLimitTrieLogsEnabled(false));
|
||||
logger.warn(
|
||||
"Forcing {}, since it cannot be enabled with --sync-mode={} and --data-storage-format={}.",
|
||||
DiffBasedSubStorageOptions.LIMIT_TRIE_LOGS_ENABLED + "=false",
|
||||
PathBasedExtraStorageOptions.LIMIT_TRIE_LOGS_ENABLED + "=false",
|
||||
SyncMode.FULL,
|
||||
DataStorageFormat.BONSAI);
|
||||
}
|
||||
@@ -2734,8 +2734,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
|
||||
}
|
||||
|
||||
if (DataStorageFormat.BONSAI.equals(getDataStorageConfiguration().getDataStorageFormat())) {
|
||||
final DiffBasedSubStorageConfiguration subStorageConfiguration =
|
||||
getDataStorageConfiguration().getDiffBasedSubStorageConfiguration();
|
||||
final PathBasedExtraStorageConfiguration subStorageConfiguration =
|
||||
getDataStorageConfiguration().getPathBasedExtraStorageConfiguration();
|
||||
if (subStorageConfiguration.getLimitTrieLogsEnabled()) {
|
||||
builder.setLimitTrieLogsEnabled();
|
||||
builder.setTrieLogRetentionLimit(subStorageConfiguration.getMaxLayersToLoad());
|
||||
|
||||
@@ -50,12 +50,12 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
|
||||
private Boolean receiptCompactionEnabled = DEFAULT_RECEIPT_COMPACTION_ENABLED;
|
||||
|
||||
/**
|
||||
* Options specific to diff-based storage modes. Holds the necessary parameters to configure
|
||||
* diff-based storage, such as the Bonsai mode or Verkle in the future.
|
||||
* Options specific to path-based storage modes. Holds the necessary parameters to configure
|
||||
* path-based storage, such as the Bonsai mode or Verkle in the future.
|
||||
*/
|
||||
@Mixin
|
||||
private DiffBasedSubStorageOptions diffBasedSubStorageOptions =
|
||||
DiffBasedSubStorageOptions.create();
|
||||
private PathBasedExtraStorageOptions pathBasedExtraStorageOptions =
|
||||
PathBasedExtraStorageOptions.create();
|
||||
|
||||
/** Default Constructor. */
|
||||
DataStorageOptions() {}
|
||||
@@ -75,7 +75,7 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
|
||||
* @param commandLine the full commandLine to check all the options specified by the user
|
||||
*/
|
||||
public void validate(final CommandLine commandLine) {
|
||||
diffBasedSubStorageOptions.validate(commandLine, dataStorageFormat);
|
||||
pathBasedExtraStorageOptions.validate(commandLine, dataStorageFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,8 +88,9 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
|
||||
final DataStorageOptions dataStorageOptions = DataStorageOptions.create();
|
||||
dataStorageOptions.dataStorageFormat = domainObject.getDataStorageFormat();
|
||||
dataStorageOptions.receiptCompactionEnabled = domainObject.getReceiptCompactionEnabled();
|
||||
dataStorageOptions.diffBasedSubStorageOptions =
|
||||
DiffBasedSubStorageOptions.fromConfig(domainObject.getDiffBasedSubStorageConfiguration());
|
||||
dataStorageOptions.pathBasedExtraStorageOptions =
|
||||
PathBasedExtraStorageOptions.fromConfig(
|
||||
domainObject.getPathBasedExtraStorageConfiguration());
|
||||
return dataStorageOptions;
|
||||
}
|
||||
|
||||
@@ -99,14 +100,14 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(dataStorageFormat)
|
||||
.receiptCompactionEnabled(receiptCompactionEnabled)
|
||||
.diffBasedSubStorageConfiguration(diffBasedSubStorageOptions.toDomainObject());
|
||||
.pathBasedExtraStorageConfiguration(pathBasedExtraStorageOptions.toDomainObject());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCLIOptions() {
|
||||
final List<String> cliOptions = CommandLineUtils.getCLIOptions(this, new DataStorageOptions());
|
||||
cliOptions.addAll(diffBasedSubStorageOptions.getCLIOptions());
|
||||
cliOptions.addAll(pathBasedExtraStorageOptions.getCLIOptions());
|
||||
return cliOptions;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
*/
|
||||
package org.hyperledger.besu.cli.options.storage;
|
||||
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DEFAULT_LIMIT_TRIE_LOGS_ENABLED;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DEFAULT_MAX_LAYERS_TO_LOAD;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DiffBasedUnstable.DEFAULT_CODE_USING_CODE_HASH_ENABLED;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DiffBasedUnstable.DEFAULT_FULL_FLAT_DB_ENABLED;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.DEFAULT_LIMIT_TRIE_LOGS_ENABLED;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.DEFAULT_MAX_LAYERS_TO_LOAD;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.PathBasedUnstable.DEFAULT_CODE_USING_CODE_HASH_ENABLED;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.PathBasedUnstable.DEFAULT_FULL_FLAT_DB_ENABLED;
|
||||
|
||||
import org.hyperledger.besu.cli.options.CLIOptions;
|
||||
import org.hyperledger.besu.cli.util.CommandLineUtils;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutablePathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,7 +33,8 @@ import picocli.CommandLine;
|
||||
import picocli.CommandLine.Option;
|
||||
|
||||
/** The Data storage CLI options. */
|
||||
public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorageConfiguration> {
|
||||
public class PathBasedExtraStorageOptions
|
||||
implements CLIOptions<PathBasedExtraStorageConfiguration> {
|
||||
|
||||
/** The maximum number of historical layers to load. */
|
||||
public static final String MAX_LAYERS_TO_LOAD = "--bonsai-historical-block-limit";
|
||||
@@ -80,10 +81,10 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
private Integer trieLogPruningWindowSize = DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
|
||||
@CommandLine.ArgGroup(validate = false)
|
||||
private final DiffBasedSubStorageOptions.Unstable unstableOptions = new Unstable();
|
||||
private final PathBasedExtraStorageOptions.Unstable unstableOptions = new Unstable();
|
||||
|
||||
/** Default Constructor. */
|
||||
DiffBasedSubStorageOptions() {}
|
||||
PathBasedExtraStorageOptions() {}
|
||||
|
||||
/** The unstable options for data storage. */
|
||||
public static class Unstable {
|
||||
@@ -125,8 +126,8 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
*
|
||||
* @return the data storage options
|
||||
*/
|
||||
public static DiffBasedSubStorageOptions create() {
|
||||
return new DiffBasedSubStorageOptions();
|
||||
public static PathBasedExtraStorageOptions create() {
|
||||
return new PathBasedExtraStorageOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +169,7 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
if (unstableOptions.isParallelTxProcessingEnabled) {
|
||||
throw new CommandLine.ParameterException(
|
||||
commandLine,
|
||||
"Transaction parallelization is not supported unless operating in a 'diffbased' mode, such as Bonsai.");
|
||||
"Transaction parallelization is not supported unless operating in a 'pathbased' mode, such as Bonsai.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,9 +180,9 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
* @param domainObject to be reversed
|
||||
* @return the options that correspond to the configuration
|
||||
*/
|
||||
public static DiffBasedSubStorageOptions fromConfig(
|
||||
final DiffBasedSubStorageConfiguration domainObject) {
|
||||
final DiffBasedSubStorageOptions dataStorageOptions = DiffBasedSubStorageOptions.create();
|
||||
public static PathBasedExtraStorageOptions fromConfig(
|
||||
final PathBasedExtraStorageConfiguration domainObject) {
|
||||
final PathBasedExtraStorageOptions dataStorageOptions = PathBasedExtraStorageOptions.create();
|
||||
dataStorageOptions.maxLayersToLoad = domainObject.getMaxLayersToLoad();
|
||||
dataStorageOptions.limitTrieLogsEnabled = domainObject.getLimitTrieLogsEnabled();
|
||||
dataStorageOptions.trieLogPruningWindowSize = domainObject.getTrieLogPruningWindowSize();
|
||||
@@ -196,13 +197,13 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public final DiffBasedSubStorageConfiguration toDomainObject() {
|
||||
return ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
public final PathBasedExtraStorageConfiguration toDomainObject() {
|
||||
return ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(maxLayersToLoad)
|
||||
.limitTrieLogsEnabled(limitTrieLogsEnabled)
|
||||
.trieLogPruningWindowSize(trieLogPruningWindowSize)
|
||||
.unstable(
|
||||
ImmutableDiffBasedSubStorageConfiguration.DiffBasedUnstable.builder()
|
||||
ImmutablePathBasedExtraStorageConfiguration.PathBasedUnstable.builder()
|
||||
.fullFlatDbEnabled(unstableOptions.fullFlatDbEnabled)
|
||||
.codeStoredByCodeHashEnabled(unstableOptions.codeUsingCodeHashEnabled)
|
||||
.isParallelTxProcessingEnabled(unstableOptions.isParallelTxProcessingEnabled)
|
||||
@@ -212,6 +213,6 @@ public class DiffBasedSubStorageOptions implements CLIOptions<DiffBasedSubStorag
|
||||
|
||||
@Override
|
||||
public List<String> getCLIOptions() {
|
||||
return CommandLineUtils.getCLIOptions(this, new DiffBasedSubStorageOptions());
|
||||
return CommandLineUtils.getCLIOptions(this, new PathBasedExtraStorageOptions());
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@
|
||||
package org.hyperledger.besu.cli.subcommands.storage;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static org.hyperledger.besu.cli.options.storage.DiffBasedSubStorageOptions.MAX_LAYERS_TO_LOAD;
|
||||
import static org.hyperledger.besu.cli.options.storage.DiffBasedSubStorageOptions.TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.cli.options.storage.PathBasedExtraStorageOptions.MAX_LAYERS_TO_LOAD;
|
||||
import static org.hyperledger.besu.cli.options.storage.PathBasedExtraStorageOptions.TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
|
||||
import org.hyperledger.besu.datatypes.Hash;
|
||||
import org.hyperledger.besu.ethereum.chain.Blockchain;
|
||||
@@ -26,11 +26,11 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
|
||||
import org.hyperledger.besu.ethereum.core.BlockHeader;
|
||||
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
|
||||
import org.hyperledger.besu.ethereum.rlp.RLP;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.trielog.TrieLogFactoryImpl;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.storage.DiffBasedWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogLayer;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.trielog.TrieLogFactoryImpl;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.storage.PathBasedWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogLayer;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -65,7 +65,7 @@ public class TrieLogHelper {
|
||||
|
||||
boolean prune(
|
||||
final DataStorageConfiguration config,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final MutableBlockchain blockchain,
|
||||
final Path dataDirectoryPath) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class TrieLogHelper {
|
||||
|
||||
validatePruneConfiguration(config);
|
||||
|
||||
final long layersToRetain = config.getDiffBasedSubStorageConfiguration().getMaxLayersToLoad();
|
||||
final long layersToRetain = config.getPathBasedExtraStorageConfiguration().getMaxLayersToLoad();
|
||||
|
||||
final long chainHeight = blockchain.getChainHeadBlockNumber();
|
||||
|
||||
@@ -121,7 +121,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
private void processTrieLogBatches(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final MutableBlockchain blockchain,
|
||||
final long chainHeight,
|
||||
final long lastBlockNumberToRetainTrieLogsFor,
|
||||
@@ -150,7 +150,7 @@ public class TrieLogHelper {
|
||||
|
||||
private void saveTrieLogBatches(
|
||||
final String batchFileName,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final List<Hash> trieLogKeys) {
|
||||
|
||||
try {
|
||||
@@ -162,7 +162,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
private void restoreTrieLogBatches(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final long batchNumber,
|
||||
final String batchFileNameBase) {
|
||||
|
||||
@@ -215,7 +215,7 @@ public class TrieLogHelper {
|
||||
final MutableBlockchain blockchain,
|
||||
final long chainHeight,
|
||||
final long lastBlockNumberToRetainTrieLogsFor,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final long layersToRetain) {
|
||||
|
||||
if (lastBlockNumberToRetainTrieLogsFor < 0) {
|
||||
@@ -255,7 +255,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
private void recreateTrieLogs(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final long batchNumber,
|
||||
final String batchFileNameBase)
|
||||
throws IOException {
|
||||
@@ -275,7 +275,7 @@ public class TrieLogHelper {
|
||||
final int chunkSize,
|
||||
final List<byte[]> keys,
|
||||
final IdentityHashMap<byte[], byte[]> trieLogsToRetain,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage) {
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage) {
|
||||
|
||||
var updater = rootWorldStateStorage.updater();
|
||||
int endIndex = Math.min(startIndex + chunkSize, keys.size());
|
||||
@@ -292,14 +292,14 @@ public class TrieLogHelper {
|
||||
|
||||
@VisibleForTesting
|
||||
void validatePruneConfiguration(final DataStorageConfiguration config) {
|
||||
final DiffBasedSubStorageConfiguration subStorageConfiguration =
|
||||
config.getDiffBasedSubStorageConfiguration();
|
||||
final PathBasedExtraStorageConfiguration subStorageConfiguration =
|
||||
config.getPathBasedExtraStorageConfiguration();
|
||||
checkArgument(
|
||||
subStorageConfiguration.getMaxLayersToLoad()
|
||||
>= DiffBasedSubStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT,
|
||||
>= PathBasedExtraStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT,
|
||||
String.format(
|
||||
MAX_LAYERS_TO_LOAD + " minimum value is %d",
|
||||
DiffBasedSubStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT));
|
||||
PathBasedExtraStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT));
|
||||
checkArgument(
|
||||
subStorageConfiguration.getTrieLogPruningWindowSize() > 0,
|
||||
String.format(
|
||||
@@ -316,7 +316,7 @@ public class TrieLogHelper {
|
||||
|
||||
private void saveTrieLogsInFile(
|
||||
final List<Hash> trieLogsKeys,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final String batchFileName)
|
||||
throws IOException {
|
||||
|
||||
@@ -353,7 +353,7 @@ public class TrieLogHelper {
|
||||
|
||||
private void saveTrieLogsAsRlpInFile(
|
||||
final List<Hash> trieLogsKeys,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final String batchFileName) {
|
||||
File file = new File(batchFileName);
|
||||
if (file.exists()) {
|
||||
@@ -399,7 +399,7 @@ public class TrieLogHelper {
|
||||
|
||||
private IdentityHashMap<byte[], byte[]> getTrieLogs(
|
||||
final List<Hash> trieLogKeys,
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage) {
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage) {
|
||||
IdentityHashMap<byte[], byte[]> trieLogsToRetain = new IdentityHashMap<>();
|
||||
|
||||
LOG.info("Obtaining trielogs from db, this may take a few minutes...");
|
||||
@@ -412,7 +412,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
TrieLogCount getCount(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final int limit,
|
||||
final Blockchain blockchain) {
|
||||
final AtomicInteger total = new AtomicInteger();
|
||||
@@ -453,7 +453,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
void importTrieLog(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage, final Path trieLogFilePath) {
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage, final Path trieLogFilePath) {
|
||||
|
||||
var trieLog = readTrieLogsAsRlpFromFile(trieLogFilePath.toString());
|
||||
|
||||
@@ -463,7 +463,7 @@ public class TrieLogHelper {
|
||||
}
|
||||
|
||||
void exportTrieLog(
|
||||
final DiffBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final PathBasedWorldStateKeyValueStorage rootWorldStateStorage,
|
||||
final List<Hash> trieLogHash,
|
||||
final Path directoryPath)
|
||||
throws IOException {
|
||||
|
||||
@@ -25,11 +25,11 @@ import org.hyperledger.besu.controller.BesuController;
|
||||
import org.hyperledger.besu.datatypes.Hash;
|
||||
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
|
||||
import org.hyperledger.besu.ethereum.storage.StorageProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogPruner;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogPruner;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutablePathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -91,9 +91,9 @@ public class TrieLogSubCommand implements Runnable {
|
||||
.setupControllerBuilder()
|
||||
.dataStorageConfiguration(
|
||||
ImmutableDataStorageConfiguration.copyOf(config)
|
||||
.withDiffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.copyOf(
|
||||
config.getDiffBasedSubStorageConfiguration())
|
||||
.withPathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.copyOf(
|
||||
config.getPathBasedExtraStorageConfiguration())
|
||||
.withLimitTrieLogsEnabled(false)))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ package org.hyperledger.besu.components;
|
||||
import org.hyperledger.besu.cli.BesuCommand;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.BlobCache;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.metrics.MetricsSystemModule;
|
||||
import org.hyperledger.besu.plugin.services.MetricsSystem;
|
||||
import org.hyperledger.besu.services.BesuPluginContextImpl;
|
||||
|
||||
@@ -85,14 +85,14 @@ import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
|
||||
import org.hyperledger.besu.ethereum.storage.StorageProvider;
|
||||
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
|
||||
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.BonsaiWorldStateProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogManager;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogPruner;
|
||||
import org.hyperledger.besu.ethereum.trie.forest.ForestWorldStateArchive;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.BonsaiWorldStateProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogManager;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogPruner;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive.WorldStateHealer;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateKeyValueStorage;
|
||||
@@ -786,8 +786,8 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
|
||||
protocolContext, protocolSchedule, miningConfiguration);
|
||||
|
||||
if (DataStorageFormat.BONSAI.equals(dataStorageConfiguration.getDataStorageFormat())) {
|
||||
final DiffBasedSubStorageConfiguration subStorageConfiguration =
|
||||
dataStorageConfiguration.getDiffBasedSubStorageConfiguration();
|
||||
final PathBasedExtraStorageConfiguration subStorageConfiguration =
|
||||
dataStorageConfiguration.getPathBasedExtraStorageConfiguration();
|
||||
if (subStorageConfiguration.getLimitTrieLogsEnabled()) {
|
||||
final TrieLogManager trieLogManager =
|
||||
((BonsaiWorldStateProvider) worldStateArchive).getTrieLogManager();
|
||||
@@ -850,8 +850,8 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
|
||||
final Blockchain blockchain,
|
||||
final EthScheduler scheduler) {
|
||||
final boolean isProofOfStake = genesisConfigOptions.getTerminalTotalDifficulty().isPresent();
|
||||
final DiffBasedSubStorageConfiguration subStorageConfiguration =
|
||||
dataStorageConfiguration.getDiffBasedSubStorageConfiguration();
|
||||
final PathBasedExtraStorageConfiguration subStorageConfiguration =
|
||||
dataStorageConfiguration.getPathBasedExtraStorageConfiguration();
|
||||
final TrieLogPruner trieLogPruner =
|
||||
new TrieLogPruner(
|
||||
(BonsaiWorldStateKeyValueStorage) worldStateStorage,
|
||||
@@ -1140,7 +1140,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
|
||||
blockchain,
|
||||
Optional.of(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getMaxLayersToLoad()),
|
||||
bonsaiCachedMerkleTrieLoader,
|
||||
besuComponent.map(BesuComponent::getBesuPluginContext).orElse(null),
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.hyperledger.besu.ethereum.transaction.BlockSimulator;
|
||||
import org.hyperledger.besu.ethereum.transaction.BlockStateCall;
|
||||
import org.hyperledger.besu.ethereum.transaction.CallParameter;
|
||||
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.provider.WorldStateQueryParams;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
|
||||
import org.hyperledger.besu.plugin.Unstable;
|
||||
import org.hyperledger.besu.plugin.data.BlockOverrides;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
package org.hyperledger.besu.services;
|
||||
|
||||
import static org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams.withBlockHeaderAndUpdateNodeHead;
|
||||
import static org.hyperledger.besu.ethereum.trie.pathbased.common.provider.WorldStateQueryParams.withBlockHeaderAndUpdateNodeHead;
|
||||
|
||||
import org.hyperledger.besu.consensus.merge.MergeContext;
|
||||
import org.hyperledger.besu.datatypes.Hash;
|
||||
@@ -26,9 +26,9 @@ import org.hyperledger.besu.ethereum.core.Synchronizer;
|
||||
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
|
||||
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
|
||||
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.DiffBasedWorldStateProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.storage.DiffBasedWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.provider.PathBasedWorldStateProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.storage.PathBasedWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
|
||||
import org.hyperledger.besu.plugin.data.BlockBody;
|
||||
import org.hyperledger.besu.plugin.data.BlockHeader;
|
||||
@@ -51,7 +51,7 @@ public class SynchronizationServiceImpl implements SynchronizationService {
|
||||
private final Synchronizer synchronizer;
|
||||
|
||||
private final SyncState syncState;
|
||||
private final Optional<DiffBasedWorldStateProvider> worldStateArchive;
|
||||
private final Optional<PathBasedWorldStateProvider> worldStateArchive;
|
||||
|
||||
/**
|
||||
* Constructor for SynchronizationServiceImpl.
|
||||
@@ -74,8 +74,8 @@ public class SynchronizationServiceImpl implements SynchronizationService {
|
||||
this.syncState = syncState;
|
||||
this.worldStateArchive =
|
||||
Optional.ofNullable(worldStateArchive)
|
||||
.filter(z -> z instanceof DiffBasedWorldStateProvider)
|
||||
.map(DiffBasedWorldStateProvider.class::cast);
|
||||
.filter(z -> z instanceof PathBasedWorldStateProvider)
|
||||
.map(PathBasedWorldStateProvider.class::cast);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,14 +147,14 @@ public class SynchronizationServiceImpl implements SynchronizationService {
|
||||
worldStateArchive.ifPresent(
|
||||
archive -> {
|
||||
archive.getWorldStateSharedSpec().setTrieDisabled(true);
|
||||
final DiffBasedWorldStateKeyValueStorage worldStateStorage =
|
||||
final PathBasedWorldStateKeyValueStorage worldStateStorage =
|
||||
archive.getWorldStateKeyValueStorage();
|
||||
final Optional<Hash> worldStateBlockHash = worldStateStorage.getWorldStateBlockHash();
|
||||
final Optional<Bytes> worldStateRootHash = worldStateStorage.getWorldStateRootHash();
|
||||
if (worldStateRootHash.isPresent() && worldStateBlockHash.isPresent()) {
|
||||
worldStateStorage.clearTrie();
|
||||
// keep root and block hash in the trie branch
|
||||
final DiffBasedWorldStateKeyValueStorage.Updater updater = worldStateStorage.updater();
|
||||
final PathBasedWorldStateKeyValueStorage.Updater updater = worldStateStorage.updater();
|
||||
updater.saveWorldState(
|
||||
worldStateBlockHash.get(), Bytes32.wrap(worldStateRootHash.get()), Bytes.EMPTY);
|
||||
updater.commit();
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
|
||||
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
|
||||
import org.hyperledger.besu.ethereum.privacy.storage.PrivacyStorageProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.evm.internal.EvmConfiguration;
|
||||
import org.hyperledger.besu.evm.precompile.PrecompiledContract;
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.hyperledger.besu.ethereum.privacy.storage.PrivacyGroupHeadBlockMap;
|
||||
import org.hyperledger.besu.ethereum.privacy.storage.PrivacyStorageProvider;
|
||||
import org.hyperledger.besu.ethereum.privacy.storage.PrivateStateStorage;
|
||||
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.evm.internal.EvmConfiguration;
|
||||
import org.hyperledger.besu.evm.log.LogsBloomFilter;
|
||||
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
|
||||
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoaderModule;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.evm.internal.EvmConfiguration;
|
||||
import org.hyperledger.besu.evm.precompile.PrecompiledContract;
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
|
||||
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
|
||||
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
|
||||
import org.hyperledger.besu.evm.internal.EvmConfiguration;
|
||||
import org.hyperledger.besu.metrics.MetricsSystemModule;
|
||||
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
|
||||
|
||||
@@ -1282,7 +1282,7 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffbasedLimitTrieLogsEnabledByDefault() {
|
||||
public void pathbasedLimitTrieLogsEnabledByDefault() {
|
||||
parseCommand();
|
||||
verify(mockControllerBuilder)
|
||||
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());
|
||||
@@ -1292,7 +1292,7 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
assertThat(dataStorageConfiguration.getDataStorageFormat()).isEqualTo(BONSAI);
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getLimitTrieLogsEnabled())
|
||||
.isTrue();
|
||||
assertThat(commandOutput.toString(UTF_8)).isEmpty();
|
||||
@@ -1311,7 +1311,7 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
assertThat(dataStorageConfiguration.getDataStorageFormat()).isEqualTo(BONSAI);
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getLimitTrieLogsEnabled())
|
||||
.isFalse();
|
||||
verify(mockLogger)
|
||||
@@ -1348,7 +1348,8 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
final DataStorageConfiguration dataStorageConfiguration =
|
||||
dataStorageConfigurationArgumentCaptor.getValue();
|
||||
assertThat(dataStorageConfiguration.getDataStorageFormat()).isEqualTo(BONSAI);
|
||||
assertThat(dataStorageConfiguration.getDiffBasedSubStorageConfiguration().getMaxLayersToLoad())
|
||||
assertThat(
|
||||
dataStorageConfiguration.getPathBasedExtraStorageConfiguration().getMaxLayersToLoad())
|
||||
.isEqualTo(11);
|
||||
assertThat(commandOutput.toString(UTF_8)).isEmpty();
|
||||
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
|
||||
@@ -2525,7 +2526,7 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
besuCommand
|
||||
.getDataStorageOptions()
|
||||
.toDomainObject()
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getUnstable()
|
||||
.getFullFlatDbEnabled())
|
||||
.isTrue();
|
||||
@@ -2538,7 +2539,7 @@ public class BesuCommandTest extends CommandTestAbstract {
|
||||
besuCommand
|
||||
.dataStorageOptions
|
||||
.toDomainObject()
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getUnstable()
|
||||
.getFullFlatDbEnabled())
|
||||
.isFalse();
|
||||
|
||||
@@ -162,7 +162,7 @@ class ConfigurationOverviewBuilderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void setDiffbasedLimitTrieLogsEnabled() {
|
||||
void setPathBasedLimitTrieLogsEnabled() {
|
||||
final String noTrieLogRetentionLimitSet = builder.build();
|
||||
assertThat(noTrieLogRetentionLimitSet).doesNotContain("Limit trie logs enabled");
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
package org.hyperledger.besu.cli.options.stable;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.MINIMUM_TRIE_LOG_RETENTION_LIMIT;
|
||||
|
||||
import org.hyperledger.besu.cli.options.AbstractCLIOptionsTest;
|
||||
import org.hyperledger.besu.cli.options.storage.DataStorageOptions;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutablePathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -35,7 +35,7 @@ public class DataStorageOptionsTest
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getTrieLogPruningWindowSize())
|
||||
.isEqualTo(600),
|
||||
"--bonsai-limit-trie-logs-enabled",
|
||||
@@ -49,7 +49,7 @@ public class DataStorageOptionsTest
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getTrieLogPruningWindowSize())
|
||||
.isEqualTo(600),
|
||||
"--Xbonsai-limit-trie-logs-enabled",
|
||||
@@ -63,14 +63,14 @@ public class DataStorageOptionsTest
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getLimitTrieLogsEnabled())
|
||||
.isEqualTo(false),
|
||||
"--bonsai-limit-trie-logs-enabled=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffbasedTrieLogPruningWindowSizeShouldBePositive() {
|
||||
public void pathbasedTrieLogPruningWindowSizeShouldBePositive() {
|
||||
internalTestFailure(
|
||||
"--bonsai-trie-logs-pruning-window-size=0 must be greater than 0",
|
||||
"--bonsai-limit-trie-logs-enabled",
|
||||
@@ -79,7 +79,7 @@ public class DataStorageOptionsTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffbasedTrieLogPruningWindowSizeShouldBeAboveRetentionLimit() {
|
||||
public void pathbasedTrieLogPruningWindowSizeShouldBeAboveRetentionLimit() {
|
||||
internalTestFailure(
|
||||
"--bonsai-trie-logs-pruning-window-size=512 must be greater than --bonsai-historical-block-limit=512",
|
||||
"--bonsai-limit-trie-logs-enabled",
|
||||
@@ -93,7 +93,7 @@ public class DataStorageOptionsTest
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getMaxLayersToLoad())
|
||||
.isEqualTo(MINIMUM_TRIE_LOG_RETENTION_LIMIT + 1),
|
||||
"--bonsai-limit-trie-logs-enabled",
|
||||
@@ -107,7 +107,7 @@ public class DataStorageOptionsTest
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getMaxLayersToLoad())
|
||||
.isEqualTo(MINIMUM_TRIE_LOG_RETENTION_LIMIT),
|
||||
"--bonsai-limit-trie-logs-enabled",
|
||||
@@ -125,12 +125,12 @@ public class DataStorageOptionsTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffbasedCodeUsingCodeHashEnabledCanBeEnabled() {
|
||||
public void pathbasedCodeUsingCodeHashEnabledCanBeEnabled() {
|
||||
internalTestSuccess(
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getUnstable()
|
||||
.getCodeStoredByCodeHashEnabled())
|
||||
.isEqualTo(true),
|
||||
@@ -139,12 +139,12 @@ public class DataStorageOptionsTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffbasedCodeUsingCodeHashEnabledCanBeDisabled() {
|
||||
public void pathbasedCodeUsingCodeHashEnabledCanBeDisabled() {
|
||||
internalTestSuccess(
|
||||
dataStorageConfiguration ->
|
||||
assertThat(
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getUnstable()
|
||||
.getCodeStoredByCodeHashEnabled())
|
||||
.isEqualTo(false),
|
||||
@@ -185,8 +185,8 @@ public class DataStorageOptionsTest
|
||||
protected DataStorageConfiguration createCustomizedDomainObject() {
|
||||
return ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(DataStorageFormat.BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(513L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.trieLogPruningWindowSize(514)
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.hyperledger.besu.cli.subcommands.storage;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration.DEFAULT_TRIE_LOG_PRUNING_WINDOW_SIZE;
|
||||
import static org.hyperledger.besu.plugin.services.storage.DataStorageFormat.BONSAI;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -30,12 +30,12 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
|
||||
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
|
||||
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
|
||||
import org.hyperledger.besu.ethereum.storage.StorageProvider;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.trielog.TrieLogFactoryImpl;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogLayer;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.trielog.TrieLogFactoryImpl;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogLayer;
|
||||
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutableDiffBasedSubStorageConfiguration;
|
||||
import org.hyperledger.besu.ethereum.worldstate.ImmutablePathBasedExtraStorageConfiguration;
|
||||
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -135,8 +135,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(3L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -176,8 +176,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(2L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -199,8 +199,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(10L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -222,8 +222,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(2L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -246,8 +246,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(6L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -271,8 +271,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(3L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -303,8 +303,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(511L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
@@ -324,8 +324,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(512L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.trieLogPruningWindowSize(0)
|
||||
@@ -345,8 +345,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(512L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.trieLogPruningWindowSize(512)
|
||||
@@ -368,8 +368,8 @@ class TrieLogHelperTest {
|
||||
DataStorageConfiguration dataStorageConfiguration =
|
||||
ImmutableDataStorageConfiguration.builder()
|
||||
.dataStorageFormat(BONSAI)
|
||||
.diffBasedSubStorageConfiguration(
|
||||
ImmutableDiffBasedSubStorageConfiguration.builder()
|
||||
.pathBasedExtraStorageConfiguration(
|
||||
ImmutablePathBasedExtraStorageConfiguration.builder()
|
||||
.maxLayersToLoad(3L)
|
||||
.limitTrieLogsEnabled(true)
|
||||
.build())
|
||||
|
||||
@@ -58,9 +58,9 @@ class TrieLogSubCommandTest extends CommandTestAbstract {
|
||||
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());
|
||||
final List<DataStorageConfiguration> configs =
|
||||
dataStorageConfigurationArgumentCaptor.getAllValues();
|
||||
assertThat(configs.get(0).getDiffBasedSubStorageConfiguration().getLimitTrieLogsEnabled())
|
||||
assertThat(configs.get(0).getPathBasedExtraStorageConfiguration().getLimitTrieLogsEnabled())
|
||||
.isTrue();
|
||||
assertThat(configs.get(1).getDiffBasedSubStorageConfiguration().getLimitTrieLogsEnabled())
|
||||
assertThat(configs.get(1).getPathBasedExtraStorageConfiguration().getLimitTrieLogsEnabled())
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class TrieLogSubCommandTest extends CommandTestAbstract {
|
||||
.allMatch(
|
||||
dataStorageConfiguration ->
|
||||
dataStorageConfiguration
|
||||
.getDiffBasedSubStorageConfiguration()
|
||||
.getPathBasedExtraStorageConfiguration()
|
||||
.getLimitTrieLogsEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
|
||||
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
|
||||
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStoragePrefixedKeyBlockchainStorage;
|
||||
import org.hyperledger.besu.ethereum.storage.keyvalue.VariablesKeyValueStorage;
|
||||
import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams;
|
||||
import org.hyperledger.besu.ethereum.trie.pathbased.common.provider.WorldStateQueryParams;
|
||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
|
||||
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
|
||||
import org.hyperledger.besu.plugin.data.AddedBlockContext;
|
||||
|
||||
Reference in New Issue
Block a user