[MINOR] javadoc for kzg precompile (#4988)

* javadoc for kzg precompile

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/4993/head
Sally MacFarlane 2 years ago committed by GitHub
parent 1a39e38315
commit 7d04ed2e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      datatypes/src/main/java/org/hyperledger/besu/datatypes/Address.java
  2. 8
      evm/src/main/java/org/hyperledger/besu/evm/precompile/KZGPointEvalPrecompiledContract.java
  3. 6
      evm/src/main/java/org/hyperledger/besu/evm/precompile/MainnetPrecompiledContracts.java

@ -70,9 +70,9 @@ public class Address extends DelegatingBytes implements org.hyperledger.besu.plu
public static final Address BLS12_MAP_FP_TO_G1 = Address.precompiled(0x11); public static final Address BLS12_MAP_FP_TO_G1 = Address.precompiled(0x11);
/** The constant BLS12_MAP_FP2_TO_G2. */ /** The constant BLS12_MAP_FP2_TO_G2. */
public static final Address BLS12_MAP_FP2_TO_G2 = Address.precompiled(0x12); public static final Address BLS12_MAP_FP2_TO_G2 = Address.precompiled(0x12);
/** The constant KZG_POINT_EVAL. */
public static final Address KZG_POINT_EVAL = Address.precompiled(0x14); public static final Address KZG_POINT_EVAL = Address.precompiled(0x14);
/** The constant ZERO. */
public static final Address ZERO = Address.fromHexString("0x0"); public static final Address ZERO = Address.fromHexString("0x0");
/** /**
@ -137,10 +137,10 @@ public class Address extends DelegatingBytes implements org.hyperledger.besu.plu
} }
/** /**
* Parse an hexadecimal string representing an account address. * Parse a hexadecimal string representing an account address.
* *
* @param str An hexadecimal string (with or without the leading '0x') representing a valid * @param str A hexadecimal string (with or without the leading '0x') representing a valid account
* account address. * address.
* @return The parsed address: {@code null} if the provided string is {@code null}. * @return The parsed address: {@code null} if the provided string is {@code null}.
* @throws IllegalArgumentException if the string is either not hexadecimal, or not the valid * @throws IllegalArgumentException if the string is either not hexadecimal, or not the valid
* representation of an address. * representation of an address.
@ -152,9 +152,9 @@ public class Address extends DelegatingBytes implements org.hyperledger.besu.plu
} }
/** /**
* Parse an hexadecimal string representing an account address. * Parse a hexadecimal string representing an account address.
* *
* @param str An hexadecimal string representing a valid account address (strictly 20 bytes). * @param str A hexadecimal string representing a valid account address (strictly 20 bytes).
* @return The parsed address. * @return The parsed address.
* @throws IllegalArgumentException if the provided string is {@code null}. * @throws IllegalArgumentException if the provided string is {@code null}.
* @throws IllegalArgumentException if the string is either not hexadecimal, or not the valid * @throws IllegalArgumentException if the string is either not hexadecimal, or not the valid

@ -35,12 +35,19 @@ import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** The KZGPointEval precompile contract. */
public class KZGPointEvalPrecompiledContract implements PrecompiledContract { public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
/** Instantiates a new KZGPointEval precompile contract. */
public KZGPointEvalPrecompiledContract() { public KZGPointEvalPrecompiledContract() {
this(Optional.empty()); this(Optional.empty());
} }
/**
* Instantiates a new KZGPointEval precompile contract.
*
* @param pathToTrustedSetup the trusted setup path
*/
public KZGPointEvalPrecompiledContract(final Optional<Path> pathToTrustedSetup) { public KZGPointEvalPrecompiledContract(final Optional<Path> pathToTrustedSetup) {
String absolutePathToSetup; String absolutePathToSetup;
@ -85,6 +92,7 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
} }
} }
/** free up resources. */
@VisibleForTesting @VisibleForTesting
public void tearDown() { public void tearDown() {
CKZG4844JNI.freeTrustedSetup(); CKZG4844JNI.freeTrustedSetup();

@ -135,6 +135,12 @@ public abstract class MainnetPrecompiledContracts {
registry.put(Address.BLS12_MAP_FP2_TO_G2, new BLS12MapFp2ToG2PrecompiledContract()); registry.put(Address.BLS12_MAP_FP2_TO_G2, new BLS12MapFp2ToG2PrecompiledContract());
} }
/**
* Populate registry for Cancun.
*
* @param registry the registry
* @param gasCalculator the gas calculator
*/
public static void populateForCancun( public static void populateForCancun(
final PrecompileContractRegistry registry, final GasCalculator gasCalculator) { final PrecompileContractRegistry registry, final GasCalculator gasCalculator) {
populateForIstanbul(registry, gasCalculator); populateForIstanbul(registry, gasCalculator);

Loading…
Cancel
Save