Upgrade spotless to 1.22.0 (#6898)

Upgrade spotless to 1.22.0 and reformat.
This is required for Java21 support.

Signed-off-by: Danno Ferrin <danno@numisight.com>
Co-authored-by: Danno Ferrin <danno@numisight.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
Danno Ferrin
2024-04-08 22:12:56 -06:00
committed by GitHub
parent 3c32d03e8e
commit 001080a72b
109 changed files with 473 additions and 160 deletions

View File

@@ -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");

View File

@@ -44,6 +44,7 @@ import picocli.CommandLine;
/** 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";

View File

@@ -103,6 +103,7 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
"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.
*

View File

@@ -35,6 +35,7 @@ public class LoggingLevelOption {
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;

View File

@@ -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;

View File

@@ -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";

View File

@@ -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";

View File

@@ -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.";

View File

@@ -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";

View File

@@ -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();
@@ -1022,8 +1044,9 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
yield new ForestWorldStateArchive(
worldStateStorageCoordinator, preimageStorage, evmConfiguration);
}
default -> throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
default ->
throw new IllegalStateException(
"Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
};
}

View File

@@ -747,6 +747,7 @@ public abstract class CommandTestAbstract {
assertThat(stringArgumentCaptor.getAllValues().get(2)).isEqualTo(mainOption);
}
/**
* Check logger calls
*

View File

@@ -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()

View File

@@ -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";

View File

@@ -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";

View File

@@ -34,6 +34,7 @@ public class QbftFork extends BftFork {
/** 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";

View File

@@ -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;

View File

@@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory;
*/
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;

View File

@@ -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;

View File

@@ -52,16 +52,21 @@ import org.apache.tuweni.bytes.Bytes;
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;

View File

@@ -56,6 +56,7 @@ public class BftMiningCoordinator implements MiningCoordinator, BlockAddedObserv
private final BftEventHandler eventHandler;
private final BftProcessor bftProcessor;
private final BftBlockCreatorFactory<?> blockCreatorFactory;
/** The Blockchain. */
protected final Blockchain blockchain;

View File

@@ -18,10 +18,13 @@ package org.hyperledger.besu.consensus.ibft.messagedata;
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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
/** The Post merge context. */
public class PostMergeContext implements MergeContext {
private static final Logger LOG = LoggerFactory.getLogger(PostMergeContext.class);
/** The Max blocks in progress. */
static final int MAX_BLOCKS_IN_PROGRESS = 12;

View File

@@ -28,6 +28,7 @@ import java.util.Optional;
public class TransitionContext implements MergeContext {
/** The Pre merge context. */
final ConsensusContext preMergeContext;
/** The Post merge context. */
final MergeContext postMergeContext;

View File

@@ -69,6 +69,7 @@ import org.slf4j.LoggerFactory;
/** The Merge coordinator. */
public class MergeCoordinator implements MergeMiningCoordinator, BadChainListener {
private static final Logger LOG = LoggerFactory.getLogger(MergeCoordinator.class);
/**
* On PoS you do not need to compete with other nodes for block production, since you have an
* allocated slot for that, so in this case make sense to always try to fill the block, if there
@@ -79,18 +80,25 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
private static final double TRY_FILL_BLOCK = 1.0;
private static final long DEFAULT_TARGET_GAS_LIMIT = 30000000L;
/** The Mining parameters. */
protected final MiningParameters miningParameters;
/** The Merge block creator factory. */
protected final MergeBlockCreatorFactory mergeBlockCreatorFactory;
/** The Merge context. */
protected final MergeContext mergeContext;
/** The Protocol context. */
protected final ProtocolContext protocolContext;
/** The Block builder executor. */
protected final EthScheduler ethScheduler;
/** The Backward sync context. */
protected final BackwardSyncContext backwardSyncContext;
/** The Protocol schedule. */
protected final ProtocolSchedule protocolSchedule;
@@ -866,6 +874,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
private static class BlockCreationTask {
/** The Block creator. */
final MergeBlockCreator blockCreator;
/** The Cancelled. */
final AtomicBoolean cancelled;

View File

@@ -18,10 +18,13 @@ package org.hyperledger.besu.consensus.qbft.messagedata;
public class QbftV1 {
/** The constant PROPOSAL. */
public static final int PROPOSAL = 0x12;
/** The constant PREPARE. */
public static final int PREPARE = 0x13;
/** The constant COMMIT. */
public static final int COMMIT = 0x14;
/** The constant ROUND_CHANGE. */
public static final int ROUND_CHANGE = 0x15;

View File

@@ -23,6 +23,7 @@ public class Istanbul100SubProtocol implements SubProtocol {
/** The constant NAME. */
public static String NAME = "istanbul";
/** The constant ISTANBUL_100. */
public static final Capability ISTANBUL_100 = Capability.create(NAME, 100);

View File

@@ -60,18 +60,23 @@ public class QbftRound {
private static final Logger LOG = LoggerFactory.getLogger(QbftRound.class);
private final Subscribers<MinedBlockObserver> observers;
/** The Round state. */
protected final RoundState roundState;
/** The Block creator. */
protected final BlockCreator blockCreator;
/** The Protocol context. */
protected final ProtocolContext protocolContext;
/** The Protocol schedule. */
protected final ProtocolSchedule protocolSchedule;
private final NodeKey nodeKey;
private final MessageFactory messageFactory; // used only to create stored local msgs
private final QbftMessageTransmitter transmitter;
/** The Bft extra data codec. */
protected final BftExtraDataCodec bftExtraDataCodec;

View File

@@ -39,6 +39,7 @@ import org.web3j.abi.datatypes.Type;
public class ValidatorContractController {
/** The constant GET_VALIDATORS. */
public static final String GET_VALIDATORS = "getValidators";
/** The constant CONTRACT_ERROR_MSG. */
public static final String CONTRACT_ERROR_MSG = "Failed validator smart contract call";

View File

@@ -50,11 +50,13 @@ public abstract class AbstractSECP256 implements SignatureAlgorithm {
/** The Curve. */
protected final ECDomainParameters curve;
/** The Half curve order. */
protected final BigInteger halfCurveOrder;
/** The Key pair generator. */
protected final KeyPairGenerator keyPairGenerator;
/** The Curve order. */
protected final BigInteger curveOrder;

View File

@@ -30,10 +30,13 @@ public class MessageDigestFactory {
/** Keccak-256 */
public static final String KECCAK256_ALG = "KECCAK-256";
/** SHA-256 */
public static final String SHA256_ALG = "SHA-256";
/** RipeMD-160 */
public static final String RIPEMD160_ALG = "RIPEMD160";
/** Blake2b F Function */
public static final String BLAKE2BF_ALG = "BLAKE2BF";

View File

@@ -26,6 +26,7 @@ public class SECPPrivateKey implements java.security.PrivateKey {
/** Encoded Bytes */
private final Bytes32 encoded;
/** Algorithm */
private final String algorithm;

View File

@@ -34,6 +34,7 @@ public class SECPPublicKey implements java.security.PublicKey {
/** Encoded Bytes */
private final Bytes encoded;
/** Algorithm */
private final String algorithm;

View File

@@ -31,6 +31,7 @@ public class SECPSignature {
/** The constant BYTES_REQUIRED. */
public static final int BYTES_REQUIRED = 65;
/**
* The recovery id to reconstruct the public key used to create the signature.
*

View File

@@ -32,8 +32,10 @@ public abstract class AbstractFqp<T extends AbstractFqp> implements FieldElement
/** The Degree. */
protected final int degree;
/** The Modulus coefficients. */
protected final Fq[] modulusCoefficients;
/** The Coefficients. */
protected final Fq[] coefficients;

View File

@@ -43,40 +43,58 @@ public class Address extends DelegatingBytes {
/** The constant SHA256. */
public static final Address SHA256 = Address.precompiled(0x02);
/** The constant RIPEMD160. */
public static final Address RIPEMD160 = Address.precompiled(0x03);
/** The constant ID. */
public static final Address ID = Address.precompiled(0x04);
/** The constant MODEXP. */
public static final Address MODEXP = Address.precompiled(0x05);
/** The constant ALTBN128_ADD. */
public static final Address ALTBN128_ADD = Address.precompiled(0x06);
/** The constant ALTBN128_MUL. */
public static final Address ALTBN128_MUL = Address.precompiled(0x07);
/** The constant ALTBN128_PAIRING. */
public static final Address ALTBN128_PAIRING = Address.precompiled(0x08);
/** The constant BLAKE2B_F_COMPRESSION. */
public static final Address BLAKE2B_F_COMPRESSION = Address.precompiled(0x09);
/** The constant KZG_POINT_EVAL aka POINT_EVALUATION_PRECOMPILE_ADDRESS. */
public static final Address KZG_POINT_EVAL = Address.precompiled(0xA);
/** The constant BLS12_G1ADD. */
public static final Address BLS12_G1ADD = Address.precompiled(0xB);
/** The constant BLS12_G1MUL. */
public static final Address BLS12_G1MUL = Address.precompiled(0xC);
/** The constant BLS12_G1MULTIEXP. */
public static final Address BLS12_G1MULTIEXP = Address.precompiled(0xD);
/** The constant BLS12_G2ADD. */
public static final Address BLS12_G2ADD = Address.precompiled(0xE);
/** The constant BLS12_G2MUL. */
public static final Address BLS12_G2MUL = Address.precompiled(0xF);
/** The constant BLS12_G2MULTIEXP. */
public static final Address BLS12_G2MULTIEXP = Address.precompiled(0x10);
/** The constant BLS12_PAIRING. */
public static final Address BLS12_PAIRING = Address.precompiled(0x11);
/** The constant BLS12_MAP_FP_TO_G1. */
public static final Address BLS12_MAP_FP_TO_G1 = Address.precompiled(0x12);
/** The constant BLS12_MAP_FP2_TO_G2. */
public static final Address BLS12_MAP_FP2_TO_G2 = Address.precompiled(0x13);
/** The constant ZERO. */
public static final Address ZERO = Address.fromHexString("0x0");

View File

@@ -195,8 +195,10 @@ public final class Wei extends BaseUInt256Value<Wei> implements Quantity {
/** The Pow. */
final int pow;
/** The Divisor. */
final double divisor;
/** The Decimals. */
final int decimals;

View File

@@ -22,12 +22,16 @@ public class PrivacyGroup implements Serializable {
/** Private Group Id */
private String privacyGroupId;
/** Name */
private String name;
/** Description */
private String description;
/** Type */
private Type type;
/** Members */
private List<String> members;

View File

@@ -39,6 +39,7 @@ public class TransactionSelectionResults {
private final Map<TransactionType, List<Transaction>> transactionsByType =
new EnumMap<>(TransactionType.class);
private final List<TransactionReceipt> receipts = Lists.newArrayList();
/**
* Access to this field needs to be guarded, since it is possible to read it while another
* processing thread is writing, when the selection time is over.

View File

@@ -26,6 +26,7 @@ public class BlockBody implements org.hyperledger.besu.plugin.data.BlockBody {
private static final BlockBody EMPTY =
new BlockBody(Collections.emptyList(), Collections.emptyList());
/**
* Adding a new field with a corresponding root hash in the block header will require a change in
* {@link org.hyperledger.besu.ethereum.eth.manager.task.GetBodiesFromPeerTask.BodyIdentifier}

View File

@@ -703,40 +703,43 @@ public class Transaction
final Bytes preimage =
switch (transactionType) {
case FRONTIER -> frontierPreimage(nonce, gasPrice, gasLimit, to, value, payload, chainId);
case EIP1559 -> eip1559Preimage(
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
payload,
chainId,
accessList);
case BLOB -> blobPreimage(
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
maxFeePerBlobGas,
gasLimit,
to,
value,
payload,
chainId,
accessList,
versionedHashes);
case ACCESS_LIST -> accessListPreimage(
nonce,
gasPrice,
gasLimit,
to,
value,
payload,
accessList.orElseThrow(
() ->
new IllegalStateException(
"Developer error: the transaction should be guaranteed to have an access list here")),
chainId);
case EIP1559 ->
eip1559Preimage(
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
payload,
chainId,
accessList);
case BLOB ->
blobPreimage(
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
maxFeePerBlobGas,
gasLimit,
to,
value,
payload,
chainId,
accessList,
versionedHashes);
case ACCESS_LIST ->
accessListPreimage(
nonce,
gasPrice,
gasLimit,
to,
value,
payload,
accessList.orElseThrow(
() ->
new IllegalStateException(
"Developer error: the transaction should be guaranteed to have an access list here")),
chainId);
};
return keccak256(preimage);
}

View File

@@ -43,20 +43,22 @@ public class BlockHeaderValidator {
final HeaderValidationMode mode) {
return switch (mode) {
case NONE -> true;
case LIGHT_DETACHED_ONLY -> applyRules(
header,
parent,
protocolContext,
rule -> rule.includeInLightValidation() && rule.isDetachedSupported());
case LIGHT_SKIP_DETACHED -> applyRules(
header,
parent,
protocolContext,
rule -> rule.includeInLightValidation() && !rule.isDetachedSupported());
case LIGHT_DETACHED_ONLY ->
applyRules(
header,
parent,
protocolContext,
rule -> rule.includeInLightValidation() && rule.isDetachedSupported());
case LIGHT_SKIP_DETACHED ->
applyRules(
header,
parent,
protocolContext,
rule -> rule.includeInLightValidation() && !rule.isDetachedSupported());
case LIGHT -> applyRules(header, parent, protocolContext, Rule::includeInLightValidation);
case DETACHED_ONLY -> applyRules(header, parent, protocolContext, Rule::isDetachedSupported);
case SKIP_DETACHED -> applyRules(
header, parent, protocolContext, rule -> !rule.isDetachedSupported());
case SKIP_DETACHED ->
applyRules(header, parent, protocolContext, rule -> !rule.isDetachedSupported());
case FULL -> applyRules(header, parent, protocolContext, rule -> true);
};
}

View File

@@ -396,15 +396,18 @@ public class ProtocolScheduleBuilder {
final Function<ProtocolSpecBuilder, ProtocolSpecBuilder> modifier) {
switch (milestoneType) {
case BLOCK_NUMBER -> protocolSchedule.putBlockNumberMilestone(
blockNumberOrTimestamp, getProtocolSpec(protocolSchedule, definition, modifier));
case TIMESTAMP -> protocolSchedule.putTimestampMilestone(
blockNumberOrTimestamp, getProtocolSpec(protocolSchedule, definition, modifier));
default -> throw new IllegalStateException(
"Unexpected milestoneType: "
+ milestoneType
+ " for milestone: "
+ blockNumberOrTimestamp);
case BLOCK_NUMBER ->
protocolSchedule.putBlockNumberMilestone(
blockNumberOrTimestamp, getProtocolSpec(protocolSchedule, definition, modifier));
case TIMESTAMP ->
protocolSchedule.putTimestampMilestone(
blockNumberOrTimestamp, getProtocolSpec(protocolSchedule, definition, modifier));
default ->
throw new IllegalStateException(
"Unexpected milestoneType: "
+ milestoneType
+ " for milestone: "
+ blockNumberOrTimestamp);
}
}

View File

@@ -80,6 +80,7 @@ public class ProtocolSpec {
private final boolean isPoS;
private final boolean isReplayProtectionSupported;
/**
* Creates a new protocol specification instance.
*

View File

@@ -81,6 +81,7 @@ public class BonsaiWorldStateProvider extends DiffBasedWorldStateProvider {
private BonsaiWorldStateKeyValueStorage getWorldStateKeyValueStorage() {
return (BonsaiWorldStateKeyValueStorage) worldStateKeyValueStorage;
}
/**
* Prepares the state healing process for a given address and location. It prepares the state
* healing, including retrieving data from storage, identifying invalid slots or nodes, removing

View File

@@ -216,6 +216,7 @@ public class ForestMutableWorldState implements MutableWorldState {
return Optional.ofNullable(newAccountKeyPreimages.get(trieKey))
.or(() -> preimageStorage.getAccountTrieKeyPreimage(trieKey));
}
// An immutable class that represents an individual account as stored in
// the world state's underlying merkle patricia trie.
protected class WorldStateAccount implements Account {

View File

@@ -67,6 +67,7 @@ public class EthProtocolVersion {
EthPV63.NODE_DATA,
EthPV63.GET_RECEIPTS,
EthPV63.RECEIPTS);
/**
* eth/65 (EIP-2464, January 2020)
*

View File

@@ -50,6 +50,7 @@ public class TransactionAnnouncementDecoder {
return TransactionAnnouncementDecoder::decodeForEth66;
}
}
/**
* Decode the list of transactions in the NewPooledTransactionHashesMessage
*

View File

@@ -30,6 +30,7 @@ public final class StorageExceptionManager {
private static final long ERROR_THRESHOLD = 1000;
private static long retryableErrorCounter;
/**
* Determines if an operation can be retried based on the error received. This method checks if
* the cause of the StorageException is a RocksDBException. If it is, it retrieves the status code

View File

@@ -517,6 +517,7 @@ public abstract class AbstractPendingTransactionsSorter implements PendingTransa
return sb.toString();
}
}
/**
* @param transaction to restore blobs onto
* @return an optional copy of the supplied transaction, but with the BlobsWithCommitments

View File

@@ -714,6 +714,7 @@ public class PeerDiscoveryController {
private class PeerInteractionState implements Predicate<Packet> {
private static final int MAX_RETRIES = 5;
/**
* The action that led to the peer being in this state (e.g. sending a PING or NEIGHBORS
* message), in case it needs to be retried.
@@ -721,12 +722,15 @@ public class PeerDiscoveryController {
private final Consumer<PeerInteractionState> action;
private final Bytes peerId;
/** The expected type of the message that will transition the peer out of this state. */
private final PacketType expectedType;
private final Counter retryCounter;
/** A custom filter to accept transitions out of this state. */
private Predicate<Packet> filter;
/** Timers associated with this entry. */
private OptionalLong timerId = OptionalLong.empty();

View File

@@ -88,6 +88,7 @@ public interface P2PNetwork extends Closeable {
void subscribeConnect(final ConnectCallback callback);
void subscribeConnectRequest(final ShouldConnectCallback callback);
/**
* Subscribe a {@link Consumer} to all incoming new Peer disconnect events.
*

View File

@@ -67,6 +67,7 @@ public interface ProtocolManager extends AutoCloseable {
* @return true, if the ProtocolManager wants to connect to the peer, false otherwise
*/
boolean shouldConnect(Peer peer, final boolean incoming);
/**
* Handles peer disconnects.
*

View File

@@ -80,6 +80,7 @@ public interface RLPOutput {
default void writeUInt64Scalar(final UInt64Value<?> v) {
writeBytes(v.toBytes().trimLeadingZeros());
}
/**
* Writes a scalar (encoded with no leading zeroes).
*

View File

@@ -75,6 +75,7 @@ public interface MerkleTrie<K, V> {
* @param value The value to associate the key with.
*/
void putPath(K path, V value);
/**
* Updates the value mapped to the specified key, creating the mapping if one does not already
* exist.

View File

@@ -230,73 +230,77 @@ public class EVM {
case 0x56 -> JumpOperation.staticOperation(frame);
case 0x57 -> JumpiOperation.staticOperation(frame);
case 0x5b -> JumpDestOperation.JUMPDEST_SUCCESS;
case 0x5f -> enableShanghai
? Push0Operation.staticOperation(frame)
: InvalidOperation.INVALID_RESULT;
case 0x5f ->
enableShanghai
? Push0Operation.staticOperation(frame)
: InvalidOperation.INVALID_RESULT;
case 0x60, // PUSH1-32
0x61,
0x62,
0x63,
0x64,
0x65,
0x66,
0x67,
0x68,
0x69,
0x6a,
0x6b,
0x6c,
0x6d,
0x6e,
0x6f,
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
0x76,
0x77,
0x78,
0x79,
0x7a,
0x7b,
0x7c,
0x7d,
0x7e,
0x7f -> PushOperation.staticOperation(frame, code, pc, opcode - PUSH_BASE);
0x61,
0x62,
0x63,
0x64,
0x65,
0x66,
0x67,
0x68,
0x69,
0x6a,
0x6b,
0x6c,
0x6d,
0x6e,
0x6f,
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
0x76,
0x77,
0x78,
0x79,
0x7a,
0x7b,
0x7c,
0x7d,
0x7e,
0x7f ->
PushOperation.staticOperation(frame, code, pc, opcode - PUSH_BASE);
case 0x80, // DUP1-16
0x81,
0x82,
0x83,
0x84,
0x85,
0x86,
0x87,
0x88,
0x89,
0x8a,
0x8b,
0x8c,
0x8d,
0x8e,
0x8f -> DupOperation.staticOperation(frame, opcode - DupOperation.DUP_BASE);
0x81,
0x82,
0x83,
0x84,
0x85,
0x86,
0x87,
0x88,
0x89,
0x8a,
0x8b,
0x8c,
0x8d,
0x8e,
0x8f ->
DupOperation.staticOperation(frame, opcode - DupOperation.DUP_BASE);
case 0x90, // SWAP1-16
0x91,
0x92,
0x93,
0x94,
0x95,
0x96,
0x97,
0x98,
0x99,
0x9a,
0x9b,
0x9c,
0x9d,
0x9e,
0x9f -> SwapOperation.staticOperation(frame, opcode - SWAP_BASE);
0x91,
0x92,
0x93,
0x94,
0x95,
0x96,
0x97,
0x98,
0x99,
0x9a,
0x9b,
0x9c,
0x9d,
0x9e,
0x9f ->
SwapOperation.staticOperation(frame, opcode - SWAP_BASE);
default -> { // unoptimized operations
frame.setCurrentOperation(currentOperation);
yield currentOperation.execute(frame, this);

View File

@@ -64,11 +64,13 @@ public enum EvmSpecVersion {
/** The Spec finalized. */
final boolean specFinalized;
/** The Max eof version. */
final int maxEofVersion;
/** Public name matching execution-spec-tests name */
final String name;
/** A brief description of the state of the fork */
final String description;

View File

@@ -134,6 +134,7 @@ public class MainnetEVMs {
/** The constant SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT. */
public static final int SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT = 0x6000;
/** The constant SHANGHAI_INIT_CODE_SIZE_LIMIT. */
public static final int SHANGHAI_INIT_CODE_SIZE_LIMIT = 2 * SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT;
@@ -806,6 +807,7 @@ public class MainnetEVMs {
public static EVM cancun(final EvmConfiguration evmConfiguration) {
return cancun(DEV_NET_CHAIN_ID, evmConfiguration);
}
/**
* Cancun evm.
*
@@ -889,6 +891,7 @@ public class MainnetEVMs {
public static EVM prague(final EvmConfiguration evmConfiguration) {
return prague(DEV_NET_CHAIN_ID, evmConfiguration);
}
/**
* Prague evm.
*
@@ -956,6 +959,7 @@ public class MainnetEVMs {
public static EVM osaka(final EvmConfiguration evmConfiguration) {
return osaka(DEV_NET_CHAIN_ID, evmConfiguration);
}
/**
* Osaka evm.
*
@@ -1023,6 +1027,7 @@ public class MainnetEVMs {
public static EVM bogota(final EvmConfiguration evmConfiguration) {
return bogota(DEV_NET_CHAIN_ID, evmConfiguration);
}
/**
* Bogota evm.
*

View File

@@ -28,8 +28,10 @@ public interface Account extends AccountState {
/** The constant DEFAULT_NONCE. */
long DEFAULT_NONCE = 0L;
/** The constant MAX_NONCE. */
long MAX_NONCE = -1; // per twos compliment rules -1 will be the unsigned max number
/** The constant DEFAULT_BALANCE. */
Wei DEFAULT_BALANCE = Wei.ZERO;

View File

@@ -25,12 +25,16 @@ public final class CodeSection {
/** The length. */
final int length;
/** The Inputs. */
final int inputs;
/** The Outputs. */
final int outputs;
/** The Max stack height. */
final int maxStackHeight;
/** The byte offset from the beginning of the container that the section starts at */
final int entryPoint;

View File

@@ -25,10 +25,13 @@ public class EOFLayout {
/** The Section Terminator. */
static final int SECTION_TERMINATOR = 0x00;
/** The Section types. */
static final int SECTION_TYPES = 0x01;
/** The Section code. */
static final int SECTION_CODE = 0x02;
/** The Section data. */
static final int SECTION_DATA = 0x03;

View File

@@ -31,6 +31,7 @@ public class SimpleWorld implements WorldUpdater {
/** The Parent. */
SimpleWorld parent;
/** The Accounts. */
Map<Address, SimpleAccount> accounts = new HashMap<>();

View File

@@ -19,42 +19,57 @@ public interface ExceptionalHaltReason {
/** The constant NONE. */
ExceptionalHaltReason NONE = DefaultExceptionalHaltReason.NONE;
/** The constant INSUFFICIENT_GAS. */
ExceptionalHaltReason INSUFFICIENT_GAS = DefaultExceptionalHaltReason.INSUFFICIENT_GAS;
/** The constant INSUFFICIENT_STACK_ITEMS. */
ExceptionalHaltReason INSUFFICIENT_STACK_ITEMS =
DefaultExceptionalHaltReason.INSUFFICIENT_STACK_ITEMS;
/** The constant INVALID_JUMP_DESTINATION. */
ExceptionalHaltReason INVALID_JUMP_DESTINATION =
DefaultExceptionalHaltReason.INVALID_JUMP_DESTINATION;
/** The constant INVALID_OPERATION. */
ExceptionalHaltReason INVALID_OPERATION = DefaultExceptionalHaltReason.INVALID_OPERATION;
/** The constant INVALID_RETURN_DATA_BUFFER_ACCESS. */
ExceptionalHaltReason INVALID_RETURN_DATA_BUFFER_ACCESS =
DefaultExceptionalHaltReason.INVALID_RETURN_DATA_BUFFER_ACCESS;
/** The constant TOO_MANY_STACK_ITEMS. */
ExceptionalHaltReason TOO_MANY_STACK_ITEMS = DefaultExceptionalHaltReason.TOO_MANY_STACK_ITEMS;
/** The constant ILLEGAL_STATE_CHANGE. */
ExceptionalHaltReason ILLEGAL_STATE_CHANGE = DefaultExceptionalHaltReason.ILLEGAL_STATE_CHANGE;
/** The constant OUT_OF_BOUNDS. */
ExceptionalHaltReason OUT_OF_BOUNDS = DefaultExceptionalHaltReason.OUT_OF_BOUNDS;
/** The constant CODE_TOO_LARGE. */
ExceptionalHaltReason CODE_TOO_LARGE = DefaultExceptionalHaltReason.CODE_TOO_LARGE;
/** The constant INVALID_CODE. */
ExceptionalHaltReason INVALID_CODE = DefaultExceptionalHaltReason.INVALID_CODE;
/** The constant PRECOMPILE_ERROR. */
ExceptionalHaltReason PRECOMPILE_ERROR = DefaultExceptionalHaltReason.PRECOMPILE_ERROR;
/** The constant CODE_SECTION_MISSING. */
ExceptionalHaltReason CODE_SECTION_MISSING = DefaultExceptionalHaltReason.CODE_SECTION_MISSING;
/** The constant INCORRECT_CODE_SECTION_RETURN_OUTPUTS. */
ExceptionalHaltReason INCORRECT_CODE_SECTION_RETURN_OUTPUTS =
DefaultExceptionalHaltReason.INCORRECT_CODE_SECTION_RETURN_OUTPUTS;
/** The constant TOO_FEW_INPUTS_FOR_CODE_SECTION. */
ExceptionalHaltReason TOO_FEW_INPUTS_FOR_CODE_SECTION =
DefaultExceptionalHaltReason.TOO_FEW_INPUTS_FOR_CODE_SECTION;
/** The constant JUMPF_STACK_MISMATCH. */
ExceptionalHaltReason JUMPF_STACK_MISMATCH = DefaultExceptionalHaltReason.JUMPF_STACK_MISMATCH;
/** The constant EOF_CREATE_VERSION_INCOMPATIBLE. */
ExceptionalHaltReason EOF_CREATE_VERSION_INCOMPATIBLE =
DefaultExceptionalHaltReason.EOF_CREATE_VERSION_INCOMPATIBLE;

View File

@@ -944,6 +944,7 @@ public class MessageFrame {
public void addCreate(final Address address) {
txValues.creates().add(address);
}
/**
* Add addresses to the create set if they are not already present.
*
@@ -1118,6 +1119,7 @@ public class MessageFrame {
public int getDepth() {
return getMessageStackSize() - 1;
}
/**
* Returns the recipient that originated the message.
*

View File

@@ -28,8 +28,10 @@ public class PetersburgGasCalculator extends ConstantinopleGasCalculator {
/** Same as {#link {@link FrontierGasCalculator#STORAGE_SET_GAS_COST} */
private static final long STORAGE_SET_GAS_COST = 20_000L;
/** Same as {#link {@link FrontierGasCalculator#STORAGE_RESET_GAS_COST} */
private static final long STORAGE_RESET_GAS_COST = 5_000L;
/** Same as {#link {@link FrontierGasCalculator#STORAGE_RESET_REFUND_AMOUNT} */
private static final long STORAGE_RESET_REFUND_AMOUNT = 15_000L;

View File

@@ -1,4 +1,5 @@
package org.hyperledger.besu.evm.gascalculator;
/*
* Copyright contributors to Hyperledger Besu.
*

View File

@@ -25,8 +25,10 @@ public class ReturnStack extends FlexStack<ReturnStack.ReturnStackItem> {
/** The Code section index. */
final int codeSectionIndex;
/** The Pc. */
final int pc;
/** The Stack height. */
final int stackHeight;

View File

@@ -28,11 +28,13 @@ abstract class AbstractFixedCostOperation extends AbstractOperation {
/** The Success response. */
protected final OperationResult successResponse;
/** The Out of gas response. */
protected final OperationResult outOfGasResponse;
private final OperationResult underflowResponse;
private final OperationResult overflowResponse;
/** The Gas cost. */
protected final long gasCost;

View File

@@ -25,6 +25,7 @@ public class CallFOperation extends AbstractOperation {
/** The constant OPCODE. */
public static final int OPCODE = 0xe3;
/** The Call F success. */
static final OperationResult callfSuccess = new OperationResult(5, null);

View File

@@ -24,8 +24,10 @@ public class DupOperation extends AbstractFixedCostOperation {
/** The constant DUP_BASE. */
public static final int DUP_BASE = 0x7F;
/** The Dup success operation result. */
static final OperationResult dupSuccess = new OperationResult(3, null);
/** The Underflow response. */
protected final Operation.OperationResult underflowResponse;

View File

@@ -24,9 +24,11 @@ public class InvalidOperation extends AbstractOperation {
/** The constant OPCODE. */
public static final int OPCODE = 0xFE;
/** The constant INVALID_RESULT. */
public static final OperationResult INVALID_RESULT =
new OperationResult(0, ExceptionalHaltReason.INVALID_OPERATION);
/** The Invalid operation result. */
protected final OperationResult invalidResult;

View File

@@ -25,6 +25,7 @@ public class JumpFOperation extends AbstractOperation {
/** The constant OPCODE. */
public static final int OPCODE = 0xe5;
/** The Jump F success operation result. */
static final OperationResult jumpfSuccess = new OperationResult(3, null);

View File

@@ -25,8 +25,10 @@ public interface Operation {
class OperationResult {
/** The Gas cost. */
final long gasCost;
/** The Halt reason. */
final ExceptionalHaltReason haltReason;
/** The increment. */
final int pcIncrement;

View File

@@ -25,6 +25,7 @@ public class PushOperation extends AbstractFixedCostOperation {
/** The constant PUSH_BASE. */
public static final int PUSH_BASE = 0x5F;
/** The constant PUSH_MAX. */
public static final int PUSH_MAX = 0x7F;

View File

@@ -23,6 +23,7 @@ public class RetFOperation extends AbstractOperation {
/** The Opcode. */
public static final int OPCODE = 0xe4;
/** The Ret F success. */
static final OperationResult retfSuccess = new OperationResult(3, null);

View File

@@ -29,6 +29,7 @@ public class ReturnDataCopyOperation extends AbstractOperation {
/** The constant INVALID_RETURN_DATA_BUFFER_ACCESS. */
protected static final OperationResult INVALID_RETURN_DATA_BUFFER_ACCESS =
new OperationResult(0L, ExceptionalHaltReason.INVALID_RETURN_DATA_BUFFER_ACCESS);
/** The constant OUT_OF_BOUNDS. */
protected static final OperationResult OUT_OF_BOUNDS =
new OperationResult(0L, ExceptionalHaltReason.OUT_OF_BOUNDS);

View File

@@ -31,6 +31,7 @@ public class SStoreOperation extends AbstractOperation {
/** The constant FRONTIER_MINIMUM. */
public static final long FRONTIER_MINIMUM = 0L;
/** The constant EIP_1706_MINIMUM. */
public static final long EIP_1706_MINIMUM = 2300L;

View File

@@ -26,10 +26,12 @@ public class SwapOperation extends AbstractFixedCostOperation {
/** The constant SWAP_BASE. */
public static final int SWAP_BASE = 0x8F;
/** The Swap operation success result. */
static final OperationResult swapSuccess = new OperationResult(3, null);
private final int index;
/** The operation result due to underflow. */
protected final Operation.OperationResult underflowResponse;

View File

@@ -43,6 +43,7 @@ public class AltBN128PairingPrecompiledContract extends AbstractAltBnPrecompiled
/** The constant FALSE. */
static final Bytes FALSE =
Bytes.fromHexString("0x0000000000000000000000000000000000000000000000000000000000000000");
/** The constant TRUE. */
public static final Bytes TRUE =
Bytes.fromHexString("0x0000000000000000000000000000000000000000000000000000000000000001");

View File

@@ -36,6 +36,7 @@ public class ECRECPrecompiledContract extends AbstractPrecompiledContract {
private static final int V_BASE = 27;
final SignatureAlgorithm signatureAlgorithm;
/**
* Instantiates a new ECREC precompiled contract with the default signature algorithm.
*

View File

@@ -850,6 +850,14 @@
<sha256 value="4142a244523fa5cda9cceece41b7baaadf6f06e4fcdaf2e04783a8a5f4a324e7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.googlejavaformat" name="google-java-format" version="1.22.0">
<artifact name="google-java-format-1.22.0.jar">
<sha256 value="4f4bdba0f2a3d7e84be47683a0c2a4ba69024d29d906d09784181f68f04af792" origin="Generated by Gradle"/>
</artifact>
<artifact name="google-java-format-1.22.0.pom">
<sha256 value="857969f274d7d56f55949042b93e8392f8f2e5208446eee25a85cafc594090a5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.googlejavaformat" name="google-java-format" version="1.5">
<artifact name="google-java-format-1.5.jar">
<sha256 value="aa19ad7850fb85178aa22f2fddb163b84d6ce4d0035872f30d4408195ca1144e" origin="Generated by Gradle"/>
@@ -868,6 +876,11 @@
<sha256 value="b2ce276ca749d1af9f345f63eef2866e09b9e23f31095d17f2d11107c861cea6" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.googlejavaformat" name="google-java-format-parent" version="1.22.0">
<artifact name="google-java-format-parent-1.22.0.pom">
<sha256 value="7e4c16f4228f602003058f640a0392a35500b0e33f930a43c562153778f0b8ac" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.googlejavaformat" name="google-java-format-parent" version="1.5">
<artifact name="google-java-format-parent-1.5.pom">
<sha256 value="13aaf29158343f8b9c7dd7d3f58610290b05ad29ea69c7b9504869e47fbf6319" origin="Generated by Gradle"/>

View File

@@ -56,6 +56,7 @@ public enum BesuMetricCategory implements MetricCategory {
STRATUM("stratum");
private static final Optional<String> BESU_PREFIX = Optional.of("besu_");
/** The constant DEFAULT_METRIC_CATEGORIES. */
public static final Set<MetricCategory> DEFAULT_METRIC_CATEGORIES;

View File

@@ -23,10 +23,13 @@ public class RunnableCounter implements Counter {
/** The Backed counter. */
protected final Counter backedCounter;
/** The Task. */
protected final Runnable task;
/** The Step. */
protected final int step;
/** The Step counter. */
protected final AtomicLong stepCounter;

View File

@@ -36,31 +36,39 @@ public class NoOpMetricsSystem implements ObservableMetricsSystem {
/** The constant NO_OP_COUNTER. */
public static final Counter NO_OP_COUNTER = new NoOpCounter();
/** The constant NO_OP_GAUGE. */
public static final LabelledGauge NO_OP_GAUGE = new NoOpValueCollector();
private static final OperationTimer.TimingContext NO_OP_TIMING_CONTEXT = () -> 0;
/** The constant NO_OP_OPERATION_TIMER. */
public static final OperationTimer NO_OP_OPERATION_TIMER = () -> NO_OP_TIMING_CONTEXT;
/** The constant NO_OP_LABELLED_1_COUNTER. */
public static final LabelledMetric<Counter> NO_OP_LABELLED_1_COUNTER =
new LabelCountingNoOpMetric<>(1, NO_OP_COUNTER);
/** The constant NO_OP_LABELLED_2_COUNTER. */
public static final LabelledMetric<Counter> NO_OP_LABELLED_2_COUNTER =
new LabelCountingNoOpMetric<>(2, NO_OP_COUNTER);
/** The constant NO_OP_LABELLED_3_COUNTER. */
public static final LabelledMetric<Counter> NO_OP_LABELLED_3_COUNTER =
new LabelCountingNoOpMetric<>(3, NO_OP_COUNTER);
/** The constant NO_OP_LABELLED_1_OPERATION_TIMER. */
public static final LabelledMetric<OperationTimer> NO_OP_LABELLED_1_OPERATION_TIMER =
new LabelCountingNoOpMetric<>(1, NO_OP_OPERATION_TIMER);
/** The constant NO_OP_LABELLED_1_GAUGE. */
public static final LabelledGauge NO_OP_LABELLED_1_GAUGE =
new LabelledGaugeNoOpMetric(1, NO_OP_GAUGE);
/** The constant NO_OP_LABELLED_2_GAUGE. */
public static final LabelledGauge NO_OP_LABELLED_2_GAUGE =
new LabelledGaugeNoOpMetric(2, NO_OP_GAUGE);
/** The constant NO_OP_LABELLED_3_GAUGE. */
public static final LabelledGauge NO_OP_LABELLED_3_GAUGE =
new LabelledGaugeNoOpMetric(3, NO_OP_GAUGE);
@@ -176,6 +184,7 @@ public class NoOpMetricsSystem implements ObservableMetricsSystem {
/** The Label count. */
final int labelCount;
/** The Fake metric. */
final T fakeMetric;
@@ -203,6 +212,7 @@ public class NoOpMetricsSystem implements ObservableMetricsSystem {
public static class LabelledGaugeNoOpMetric implements LabelledGauge {
/** The Label count. */
final int labelCount;
/** The Label values cache. */
final List<String> labelValuesCache = new ArrayList<>();

View File

@@ -31,15 +31,19 @@ import com.google.common.base.MoreObjects;
/** The Metrics configuration. */
public class MetricsConfiguration {
private static final String DEFAULT_METRICS_HOST = "127.0.0.1";
/** The constant DEFAULT_METRICS_PORT. */
public static final int DEFAULT_METRICS_PORT = 9545;
private static final MetricsProtocol DEFAULT_METRICS_PROTOCOL = MetricsProtocol.PROMETHEUS;
private static final String DEFAULT_METRICS_PUSH_HOST = "127.0.0.1";
/** The constant DEFAULT_METRICS_PUSH_PORT. */
public static final int DEFAULT_METRICS_PUSH_PORT = 9001;
/** The constant DEFAULT_METRICS_TIMERS_ENABLED. */
public static final Boolean DEFAULT_METRICS_TIMERS_ENABLED = true;
/** The constant DEFAULT_METRICS_IDLE_TIMEOUT_SECONDS. */
public static final int DEFAULT_METRICS_IDLE_TIMEOUT_SECONDS = 60;

View File

@@ -35,10 +35,13 @@ public class RocksDBStats {
/** The Labels. */
static final List<String> LABELS = Collections.singletonList("quantile");
/** The Label 50. */
static final List<String> LABEL_50 = Collections.singletonList("0.5");
/** The Label 95. */
static final List<String> LABEL_95 = Collections.singletonList("0.95");
/** The Label 99. */
static final List<String> LABEL_99 = Collections.singletonList("0.99");

View File

@@ -134,8 +134,9 @@ public class CmsCreator {
case "RSA" -> {
return "SHA256WithRSAEncryption";
}
default -> throw new UnsupportedOperationException(
"Private key algorithm not supported: " + pub.getAlgorithm());
default ->
throw new UnsupportedOperationException(
"Private key algorithm not supported: " + pub.getAlgorithm());
}
}
}

View File

@@ -29,6 +29,7 @@ public class PkiKeyStoreConfiguration {
/** The constant DEFAULT_KEYSTORE_TYPE. */
public static String DEFAULT_KEYSTORE_TYPE = "PKCS12";
/** The constant DEFAULT_CERTIFICATE_ALIAS. */
public static String DEFAULT_CERTIFICATE_ALIAS = "validator";

View File

@@ -26,8 +26,10 @@ public interface KeyStoreWrapper {
/** The constant KEYSTORE_TYPE_JKS. */
String KEYSTORE_TYPE_JKS = "JKS";
/** The constant KEYSTORE_TYPE_PKCS11. */
String KEYSTORE_TYPE_PKCS11 = "PKCS11";
/** The constant KEYSTORE_TYPE_PKCS12. */
String KEYSTORE_TYPE_PKCS12 = "PKCS12";

View File

@@ -69,7 +69,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'T98TztTmKMLspdRDLKxOTH5nTxFiVijRgNN2twZu3OY='
knownHash = 'lsBecdCyK9rIi5FIjURF2uPwKzXgqHCayMcLyOOl4fE='
}
check.dependsOn('checkAPIChanges')

View File

@@ -92,33 +92,40 @@ public class TransactionSelectionResult {
/** The transaction has been selected to be included in the new block */
public static final TransactionSelectionResult SELECTED =
new TransactionSelectionResult(BaseStatus.SELECTED);
/** The transaction has not been selected since the block is full. */
public static final TransactionSelectionResult BLOCK_FULL =
new TransactionSelectionResult(BaseStatus.BLOCK_FULL);
/** There was no more time to add transaction to the block */
public static final TransactionSelectionResult BLOCK_SELECTION_TIMEOUT =
new TransactionSelectionResult(BaseStatus.BLOCK_SELECTION_TIMEOUT);
/** Transaction took too much to evaluate */
public static final TransactionSelectionResult TX_EVALUATION_TOO_LONG =
new TransactionSelectionResult(BaseStatus.TX_EVALUATION_TOO_LONG);
/**
* The transaction has not been selected since too large and the occupancy of the block is enough
* to stop the selection.
*/
public static final TransactionSelectionResult BLOCK_OCCUPANCY_ABOVE_THRESHOLD =
new TransactionSelectionResult(BaseStatus.BLOCK_OCCUPANCY_ABOVE_THRESHOLD);
/**
* The transaction has not been selected since its gas limit is greater than the block remaining
* gas, but the selection should continue.
*/
public static final TransactionSelectionResult TX_TOO_LARGE_FOR_REMAINING_GAS =
TransactionSelectionResult.invalidTransient("TX_TOO_LARGE_FOR_REMAINING_GAS");
/**
* The transaction has not been selected since its current price is below the configured min
* price, but the selection should continue.
*/
public static final TransactionSelectionResult CURRENT_TX_PRICE_BELOW_MIN =
TransactionSelectionResult.invalidTransient("CURRENT_TX_PRICE_BELOW_MIN");
/**
* The transaction has not been selected since its blob price is below the current network blob
* price, but the selection should continue.

View File

@@ -20,6 +20,7 @@ import org.hyperledger.besu.plugin.services.rpc.RpcMethodError;
public class PluginRpcEndpointException extends RuntimeException {
/** The error */
private final RpcMethodError rpcMethodError;
/** The data associated with the exception */
private final String data;

View File

@@ -127,6 +127,7 @@ public interface TrieLog {
* Optional
*/
Optional<? extends AccountValue> getPriorAccount(final Address address);
/**
* Gets the account value for a specific address, if available.
*

View File

@@ -84,6 +84,7 @@ public interface PluginTransactionSelector {
default void onTransactionSelected(
final TransactionEvaluationContext<? extends PendingTransaction> evaluationContext,
final TransactionProcessingResult processingResult) {}
/**
* Method called when a transaction is not selected to be added to a block.
*

View File

@@ -63,12 +63,14 @@ public enum BaseVersionedStorageFormat implements VersionedStorageFormat {
public static BaseVersionedStorageFormat defaultForNewDB(
final DataStorageConfiguration configuration) {
return switch (configuration.getDatabaseFormat()) {
case FOREST -> configuration.getReceiptCompactionEnabled()
? FOREST_WITH_RECEIPT_COMPACTION
: FOREST_WITH_VARIABLES;
case BONSAI -> configuration.getReceiptCompactionEnabled()
? BONSAI_WITH_RECEIPT_COMPACTION
: BONSAI_WITH_VARIABLES;
case FOREST ->
configuration.getReceiptCompactionEnabled()
? FOREST_WITH_RECEIPT_COMPACTION
: FOREST_WITH_VARIABLES;
case BONSAI ->
configuration.getReceiptCompactionEnabled()
? BONSAI_WITH_RECEIPT_COMPACTION
: BONSAI_WITH_VARIABLES;
};
}

View File

@@ -168,13 +168,15 @@ public class DatabaseMetadata {
} else {
versionedStorageFormat =
switch (v1.privacyVersion().getAsInt()) {
case 1 -> switch (v1.version()) {
case 1 -> PrivacyVersionedStorageFormat.FOREST_WITH_VARIABLES;
case 2 -> PrivacyVersionedStorageFormat.BONSAI_WITH_VARIABLES;
default -> throw new StorageException("Unsupported db version: " + v1.version());
};
default -> throw new StorageException(
"Unsupported db privacy version: " + v1.privacyVersion().getAsInt());
case 1 ->
switch (v1.version()) {
case 1 -> PrivacyVersionedStorageFormat.FOREST_WITH_VARIABLES;
case 2 -> PrivacyVersionedStorageFormat.BONSAI_WITH_VARIABLES;
default -> throw new StorageException("Unsupported db version: " + v1.version());
};
default ->
throw new StorageException(
"Unsupported db privacy version: " + v1.privacyVersion().getAsInt());
};
}
@@ -227,22 +229,26 @@ public class DatabaseMetadata {
public DatabaseMetadata upgradeToPrivacy() {
return new DatabaseMetadata(
switch (versionedStorageFormat.getFormat()) {
case FOREST -> switch (versionedStorageFormat.getVersion()) {
case 1 -> PrivacyVersionedStorageFormat.FOREST_ORIGINAL;
case 2 -> PrivacyVersionedStorageFormat.FOREST_WITH_VARIABLES;
case 3 -> PrivacyVersionedStorageFormat.FOREST_WITH_RECEIPT_COMPACTION;
default -> throw new StorageException(
"Unsupported database with format FOREST and version "
+ versionedStorageFormat.getVersion());
};
case BONSAI -> switch (versionedStorageFormat.getVersion()) {
case 1 -> PrivacyVersionedStorageFormat.BONSAI_ORIGINAL;
case 2 -> PrivacyVersionedStorageFormat.BONSAI_WITH_VARIABLES;
case 3 -> PrivacyVersionedStorageFormat.BONSAI_WITH_RECEIPT_COMPACTION;
default -> throw new StorageException(
"Unsupported database with format BONSAI and version "
+ versionedStorageFormat.getVersion());
};
case FOREST ->
switch (versionedStorageFormat.getVersion()) {
case 1 -> PrivacyVersionedStorageFormat.FOREST_ORIGINAL;
case 2 -> PrivacyVersionedStorageFormat.FOREST_WITH_VARIABLES;
case 3 -> PrivacyVersionedStorageFormat.FOREST_WITH_RECEIPT_COMPACTION;
default ->
throw new StorageException(
"Unsupported database with format FOREST and version "
+ versionedStorageFormat.getVersion());
};
case BONSAI ->
switch (versionedStorageFormat.getVersion()) {
case 1 -> PrivacyVersionedStorageFormat.BONSAI_ORIGINAL;
case 2 -> PrivacyVersionedStorageFormat.BONSAI_WITH_VARIABLES;
case 3 -> PrivacyVersionedStorageFormat.BONSAI_WITH_RECEIPT_COMPACTION;
default ->
throw new StorageException(
"Unsupported database with format BONSAI and version "
+ versionedStorageFormat.getVersion());
};
});
}

View File

@@ -64,12 +64,14 @@ public enum PrivacyVersionedStorageFormat implements VersionedStorageFormat {
public static VersionedStorageFormat defaultForNewDB(
final DataStorageConfiguration configuration) {
return switch (configuration.getDatabaseFormat()) {
case FOREST -> configuration.getReceiptCompactionEnabled()
? FOREST_WITH_RECEIPT_COMPACTION
: FOREST_WITH_VARIABLES;
case BONSAI -> configuration.getReceiptCompactionEnabled()
? BONSAI_WITH_RECEIPT_COMPACTION
: BONSAI_WITH_VARIABLES;
case FOREST ->
configuration.getReceiptCompactionEnabled()
? FOREST_WITH_RECEIPT_COMPACTION
: FOREST_WITH_VARIABLES;
case BONSAI ->
configuration.getReceiptCompactionEnabled()
? BONSAI_WITH_RECEIPT_COMPACTION
: BONSAI_WITH_VARIABLES;
};
}

View File

@@ -22,21 +22,26 @@ public class RocksDBCLIOptions {
/** The constant DEFAULT_MAX_OPEN_FILES. */
public static final int DEFAULT_MAX_OPEN_FILES = 1024;
/** The constant DEFAULT_CACHE_CAPACITY. */
public static final long DEFAULT_CACHE_CAPACITY = 134217728;
/** The constant DEFAULT_BACKGROUND_THREAD_COUNT. */
public static final int DEFAULT_BACKGROUND_THREAD_COUNT = 4;
/** The constant DEFAULT_IS_HIGH_SPEC. */
public static final boolean DEFAULT_IS_HIGH_SPEC = false;
/** The constant MAX_OPEN_FILES_FLAG. */
public static final String MAX_OPEN_FILES_FLAG = "--Xplugin-rocksdb-max-open-files";
/** The constant CACHE_CAPACITY_FLAG. */
public static final String CACHE_CAPACITY_FLAG = "--Xplugin-rocksdb-cache-capacity";
/** The constant BACKGROUND_THREAD_COUNT_FLAG. */
public static final String BACKGROUND_THREAD_COUNT_FLAG =
"--Xplugin-rocksdb-background-thread-count";
/** The constant IS_HIGH_SPEC. */
public static final String IS_HIGH_SPEC = "--Xplugin-rocksdb-high-spec-enabled";

View File

@@ -72,16 +72,22 @@ public abstract class RocksDBColumnarKeyValueStorage implements SegmentedKeyValu
private static final Logger LOG = LoggerFactory.getLogger(RocksDBColumnarKeyValueStorage.class);
private static final int ROCKSDB_FORMAT_VERSION = 5;
private static final long ROCKSDB_BLOCK_SIZE = 32768;
/** RocksDb blockcache size when using the high spec option */
protected static final long ROCKSDB_BLOCKCACHE_SIZE_HIGH_SPEC = 1_073_741_824L;
/** RocksDb memtable size when using the high spec option */
protected static final long ROCKSDB_MEMTABLE_SIZE_HIGH_SPEC = 536_870_912L;
/** Max total size of all WAL file, after which a flush is triggered */
protected static final long WAL_MAX_TOTAL_SIZE = 1_073_741_824L;
/** Expected size of a single WAL file, to determine how many WAL files to keep around */
protected static final long EXPECTED_WAL_FILE_SIZE = 67_108_864L;
/** RocksDb number of log files to keep on disk */
private static final long NUMBER_OF_LOG_FILES_TO_KEEP = 7;
/** RocksDb Time to roll a log file (1 day = 3600 * 24 seconds) */
private static final long TIME_TO_ROLL_LOG_FILE = 86_400L;
@@ -98,11 +104,13 @@ public abstract class RocksDBColumnarKeyValueStorage implements SegmentedKeyValu
private final MetricsSystem metricsSystem;
private final RocksDBMetricsFactory rocksDBMetricsFactory;
private final RocksDBConfiguration configuration;
/** RocksDB DB options */
protected DBOptions options;
/** RocksDb transactionDB options */
protected TransactionDBOptions txOptions;
/** RocksDb statistics */
protected final Statistics stats = new Statistics();
@@ -111,8 +119,10 @@ public abstract class RocksDBColumnarKeyValueStorage implements SegmentedKeyValu
/** Map of the columns handles by name */
protected Map<SegmentIdentifier, RocksDbSegmentIdentifier> columnHandlesBySegmentIdentifier;
/** Column descriptors */
protected List<ColumnFamilyDescriptor> columnDescriptors;
/** Column handles */
protected List<ColumnFamilyHandle> columnHandles;

Some files were not shown because too many files have changed in this diff Show More