From 8ae0db4b2405ce2f331128b56a470c943e19e909 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Wed, 28 Aug 2024 12:43:23 -0700 Subject: [PATCH] Check for infinity in eip-196 ecmul (#7509) * check for infinity before calling out to jni for ecmul * some changelog clean-up Signed-off-by: garyschulte --- CHANGELOG.md | 32 ++++++++++++------- .../AltBN128MulPrecompiledContract.java | 7 ++++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c00417cab6..2b5276f589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,6 @@ ## [Unreleased] -### Fixed -- **DebugMetrics**: Fixed a `ClassCastException` occurring in `DebugMetrics` when handling nested metric structures. Previously, `Double` values within these structures were incorrectly cast to `Map` objects, leading to errors. This update allows for proper handling of both direct values and nested structures at the same level. Issue# [#7383](https://github.com/hyperledger/besu/pull/7383) -- `evmtool` was not respecting the `--genesis` setting, resulting in unexpected trace results. [#7433](https://github.com/hyperledger/besu/pull/7433) - -### Tests -- Added a comprehensive test case to reproduce the bug and verify the fix for the `ClassCastException` in `DebugMetrics`. This ensures that complex, dynamically nested metric structures can be handled without errors. - -## Next release - ### Upcoming Breaking Changes ### Breaking Changes @@ -20,12 +11,15 @@ - Add 'inbound' field to admin_peers JSON-RPC Call [#7461](https://github.com/hyperledger/besu/pull/7461) - Add pending block header to `TransactionEvaluationContext` plugin API [#7483](https://github.com/hyperledger/besu/pull/7483) - Add bootnode to holesky config [#7500](https://github.com/hyperledger/besu/pull/7500) -- Implement engine_getClientVersionV1 +- Implement engine_getClientVersionV1 [#7512](https://github.com/hyperledger/besu/pull/7512) +- Performance optimzation for ECMUL (1 of 2) [#7509](https://github.com/hyperledger/besu/pull/7509) ### Bug fixes - Fix tracing in precompiled contracts when halting for out of gas [#7318](https://github.com/hyperledger/besu/issues/7318) - Correctly release txpool save and restore lock in case of exceptions [#7473](https://github.com/hyperledger/besu/pull/7473) - Fix for `eth_gasPrice` could not retrieve block error [#7482](https://github.com/hyperledger/besu/pull/7482) +- **DebugMetrics**: Fixed a `ClassCastException` occurring in `DebugMetrics` when handling nested metric structures. Previously, `Double` values within these structures were incorrectly cast to `Map` objects, leading to errors. This update allows for proper handling of both direct values and nested structures at the same level. Issue# [#7383](https://github.com/hyperledger/besu/pull/7383) +- `evmtool` was not respecting the `--genesis` setting, resulting in unexpected trace results. [#7433](https://github.com/hyperledger/besu/pull/7433) ## 24.8.0 @@ -45,8 +39,7 @@ - In process RPC service [#7395](https://github.com/hyperledger/besu/pull/7395) - Added support for tracing private transactions using `priv_traceTransaction` API. [#6161](https://github.com/hyperledger/besu/pull/6161) - Wrap WorldUpdater into EVMWorldupdater [#7434](https://github.com/hyperledger/besu/pull/7434) -- Bump besu-native to 0.9.4 [#7456](https://github.com/hyperledger/besu/pull/7456) - +- Bump besu-native to 0.9.4 [#7456](https://github.com/hyperledger/besu/pull/7456)= ### Bug fixes - Correct entrypoint in Docker evmtool [#7430](https://github.com/hyperledger/besu/pull/7430) @@ -54,6 +47,11 @@ - Fix behaviour when starting in a pre-merge network [#7431](https://github.com/hyperledger/besu/pull/7431) - Fix Null pointer from DNS daemon [#7505](https://github.com/hyperledger/besu/issues/7505) +### Download Links +https://github.com/hyperledger/besu/releases/tag/24.8.0 +https://github.com/hyperledger/besu/releases/download/24.8.0/besu-24.8.0.tar.gz / sha256 9671157a623fb94005357bc409d1697a0d62bb6fd434b1733441bb301a9534a4 +https://github.com/hyperledger/besu/releases/download/24.8.0/besu-24.8.0.zip / sha256 9ee217d2188e8da89002c3f42e4f85f89aab782e9512bd03520296f0a4dcdd90 + ## 24.7.1 ### Breaking Changes @@ -89,6 +87,11 @@ - Add 30 second timeout to trie log pruner preload [#7365](https://github.com/hyperledger/besu/pull/7365) - Avoid executing pruner preload during trie log subcommands [#7366](https://github.com/hyperledger/besu/pull/7366) +### Download Links +https://github.com/hyperledger/besu/releases/tag/24.7.1 +https://github.com/hyperledger/besu/releases/download/24.7.1/besu-24.7.1.tar.gz / sha256 59ac352a86fd887225737a5fe4dad1742347edd3c3fbed98b079177e4ea8d544 +https://github.com/hyperledger/besu/releases/download/24.7.1/besu-24.7.1.zip / sha256 e616f8100f026a71a146a33847b40257c279b38085b17bb991df045cccb6f832 + ## 24.7.0 ### Upcoming Breaking Changes @@ -121,6 +124,11 @@ - Fix "Could not confirm best peer had pivot block" [#7109](https://github.com/hyperledger/besu/issues/7109) - Fix "Chain Download Halt" [#6884](https://github.com/hyperledger/besu/issues/6884) +### Download Links +https://github.com/hyperledger/besu/releases/tag/24.7.0 +https://github.com/hyperledger/besu/releases/download/24.7.0/besu-24.7.0.tar.gz / sha256 96cf47defd1d8c10bfc22634e53e3d640eaa81ef58cb0808e5f4265998979530 +https://github.com/hyperledger/besu/releases/download/24.7.0/besu-24.7.0.zip / sha256 7e92e2eb469be197af8c8ca7ac494e7a2e7ee91cbdb02d99ff87fb5209e0c2a0 + ## 24.6.0 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 25399d9e71..fe58faa68d 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 @@ -38,6 +38,7 @@ public class AltBN128MulPrecompiledContract extends AbstractAltBnPrecompiledCont new BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935"); + private static final Bytes POINT_AT_INFINITY = Bytes.repeat((byte) 0, 64); private final long gasCost; private AltBN128MulPrecompiledContract(final GasCalculator gasCalculator, final long gasCost) { @@ -78,6 +79,12 @@ public class AltBN128MulPrecompiledContract extends AbstractAltBnPrecompiledCont @Override public PrecompileContractResult computePrecompile( final Bytes input, @Nonnull final MessageFrame messageFrame) { + + if (input.size() >= 64 && input.slice(0, 64).equals(POINT_AT_INFINITY)) { + return new PrecompileContractResult( + POINT_AT_INFINITY, false, MessageFrame.State.COMPLETED_SUCCESS, Optional.empty()); + } + if (useNative) { return computeNative(input, messageFrame); } else {