javadoc - Adding default constructor and javadoc for :evm (#7070)

Signed-off-by: Usman Saleem <usman@usmans.info>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
Usman Saleem
2024-05-08 13:40:06 +10:00
committed by GitHub
parent 8601438d58
commit 5b16cef571
23 changed files with 83 additions and 4 deletions

View File

@@ -31,7 +31,8 @@ import javax.annotation.Nonnull;
* increases the global mark, so a mark set in once collection is usable across all
* UndoableCollection instances.
*
* @param <V> The type of the collection.
* @param <K> The type of the keys maintained by this map.
* @param <V> The type of mapped values.
*/
public class UndoMap<K, V> implements Map<K, V>, Undoable {

View File

@@ -27,7 +27,8 @@ import java.util.SortedMap;
* increases the global mark, so a mark set in once collection is usable across all
* UndoableCollection instances.
*
* @param <V> The type of the collection.
* @param <K> The type of the keys maintained by this map.
* @param <V> The type of mapped values.
*/
public class UndoNavigableMap<K, V> extends UndoMap<K, V> implements NavigableMap<K, V> {

View File

@@ -34,7 +34,9 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue;
* increases the global mark, so a mark set in once collection is usable across all
* UndoableCollection instances.
*
* @param <V> The type of the collection.
* @param <R> the type of the table row keys
* @param <C> the type of the table column keys
* @param <V> the type of the mapped values
*/
public class UndoTable<R, C, V> implements Table<R, C, V>, Undoable {

View File

@@ -28,6 +28,8 @@ import java.math.BigInteger;
/** Provides EVMs supporting the appropriate operations for ETC network upgrades. */
public class ClassicEVMs {
/** Default constructor. */
private ClassicEVMs() {}
/**
* spiral evm.

View File

@@ -30,6 +30,9 @@ public class PrefixCodeRule implements ContractValidationRule {
private static final byte FORMAT_RESERVED = (byte) 0xEF;
/** Default constructor. */
public PrefixCodeRule() {}
@Override
// As per https://eips.ethereum.org/EIPS/eip-3541
public Optional<ExceptionalHaltReason> validate(

View File

@@ -32,6 +32,9 @@ public class SimpleBlockValues implements BlockValues {
long timestamp = 1;
long gasLimit = Long.MAX_VALUE;
/** Default constructor. */
public SimpleBlockValues() {}
@Override
public Bytes getDifficultyBytes() {
return difficultyBytes;

View File

@@ -1428,6 +1428,9 @@ public class MessageFrame {
private Optional<List<VersionedHash>> versionedHashes = Optional.empty();
/** Instantiates a new Builder. */
public Builder() {}
/**
* The "parent" message frame. When present some fields will be populated from the parent and
* ignored if passed in via builder

View File

@@ -33,6 +33,22 @@ import org.apache.tuweni.bytes.Bytes32;
* Transaction Values used by various EVM Opcodes. These are the values that either do not change or
* the backing stores whose changes transcend message frames and are not part of state, such as
* transient storage and address warming.
*
* @param blockHashLookup The block hash lookup function
* @param maxStackSize The maximum stack size
* @param warmedUpAddresses The warmed up addresses
* @param warmedUpStorage The warmed up storage
* @param originator The originator address
* @param gasPrice The gas price
* @param blobGasPrice The blob gas price
* @param blockValues The block values
* @param messageFrameStack The message frame stack
* @param miningBeneficiary The mining beneficiary address
* @param versionedHashes The optional list of versioned hashes
* @param transientStorage The transient storage
* @param creates The set of addresses that creates
* @param selfDestructs The set of addresses that self-destructs
* @param gasRefunds The gas refunds
*/
public record TxValues(
Function<Long, Hash> blockHashLookup,

View File

@@ -33,6 +33,9 @@ public class ByzantiumGasCalculator extends SpuriousDragonGasCalculator {
/** The constant MAX_FIRST_EXPONENT_BYTES. */
public static final int MAX_FIRST_EXPONENT_BYTES = 32;
/** Default constructor. */
public ByzantiumGasCalculator() {}
@Override
public long modExpGasCost(final Bytes input) {
final long baseLength = BigIntegerModularExponentiationPrecompiledContract.baseLength(input);

View File

@@ -37,6 +37,9 @@ public class ConstantinopleGasCalculator extends ByzantiumGasCalculator {
private static final long EXTCODE_HASH_COST = 400L;
/** Default constructor. */
public ConstantinopleGasCalculator() {}
/**
* Returns the amount of gas the CREATE2 operation will consume.
*

View File

@@ -18,6 +18,9 @@ package org.hyperledger.besu.evm.gascalculator;
public class DieHardGasCalculator extends TangerineWhistleGasCalculator {
private static final long EXP_OPERATION_BYTE_GAS_COST = 50L;
/** Default constructor. */
public DieHardGasCalculator() {}
@Override
protected long expOperationByteGasCost() {
return EXP_OPERATION_BYTE_GAS_COST;

View File

@@ -120,6 +120,9 @@ public class FrontierGasCalculator implements GasCalculator {
private static final long SELF_DESTRUCT_REFUND_AMOUNT = 24_000L;
/** Default constructor. */
public FrontierGasCalculator() {}
@Override
public long transactionIntrinsicGasCost(final Bytes payload, final boolean isContractCreate) {
int zeros = 0;

View File

@@ -19,6 +19,9 @@ public class HomesteadGasCalculator extends FrontierGasCalculator {
private static final long TX_CREATE_EXTRA = 32_000L;
/** Default constructor. */
public HomesteadGasCalculator() {}
@Override
protected long txCreateExtraGasCost() {
return TX_CREATE_EXTRA;

View File

@@ -38,6 +38,9 @@ public class IstanbulGasCalculator extends PetersburgGasCalculator {
private static final long SSTORE_RESET_GAS_LESS_SLOAD_GAS = SSTORE_RESET_GAS - SLOAD_GAS;
private static final long NEGATIVE_SSTORE_CLEARS_SCHEDULE = -SSTORE_CLEARS_SCHEDULE;
/** Default constructor. */
public IstanbulGasCalculator() {}
@Override
public long transactionIntrinsicGasCost(final Bytes payload, final boolean isContractCreation) {
int zeros = 0;

View File

@@ -35,6 +35,9 @@ public class PetersburgGasCalculator extends ConstantinopleGasCalculator {
/** Same as {#link {@link FrontierGasCalculator#STORAGE_RESET_REFUND_AMOUNT} */
private static final long STORAGE_RESET_REFUND_AMOUNT = 15_000L;
/** Default constructor. */
public PetersburgGasCalculator() {}
/**
* Same as {#link {@link FrontierGasCalculator#calculateStorageCost(UInt256, Supplier, Supplier)}
*/

View File

@@ -26,6 +26,9 @@ public class SpuriousDragonGasCalculator extends TangerineWhistleGasCalculator {
private static final long EXP_OPERATION_BYTE_GAS_COST = 50L;
/** Default constructor. */
public SpuriousDragonGasCalculator() {}
@Override
public long callOperationGasCost(
final MessageFrame frame,

View File

@@ -37,6 +37,9 @@ public class TangerineWhistleGasCalculator extends HomesteadGasCalculator {
private static final long SLOAD_OPERATION_GAS_COST = 200L;
/** Default constructor. */
public TangerineWhistleGasCalculator() {}
@Override
public long getBalanceOperationGasCost() {
return BALANCE_OPERATION_GAS_COST;

View File

@@ -14,7 +14,12 @@
*/
package org.hyperledger.besu.evm.internal;
/** The Evm configuration. */
/**
* The type Evm configuration.
*
* @param jumpDestCacheWeightKB the jump destination cache weight in kb
* @param worldUpdaterMode the world updater mode
*/
public record EvmConfiguration(long jumpDestCacheWeightKB, WorldUpdaterMode worldUpdaterMode) {
/** How should the world state update be handled within transactions? */

View File

@@ -21,6 +21,9 @@ package org.hyperledger.besu.evm.internal;
*/
public class OverflowException extends RuntimeException {
/** Default constructor. */
public OverflowException() {}
/**
* Overload the stack trace fill in so no stack is filled in. This is done for performance reasons
* as this exception signals an expected corner case not a debuggable failure.

View File

@@ -20,6 +20,8 @@ package org.hyperledger.besu.evm.internal;
* failure but instead an expected edge case the EVM should handle.
*/
public class UnderflowException extends RuntimeException {
/** Default constructor. */
public UnderflowException() {}
/**
* Overload the stack trace fill in so no stack is filled in. This is done for performance reasons

View File

@@ -89,6 +89,9 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
loaded.set(false);
}
/** Default constructor. */
public KZGPointEvalPrecompiledContract() {}
@Override
public String getName() {
return "KZGPointEval";

View File

@@ -30,6 +30,11 @@ public class AccessListOperationTracer extends EstimateGasOperationTracer {
private Table<Address, Bytes32, Boolean> warmedUpStorage;
/** Default constructor. */
private AccessListOperationTracer() {
super();
}
@Override
public void tracePostExecution(final MessageFrame frame, final OperationResult operationResult) {
super.tracePostExecution(frame, operationResult);

View File

@@ -25,6 +25,9 @@ public class EstimateGasOperationTracer implements OperationTracer {
private long sStoreStipendNeeded = 0L;
/** Default constructor. */
public EstimateGasOperationTracer() {}
@Override
public void tracePostExecution(final MessageFrame frame, final OperationResult operationResult) {
if (frame.getCurrentOperation() instanceof SStoreOperation sStoreOperation