From daf680c97b9081317e230053409c93ab47db91ac Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Sun, 15 May 2022 18:12:37 -0600 Subject: [PATCH] Reduce EVM library dependencies (#3832) * Reduce EVM library dependencies Reduce the runtime dependencies of the EVM module by moving a class used by a single class out of util to the owned module (QosTimer) and them removing un-used dependencies from EVM and dependant modules. Signed-off-by: Danno Ferrin --- crypto/build.gradle | 3 --- datatypes/build.gradle | 3 --- .../besu/ethereum/api/jsonrpc/internal}/QosTimer.java | 2 +- .../engine/EngineExchangeTransitionConfiguration.java | 2 +- .../besu/ethereum/api/jsonrpc/internal}/QosTimerTest.java | 2 +- .../engine/EngineExchangeTransitionConfigurationTest.java | 2 +- ethereum/p2p/build.gradle | 1 + ethereum/rlp/build.gradle | 4 ---- util/build.gradle | 6 ------ 9 files changed, 5 insertions(+), 20 deletions(-) rename {util/src/main/java/org/hyperledger/besu/util => ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal}/QosTimer.java (96%) rename {util/src/test/java/org/hyperledger/besu/util => ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal}/QosTimerTest.java (97%) diff --git a/crypto/build.gradle b/crypto/build.gradle index 33644b13b2..dce26dbd03 100644 --- a/crypto/build.gradle +++ b/crypto/build.gradle @@ -29,12 +29,10 @@ jar { dependencies { api project(':plugin-api') - api project(':util') api 'org.bouncycastle:bcprov-jdk15on' api 'org.slf4j:slf4j-api' - implementation 'com.google.guava:guava' implementation 'net.java.dev.jna:jna' implementation 'org.apache.tuweni:tuweni-bytes' implementation 'org.apache.tuweni:tuweni-units' @@ -44,7 +42,6 @@ dependencies { testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter' - testImplementation 'org.mockito:mockito-core' testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } diff --git a/datatypes/build.gradle b/datatypes/build.gradle index 337ef5cdab..5489fc9110 100644 --- a/datatypes/build.gradle +++ b/datatypes/build.gradle @@ -35,9 +35,6 @@ dependencies { implementation project(':crypto') implementation project(':ethereum:rlp') - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-units' - testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter' diff --git a/util/src/main/java/org/hyperledger/besu/util/QosTimer.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimer.java similarity index 96% rename from util/src/main/java/org/hyperledger/besu/util/QosTimer.java rename to ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimer.java index c483ac3063..c3d3997b29 100644 --- a/util/src/main/java/org/hyperledger/besu/util/QosTimer.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimer.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.util; +package org.hyperledger.besu.ethereum.api.jsonrpc.internal; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfiguration.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfiguration.java index 6ca754baad..5863aeef1a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfiguration.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfiguration.java @@ -20,13 +20,13 @@ import static org.hyperledger.besu.util.Slf4jLambdaHelper.traceLambda; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.QosTimer; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EngineExchangeTransitionConfigurationParameter; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.EngineExchangeTransitionConfigurationResult; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.util.QosTimer; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; diff --git a/util/src/test/java/org/hyperledger/besu/util/QosTimerTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimerTest.java similarity index 97% rename from util/src/test/java/org/hyperledger/besu/util/QosTimerTest.java rename to ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimerTest.java index ba939cfa8b..7e6fd4d833 100644 --- a/util/src/test/java/org/hyperledger/besu/util/QosTimerTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/QosTimerTest.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.util; +package org.hyperledger.besu.ethereum.api.jsonrpc.internal; import java.util.concurrent.atomic.AtomicInteger; diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java index 52c21be94c..2fd295f4f1 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java @@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequest; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.QosTimer; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EngineExchangeTransitionConfigurationParameter; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.UnsignedLongParameter; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; @@ -41,7 +42,6 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ParsedExtraData; import org.hyperledger.besu.evm.log.LogsBloomFilter; -import org.hyperledger.besu.util.QosTimer; import java.util.Map; import java.util.Optional; diff --git a/ethereum/p2p/build.gradle b/ethereum/p2p/build.gradle index 621dafd102..3744714b70 100644 --- a/ethereum/p2p/build.gradle +++ b/ethereum/p2p/build.gradle @@ -37,6 +37,7 @@ dependencies { implementation project(':pki') implementation project(':metrics:core') implementation project(':nat') + implementation project(':util') implementation 'com.google.guava:guava' implementation 'dnsjava:dnsjava' diff --git a/ethereum/rlp/build.gradle b/ethereum/rlp/build.gradle index 00bb8460ef..802a11b66f 100644 --- a/ethereum/rlp/build.gradle +++ b/ethereum/rlp/build.gradle @@ -30,10 +30,6 @@ jar { dependencies { annotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess' - api project(':plugin-api') - api project(':util') - - implementation 'com.google.guava:guava' implementation 'org.apache.tuweni:tuweni-bytes' implementation 'org.apache.tuweni:tuweni-units' diff --git a/util/build.gradle b/util/build.gradle index 483a778fb5..47aee44f91 100644 --- a/util/build.gradle +++ b/util/build.gradle @@ -30,17 +30,11 @@ jar { dependencies { api 'org.slf4j:slf4j-api' - implementation project(':plugin-api') - implementation 'com.google.guava:guava' - implementation 'io.vertx:vertx-core' implementation 'org.apache.logging.log4j:log4j-core' implementation 'org.apache.logging.log4j:log4j-slf4j-impl' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-units' implementation 'org.xerial.snappy:snappy-java' - testImplementation 'io.vertx:vertx-unit' testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter'