diff --git a/CHANGELOG.md b/CHANGELOG.md index a6b28d0a5c7..5fb35c2e0b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,12 @@ - `--Xsnapsync-bft-enabled` option enables experimental support for snap sync with IBFT/QBFT permissioned Bonsai-DB chains [#7140](https://github.com/hyperledger/besu/pull/7140) - Add support to load external profiles using `--profile` [#7265](https://github.com/hyperledger/besu/issues/7265) - `privacy-nonce-always-increments` option enables private transactions to always increment the nonce, even if the transaction is invalid [#6593](https://github.com/hyperledger/besu/pull/6593) -- Add `block-test` subcommand to the evmtool which runs blockchain reference tests [#7310](https://github.com/hyperledger/besu/pull/7310) +- Added `block-test` subcommand to the evmtool which runs blockchain reference tests [#7293](https://github.com/hyperledger/besu/pull/7293) +- removed PKI backed QBFT [#7310](https://github.com/hyperledger/besu/pull/7310) - Implement gnark-crypto for eip-2537 [#7316](https://github.com/hyperledger/besu/pull/7316) - Improve blob size transaction selector [#7312](https://github.com/hyperledger/besu/pull/7312) - Added EIP-7702 [#7237](https://github.com/hyperledger/besu/pull/7237) +- implement gnark-crypto for eip-196 [#7262](https://github.com/hyperledger/besu/pull/7262) ### Bug fixes - Fix `eth_call` deserialization to correctly ignore unknown fields in the transaction object. [#7323](https://github.com/hyperledger/besu/pull/7323) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AbstractAltBnPrecompiledContract.java b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AbstractAltBnPrecompiledContract.java index 84ce6c6cf99..5f8e4b0a8c9 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AbstractAltBnPrecompiledContract.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AbstractAltBnPrecompiledContract.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; -import org.hyperledger.besu.nativelib.bls12_381.LibEthPairings; +import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP196; import java.util.Optional; import javax.annotation.Nonnull; @@ -49,7 +49,7 @@ public abstract class AbstractAltBnPrecompiledContract extends AbstractPrecompil */ public static boolean maybeEnableNative() { try { - useNative = LibEthPairings.ENABLED; + useNative = LibGnarkEIP196.ENABLED; } catch (UnsatisfiedLinkError | NoClassDefFoundError ule) { LOG.info("altbn128 native precompile not available: {}", ule.getMessage()); useNative = false; @@ -72,7 +72,7 @@ public static boolean isNative() { } private final byte operationId; - private final int inputLen; + private final int inputLimit; /** * Instantiates a new Abstract alt bn precompiled contract. @@ -89,9 +89,9 @@ public static boolean isNative() { final int inputLen) { super(name, gasCalculator); this.operationId = operationId; - this.inputLen = inputLen + 1; + this.inputLimit = inputLen + 1; - if (!LibEthPairings.ENABLED) { + if (!LibGnarkEIP196.ENABLED) { LOG.info("Native alt bn128 not available"); } } @@ -106,16 +106,16 @@ public static boolean isNative() { @Nonnull public PrecompileContractResult computeNative( final @Nonnull Bytes input, final MessageFrame messageFrame) { - final byte[] result = new byte[LibEthPairings.EIP196_PREALLOCATE_FOR_RESULT_BYTES]; - final byte[] error = new byte[LibEthPairings.EIP2537_PREALLOCATE_FOR_ERROR_BYTES]; + final byte[] result = new byte[LibGnarkEIP196.EIP196_PREALLOCATE_FOR_RESULT_BYTES]; + final byte[] error = new byte[LibGnarkEIP196.EIP196_PREALLOCATE_FOR_ERROR_BYTES]; final IntByReference o_len = - new IntByReference(LibEthPairings.EIP196_PREALLOCATE_FOR_RESULT_BYTES); + new IntByReference(LibGnarkEIP196.EIP196_PREALLOCATE_FOR_RESULT_BYTES); final IntByReference err_len = - new IntByReference(LibEthPairings.EIP2537_PREALLOCATE_FOR_ERROR_BYTES); - final int inputSize = Math.min(inputLen, input.size()); + new IntByReference(LibGnarkEIP196.EIP196_PREALLOCATE_FOR_ERROR_BYTES); + final int inputSize = Math.min(inputLimit, input.size()); final int errorNo = - LibEthPairings.eip196_perform_operation( + LibGnarkEIP196.eip196_perform_operation( operationId, input.slice(0, inputSize).toArrayUnsafe(), inputSize, @@ -123,6 +123,7 @@ public PrecompileContractResult computeNative( o_len, error, err_len); + if (errorNo == 0) { return PrecompileContractResult.success(Bytes.wrap(result, 0, o_len.getValue())); } else { diff --git a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128AddPrecompiledContract.java b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128AddPrecompiledContract.java index 026a78c4a25..8aaa276586d 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128AddPrecompiledContract.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128AddPrecompiledContract.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; -import org.hyperledger.besu.nativelib.bls12_381.LibEthPairings; +import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP196; import java.math.BigInteger; import java.util.Arrays; @@ -40,7 +40,7 @@ private AltBN128AddPrecompiledContract(final GasCalculator gasCalculator, final super( "AltBN128Add", gasCalculator, - LibEthPairings.EIP196_ADD_OPERATION_RAW_VALUE, + LibGnarkEIP196.EIP196_ADD_OPERATION_RAW_VALUE, PARAMETER_LENGTH); this.gasCost = gasCost; } diff --git a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128MulPrecompiledContract.java b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128MulPrecompiledContract.java index 73b824f763f..25399d9e719 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128MulPrecompiledContract.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128MulPrecompiledContract.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; -import org.hyperledger.besu.nativelib.bls12_381.LibEthPairings; +import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP196; import java.math.BigInteger; import java.util.Arrays; @@ -44,7 +44,7 @@ private AltBN128MulPrecompiledContract(final GasCalculator gasCalculator, final super( "AltBN128Mul", gasCalculator, - LibEthPairings.EIP196_MUL_OPERATION_RAW_VALUE, + LibGnarkEIP196.EIP196_MUL_OPERATION_RAW_VALUE, PARAMETER_LENGTH); this.gasCost = gasCost; } diff --git a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128PairingPrecompiledContract.java b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128PairingPrecompiledContract.java index 82496d4e31c..e6cd892233a 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128PairingPrecompiledContract.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/precompile/AltBN128PairingPrecompiledContract.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; -import org.hyperledger.besu.nativelib.bls12_381.LibEthPairings; +import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP196; import java.math.BigInteger; import java.util.ArrayList; @@ -56,7 +56,7 @@ private AltBN128PairingPrecompiledContract( super( "AltBN128Pairing", gasCalculator, - LibEthPairings.EIP196_PAIR_OPERATION_RAW_VALUE, + LibGnarkEIP196.EIP196_PAIR_OPERATION_RAW_VALUE, Integer.MAX_VALUE / PARAMETER_LENGTH * PARAMETER_LENGTH); this.pairingGasCost = pairingGasCost; this.baseGasCost = baseGasCost; diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index bd437c3a4e7..7cdf7ce0803 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -4632,12 +4632,12 @@ - - - + + + - - + + @@ -4648,52 +4648,52 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 0c2289233d6..6d176ba7e3a 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -156,7 +156,7 @@ dependencyManagement { dependency 'org.openjdk.jol:jol-core:0.17' dependency 'tech.pegasys:jc-kzg-4844:1.0.0' - dependencySet(group: 'org.hyperledger.besu', version: '0.9.2') { + dependencySet(group: 'org.hyperledger.besu', version: '0.9.3') { entry 'arithmetic' entry 'ipa-multipoint' entry 'bls12-381'