Skip to content

Commit

Permalink
Upgrade spotless to 1.22.0 (hyperledger#6898)
Browse files Browse the repository at this point in the history
Upgrade spotless to 1.22.0 and reformat.
This is required for Java21 support.

Signed-off-by: Danno Ferrin <[email protected]>
Co-authored-by: Danno Ferrin <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2024
1 parent 3c32d03 commit 001080a
Show file tree
Hide file tree
Showing 109 changed files with 473 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,92 @@ public interface DefaultCommandValues {

/** The constant MANDATORY_PATH_FORMAT_HELP. */
String MANDATORY_PATH_FORMAT_HELP = "<PATH>";

/** The constant MANDATORY_FILE_FORMAT_HELP. */
String MANDATORY_FILE_FORMAT_HELP = "<FILE>";

/** The constant MANDATORY_DIRECTORY_FORMAT_HELP. */
String MANDATORY_DIRECTORY_FORMAT_HELP = "<DIRECTORY>";

/** The constant BESU_HOME_PROPERTY_NAME. */
String BESU_HOME_PROPERTY_NAME = "besu.home";

/** The constant DEFAULT_DATA_DIR_PATH. */
String DEFAULT_DATA_DIR_PATH = "./build/data";

/** The constant MANDATORY_INTEGER_FORMAT_HELP. */
String MANDATORY_INTEGER_FORMAT_HELP = "<INTEGER>";

/** The constant MANDATORY_DOUBLE_FORMAT_HELP. */
String MANDATORY_DOUBLE_FORMAT_HELP = "<DOUBLE>";

/** The constant MANDATORY_LONG_FORMAT_HELP. */
String MANDATORY_LONG_FORMAT_HELP = "<LONG>";

/** The constant MANDATORY_MODE_FORMAT_HELP. */
String MANDATORY_MODE_FORMAT_HELP = "<MODE>";

/** The constant MANDATORY_NETWORK_FORMAT_HELP. */
String MANDATORY_NETWORK_FORMAT_HELP = "<NETWORK>";

/** The constant PROFILE_OPTION_NAME. */
String PROFILE_OPTION_NAME = "--profile";

/** The constant PROFILE_FORMAT_HELP. */
String PROFILE_FORMAT_HELP = "<PROFILE>";

/** The constant MANDATORY_NODE_ID_FORMAT_HELP. */
String MANDATORY_NODE_ID_FORMAT_HELP = "<NODEID>";

/** The constant PERMISSIONING_CONFIG_LOCATION. */
String PERMISSIONING_CONFIG_LOCATION = "permissions_config.toml";

/** The constant MANDATORY_HOST_FORMAT_HELP. */
String MANDATORY_HOST_FORMAT_HELP = "<HOST>";

/** The constant MANDATORY_PORT_FORMAT_HELP. */
String MANDATORY_PORT_FORMAT_HELP = "<PORT>";

/** The constant DEFAULT_NAT_METHOD. */
NatMethod DEFAULT_NAT_METHOD = NatMethod.AUTO;

/** The constant DEFAULT_JWT_ALGORITHM. */
JwtAlgorithm DEFAULT_JWT_ALGORITHM = JwtAlgorithm.RS256;

/** The constant SYNC_MIN_PEER_COUNT. */
int SYNC_MIN_PEER_COUNT = 5;

/** The constant DEFAULT_MAX_PEERS. */
int DEFAULT_MAX_PEERS = 25;

/** The constant DEFAULT_HTTP_MAX_CONNECTIONS. */
int DEFAULT_HTTP_MAX_CONNECTIONS = 80;

/** The constant DEFAULT_HTTP_MAX_BATCH_SIZE. */
int DEFAULT_HTTP_MAX_BATCH_SIZE = 1024;

/** The constant DEFAULT_MAX_REQUEST_CONTENT_LENGTH. */
long DEFAULT_MAX_REQUEST_CONTENT_LENGTH = 5 * 1024 * 1024; // 5MB

/** The constant DEFAULT_WS_MAX_CONNECTIONS. */
int DEFAULT_WS_MAX_CONNECTIONS = 80;

/** The constant DEFAULT_WS_MAX_FRAME_SIZE. */
int DEFAULT_WS_MAX_FRAME_SIZE = 1024 * 1024;

/** The constant DEFAULT_FRACTION_REMOTE_WIRE_CONNECTIONS_ALLOWED. */
float DEFAULT_FRACTION_REMOTE_WIRE_CONNECTIONS_ALLOWED =
RlpxConfiguration.DEFAULT_FRACTION_REMOTE_CONNECTIONS_ALLOWED;

/** The constant DEFAULT_KEY_VALUE_STORAGE_NAME. */
String DEFAULT_KEY_VALUE_STORAGE_NAME = "rocksdb";

/** The constant DEFAULT_SECURITY_MODULE. */
String DEFAULT_SECURITY_MODULE = "localfile";

/** The constant DEFAULT_KEYSTORE_TYPE. */
String DEFAULT_KEYSTORE_TYPE = "JKS";

/** The Default tls protocols. */
List<String> DEFAULT_TLS_PROTOCOLS = List.of("TLSv1.3", "TLSv1.2");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
/** The Transaction pool Cli stable options. */
public class TransactionPoolOptions implements CLIOptions<TransactionPoolConfiguration> {
private static final String TX_POOL_IMPLEMENTATION = "--tx-pool";

/** Use TX_POOL_NO_LOCAL_PRIORITY instead */
@Deprecated(forRemoval = true)
private static final String TX_POOL_DISABLE_LOCALS = "--tx-pool-disable-locals";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static class Unstable {
"Enables code storage using code hash instead of by account hash. (default: ${DEFAULT-VALUE})")
private boolean bonsaiCodeUsingCodeHashEnabled = DEFAULT_BONSAI_CODE_USING_CODE_HASH_ENABLED;
}

/**
* Create data storage options.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static LoggingLevelOption create() {

private static final Set<String> ACCEPTED_VALUES =
Set.of("OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE", "ALL");

/** The Picocli CommandSpec. Visible for testing. Injected by Picocli framework at runtime. */
@Spec CommandSpec spec;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public class ChainPruningOptions implements CLIOptions<ChainPrunerConfiguration>
private static final String CHAIN_PRUNING_BLOCKS_RETAINED_FLAG =
"--Xchain-pruning-blocks-retained";
private static final String CHAIN_PRUNING_FREQUENCY_FLAG = "--Xchain-pruning-frequency";

/** The constant DEFAULT_CHAIN_DATA_PRUNING_MIN_BLOCKS_RETAINED. */
public static final long DEFAULT_CHAIN_DATA_PRUNING_MIN_BLOCKS_RETAINED = 7200;

/** The constant DEFAULT_CHAIN_DATA_PRUNING_FREQUENCY. */
public static final int DEFAULT_CHAIN_DATA_PRUNING_FREQUENCY = 256;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class NetworkingOptions implements CLIOptions<NetworkingConfiguration> {
"--Xp2p-check-maintained-connections-frequency";
private final String DNS_DISCOVERY_SERVER_OVERRIDE_FLAG = "--Xp2p-dns-discovery-server";
private final String DISCOVERY_PROTOCOL_V5_ENABLED = "--Xv5-discovery-enabled";

/** The constant FILTER_ON_ENR_FORK_ID. */
public static final String FILTER_ON_ENR_FORK_ID = "--filter-on-enr-fork-id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class OperatorSubCommand implements Runnable {

/** The constant COMMAND_NAME. */
public static final String COMMAND_NAME = "operator";

/** The constant GENERATE_BLOCKCHAIN_CONFIG_SUBCOMMAND_NAME. */
public static final String GENERATE_BLOCKCHAIN_CONFIG_SUBCOMMAND_NAME =
"generate-blockchain-config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ public class CommandLineUtils {
/** The constant DEPENDENCY_WARNING_MSG. */
public static final String DEPENDENCY_WARNING_MSG =
"{} has been ignored because {} was not defined on the command line.";

/** The constant MULTI_DEPENDENCY_WARNING_MSG. */
public static final String MULTI_DEPENDENCY_WARNING_MSG =
"{} ignored because none of {} was defined.";

/** The constant DEPRECATION_WARNING_MSG. */
public static final String DEPRECATION_WARNING_MSG = "{} has been deprecated, use {} instead.";

/** The constant DEPRECATED_AND_USELESS_WARNING_MSG. */
public static final String DEPRECATED_AND_USELESS_WARNING_MSG =
"{} has been deprecated and is now useless, remove it.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class BesuController implements java.io.Closeable {

/** The constant DATABASE_PATH. */
public static final String DATABASE_PATH = "database";

/** The constant CACHE_PATH. */
public static final String CACHE_PATH = "caches";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,56 +129,78 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides

/** The Sync config. */
protected SynchronizerConfiguration syncConfig;

/** The Ethereum wire protocol configuration. */
protected EthProtocolConfiguration ethereumWireProtocolConfiguration;

/** The Transaction pool configuration. */
protected TransactionPoolConfiguration transactionPoolConfiguration;

/** The Network id. */
protected BigInteger networkId;

/** The Mining parameters. */
protected MiningParameters miningParameters;

/** The Metrics system. */
protected ObservableMetricsSystem metricsSystem;

/** The Privacy parameters. */
protected PrivacyParameters privacyParameters;

/** The Pki block creation configuration. */
protected Optional<PkiBlockCreationConfiguration> pkiBlockCreationConfiguration =
Optional.empty();

/** The Data directory. */
protected Path dataDirectory;

/** The Clock. */
protected Clock clock;

/** The Node key. */
protected NodeKey nodeKey;

/** The Is revert reason enabled. */
protected boolean isRevertReasonEnabled;

/** The Gas limit calculator. */
GasLimitCalculator gasLimitCalculator;

/** The Storage provider. */
protected StorageProvider storageProvider;

/** The Required blocks. */
protected Map<Long, Hash> requiredBlocks = Collections.emptyMap();

/** The Reorg logging threshold. */
protected long reorgLoggingThreshold;

/** The Data storage configuration. */
protected DataStorageConfiguration dataStorageConfiguration =
DataStorageConfiguration.DEFAULT_CONFIG;

/** The Message permissioning providers. */
protected List<NodeMessagePermissioningProvider> messagePermissioningProviders =
Collections.emptyList();

/** The Evm configuration. */
protected EvmConfiguration evmConfiguration;

/** The Max peers. */
protected int maxPeers;

/** Manages a cache of bad blocks globally */
protected final BadBlockManager badBlockManager = new BadBlockManager();

private int maxRemotelyInitiatedPeers;

/** The Chain pruner configuration. */
protected ChainPrunerConfiguration chainPrunerConfiguration = ChainPrunerConfiguration.DEFAULT;

private NetworkingConfiguration networkingConfiguration;
private Boolean randomPeerPriority;

/** the Dagger configured context that can provide dependencies */
protected Optional<BesuComponent> besuComponent = Optional.empty();

Expand Down Expand Up @@ -1022,8 +1044,9 @@ yield new BonsaiWorldStateProvider(
yield new ForestWorldStateArchive(
worldStateStorageCoordinator, preimageStorage, evmConfiguration);
}
default -> throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
default ->
throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ protected void verifyOptionsConstraintLoggerCall(

assertThat(stringArgumentCaptor.getAllValues().get(2)).isEqualTo(mainOption);
}

/**
* Check logger calls
*
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ allprojects {
target 'src/**/*.java'
targetExclude '**/src/reference-test/**', '**/src/main/generated/**', '**/src/test/generated/**', '**/src/jmh/generated/**'
removeUnusedImports()
googleJavaFormat('1.15.0')
googleJavaFormat('1.22.0')
importOrder 'org.hyperledger', 'java', ''
trimTrailingWhitespace()
endWithNewline()
Expand Down
4 changes: 4 additions & 0 deletions config/src/main/java/org/hyperledger/besu/config/BftFork.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ public class BftFork implements Fork {

/** The constant FORK_BLOCK_KEY. */
public static final String FORK_BLOCK_KEY = "block";

/** The constant VALIDATORS_KEY. */
public static final String VALIDATORS_KEY = "validators";

/** The constant BLOCK_PERIOD_SECONDS_KEY. */
public static final String BLOCK_PERIOD_SECONDS_KEY = "blockperiodseconds";

/** The constant BLOCK_REWARD_KEY. */
public static final String BLOCK_REWARD_KEY = "blockreward";

/** The constant MINING_BENEFICIARY_KEY. */
public static final String MINING_BENEFICIARY_KEY = "miningbeneficiary";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public class JsonQbftConfigOptions extends JsonBftConfigOptions implements QbftC
/** The constant DEFAULT. */
public static final JsonQbftConfigOptions DEFAULT =
new JsonQbftConfigOptions(JsonUtil.createEmptyObjectNode());

/** The constant VALIDATOR_CONTRACT_ADDRESS. */
public static final String VALIDATOR_CONTRACT_ADDRESS = "validatorcontractaddress";

/** The constant START_BLOCK. */
public static final String START_BLOCK = "startblock";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum VALIDATOR_SELECTION_MODE {

/** The constant VALIDATOR_SELECTION_MODE_KEY. */
public static final String VALIDATOR_SELECTION_MODE_KEY = "validatorselectionmode";

/** The constant VALIDATOR_CONTRACT_ADDRESS_KEY. */
public static final String VALIDATOR_CONTRACT_ADDRESS_KEY = "validatorcontractaddress";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class CliqueBlockInterface implements BlockInterface {

/** The constant ADD_NONCE. */
public static final long ADD_NONCE = 0xFFFFFFFFFFFFFFFFL;

/** The constant DROP_NONCE. */
public static final long DROP_NONCE = 0x0L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*/
public class CliqueExtraData implements ParsedExtraData {
private static final Logger LOG = LoggerFactory.getLogger(CliqueExtraData.class);

/** The constant EXTRA_VANITY_LENGTH. */
public static final int EXTRA_VANITY_LENGTH = 32;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Vote {

/** The constant ADD_BYTE_VALUE. */
public static final byte ADD_BYTE_VALUE = (byte) 0xFF;

/** The constant DROP_BYTE_VALUE. */
public static final byte DROP_BYTE_VALUE = (byte) 0x0L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@
public class BftBlockCreatorFactory<T extends BftConfigOptions> {
/** The Forks schedule. */
protected final ForksSchedule<T> forksSchedule;

/** The Mining parameters */
protected final MiningParameters miningParameters;

private final TransactionPool transactionPool;

/** The Protocol context. */
protected final ProtocolContext protocolContext;

/** The Protocol schedule. */
protected final ProtocolSchedule protocolSchedule;

/** The Bft extra data codec. */
protected final BftExtraDataCodec bftExtraDataCodec;

/** The scheduler for asynchronous block creation tasks */
protected final EthScheduler ethScheduler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private enum State {
private final BftEventHandler eventHandler;
private final BftProcessor bftProcessor;
private final BftBlockCreatorFactory<?> blockCreatorFactory;

/** The Blockchain. */
protected final Blockchain blockchain;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
public class IbftV2 {
/** The constant PROPOSAL. */
public static final int PROPOSAL = 0;

/** The constant PREPARE. */
public static final int PREPARE = 1;

/** The constant COMMIT. */
public static final int COMMIT = 2;

/** The constant ROUND_CHANGE. */
public static final int ROUND_CHANGE = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class IbftSubProtocol implements SubProtocol {

/** The constant NAME. */
public static String NAME = "IBF";

/** The constant IBFV1. */
public static final Capability IBFV1 = Capability.create(NAME, 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class IbftRound {
private final Subscribers<MinedBlockObserver> observers;
private final RoundState roundState;
private final BlockCreator blockCreator;

/** The protocol context. */
protected final ProtocolContext protocolContext;

Expand Down
Loading

0 comments on commit 001080a

Please sign in to comment.