From e5c9124705c6bf2c63ff4dbce32d9eefb6d643d7 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Sun, 25 Aug 2019 00:14:46 -0400 Subject: [PATCH] solution: reorganize packages --- .../kotlin/io/emeraldpay/dshackle/GrpcServer.kt | 3 ++- .../dshackle/{upstream => quorum}/AlwaysQuorum.kt | 4 +++- .../{upstream => quorum}/BroadcastQuorum.kt | 4 +++- .../dshackle/{upstream => quorum}/CallQuorum.kt | 4 +++- .../{upstream => quorum}/NonEmptyQuorum.kt | 4 +++- .../dshackle/{upstream => quorum}/NonceQuorum.kt | 4 +++- .../{upstream => quorum}/NotLaggingQuorum.kt | 9 +++------ .../{upstream => quorum}/ValueAwareQuorum.kt | 3 ++- .../kotlin/io/emeraldpay/dshackle/rpc/Describe.kt | 2 ++ .../io/emeraldpay/dshackle/rpc/NativeCall.kt | 4 +++- .../dshackle/upstream/AggregatedUpstream.kt | 2 ++ .../dshackle/upstream/CachingEthereumApi.kt | 3 +++ .../io/emeraldpay/dshackle/upstream/CallMethods.kt | 2 ++ .../emeraldpay/dshackle/upstream/ChainUpstreams.kt | 3 +++ .../dshackle/upstream/ConfiguredUpstreams.kt | 4 ++++ .../dshackle/upstream/DirectCallMethods.kt | 3 +++ .../dshackle/upstream/FilteringApiIterator.kt | 2 ++ .../dshackle/upstream/HeadLagObserver.kt | 2 +- .../dshackle/upstream/QuorumBasedMethods.kt | 1 + .../io/emeraldpay/dshackle/upstream/Upstream.kt | 2 ++ .../dshackle/upstream/UpstreamValidator.kt | 1 + .../upstream/{ => ethereum}/DirectEthereumApi.kt | 3 ++- .../upstream/{ => ethereum}/EmptyEthereumHead.kt | 2 +- .../upstream/{ => ethereum}/EthereumApi.kt | 8 ++------ .../upstream/{ => ethereum}/EthereumHead.kt | 3 ++- .../upstream/{ => ethereum}/EthereumHeadMerge.kt | 3 +-- .../upstream/{ => ethereum}/EthereumRpcHead.kt | 4 ++-- .../upstream/{ => ethereum}/EthereumUpstream.kt | 3 ++- .../dshackle/upstream/{ => ethereum}/EthereumWs.kt | 2 +- .../upstream/{ => ethereum}/EthereumWsHead.kt | 3 +-- .../upstream/{ => grpc}/EthereumGrpcTransport.kt | 6 ++---- .../dshackle/upstream/{ => grpc}/GrpcUpstream.kt | 5 ++++- .../dshackle/upstream/{ => grpc}/GrpcUpstreams.kt | 4 ++-- .../BroadcastQuorumSpec.groovy | 9 ++++----- .../{upstream => quorum}/NonceQuorumSpec.groovy | 5 ++++- .../NotLaggingQuorumSpec.groovy | 4 +++- .../emeraldpay/dshackle/rpc/NativeCallSpec.groovy | 14 ++++---------- .../emeraldpay/dshackle/rpc/StreamHeadSpec.groovy | 4 +--- .../dshackle/test/EthereumApiMock.groovy | 5 +---- .../dshackle/test/EthereumHeadMock.groovy | 2 +- .../dshackle/test/EthereumUpstreamMock.groovy | 7 +++---- .../emeraldpay/dshackle/test/TestingCommons.groovy | 11 +---------- .../upstream/FilteringApiIteratorSpec.groovy | 3 +++ .../dshackle/upstream/HeadLagObserverSpec.groovy | 2 +- .../{ => grpc}/EthereumGrpcTransportSpec.groovy | 5 ++++- .../upstream/{ => grpc}/GrpcUpstreamSpec.groovy | 5 ++++- 46 files changed, 107 insertions(+), 81 deletions(-) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/AlwaysQuorum.kt (89%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/BroadcastQuorum.kt (93%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/CallQuorum.kt (91%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/NonEmptyQuorum.kt (92%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/NonceQuorum.kt (94%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/NotLaggingQuorum.kt (85%) rename src/main/kotlin/io/emeraldpay/dshackle/{upstream => quorum}/ValueAwareQuorum.kt (95%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/DirectEthereumApi.kt (96%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EmptyEthereumHead.kt (94%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumApi.kt (87%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumHead.kt (89%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumHeadMerge.kt (97%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumRpcHead.kt (96%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumUpstream.kt (97%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumWs.kt (98%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => ethereum}/EthereumWsHead.kt (96%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => grpc}/EthereumGrpcTransport.kt (97%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => grpc}/GrpcUpstream.kt (97%) rename src/main/kotlin/io/emeraldpay/dshackle/upstream/{ => grpc}/GrpcUpstreams.kt (98%) rename src/test/groovy/io/emeraldpay/dshackle/{upstream => quorum}/BroadcastQuorumSpec.groovy (93%) rename src/test/groovy/io/emeraldpay/dshackle/{upstream => quorum}/NonceQuorumSpec.groovy (93%) rename src/test/groovy/io/emeraldpay/dshackle/{upstream => quorum}/NotLaggingQuorumSpec.groovy (92%) rename src/test/groovy/io/emeraldpay/dshackle/upstream/{ => grpc}/EthereumGrpcTransportSpec.groovy (95%) rename src/test/groovy/io/emeraldpay/dshackle/upstream/{ => grpc}/GrpcUpstreamSpec.groovy (97%) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt b/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt index e9eb91e2..89f7e106 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt @@ -15,7 +15,7 @@ */ package io.emeraldpay.dshackle -import io.grpc.Server +import io.grpc.* import io.grpc.netty.GrpcSslContexts import io.grpc.netty.NettyServerBuilder import io.netty.handler.ssl.ClientAuth @@ -104,4 +104,5 @@ open class GrpcServer( server?.shutdownNow() log.info("GRPC Server shot down") } + } \ No newline at end of file diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AlwaysQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/AlwaysQuorum.kt similarity index 89% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/AlwaysQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/AlwaysQuorum.kt index a326b96d..e7f5118c 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AlwaysQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/AlwaysQuorum.kt @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/BroadcastQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/BroadcastQuorum.kt similarity index 93% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/BroadcastQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/BroadcastQuorum.kt index b12f604a..abdc4e33 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/BroadcastQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/BroadcastQuorum.kt @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.JacksonRpcConverter import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/CallQuorum.kt similarity index 91% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/CallQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/CallQuorum.kt index f03ee058..692c5d8b 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/CallQuorum.kt @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson import reactor.util.function.Tuple2 diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NonEmptyQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NonEmptyQuorum.kt similarity index 92% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/NonEmptyQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/NonEmptyQuorum.kt index 2f3526ab..0b3b582e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NonEmptyQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NonEmptyQuorum.kt @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.JacksonRpcConverter import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NonceQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NonceQuorum.kt similarity index 94% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/NonceQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/NonceQuorum.kt index 237801fe..902a1c27 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NonceQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NonceQuorum.kt @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.hex.HexQuantity import io.infinitape.etherjar.rpc.JacksonRpcConverter diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NotLaggingQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NotLaggingQuorum.kt similarity index 85% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/NotLaggingQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/NotLaggingQuorum.kt index 759dfba1..2daac72a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/NotLaggingQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/NotLaggingQuorum.kt @@ -13,16 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson -import org.slf4j.LoggerFactory -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono import java.util.concurrent.atomic.AtomicReference -import java.util.concurrent.locks.ReentrantLock -import kotlin.concurrent.withLock class NotLaggingQuorum(val maxLag: Long = 0): CallQuorum { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ValueAwareQuorum.kt b/src/main/kotlin/io/emeraldpay/dshackle/quorum/ValueAwareQuorum.kt similarity index 95% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/ValueAwareQuorum.kt rename to src/main/kotlin/io/emeraldpay/dshackle/quorum/ValueAwareQuorum.kt index 43e37d5f..ffb5618d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ValueAwareQuorum.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/quorum/ValueAwareQuorum.kt @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.rpc.JacksonRpcConverter import io.infinitape.etherjar.rpc.RpcException import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/Describe.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/Describe.kt index 6dde5473..ee3f7d1a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/Describe.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/Describe.kt @@ -18,6 +18,8 @@ package io.emeraldpay.dshackle.rpc import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.Common import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstream +import io.emeraldpay.dshackle.upstream.grpc.GrpcUpstream import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service import reactor.core.publisher.Mono diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt index 555178b0..8fc1fe4d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt @@ -19,6 +19,9 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.google.protobuf.ByteString import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.quorum.AlwaysQuorum +import io.emeraldpay.dshackle.quorum.CallQuorum import io.emeraldpay.grpc.Chain import org.apache.commons.lang3.StringUtils import org.slf4j.LoggerFactory @@ -28,7 +31,6 @@ import reactor.core.publisher.Flux import reactor.core.publisher.Mono import reactor.core.publisher.toFlux import reactor.core.publisher.toMono -import reactor.util.function.Tuple2 import reactor.util.function.Tuples import java.lang.Exception import java.time.Duration diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AggregatedUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/AggregatedUpstream.kt index b17bf0d3..63c11cd2 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AggregatedUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/AggregatedUpstream.kt @@ -21,6 +21,8 @@ import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.reader.BlockCacheReader import io.emeraldpay.dshackle.reader.CompoundReader import io.emeraldpay.dshackle.reader.Reader +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.infinitape.etherjar.domain.BlockHash import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CachingEthereumApi.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/CachingEthereumApi.kt index 9330d219..edf4316e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CachingEthereumApi.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/CachingEthereumApi.kt @@ -18,6 +18,9 @@ package io.emeraldpay.dshackle.upstream import com.fasterxml.jackson.databind.ObjectMapper import io.emeraldpay.dshackle.reader.EmptyReader import io.emeraldpay.dshackle.reader.Reader +import io.emeraldpay.dshackle.upstream.ethereum.EmptyEthereumHead +import io.emeraldpay.dshackle.upstream.ethereum.EthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.infinitape.etherjar.domain.BlockHash import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.hex.HexQuantity diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallMethods.kt index 60670fc6..7984da6e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/CallMethods.kt @@ -15,6 +15,8 @@ */ package io.emeraldpay.dshackle.upstream +import io.emeraldpay.dshackle.quorum.CallQuorum + interface CallMethods { fun getQuorumFor(method: String): CallQuorum fun isAllowed(method: String): Boolean diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ChainUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ChainUpstreams.kt index 6041b7b0..33828e92 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ChainUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ChainUpstreams.kt @@ -16,6 +16,9 @@ package io.emeraldpay.dshackle.upstream import com.fasterxml.jackson.databind.ObjectMapper +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHeadMerge import io.emeraldpay.grpc.Chain import org.slf4j.LoggerFactory import org.springframework.context.Lifecycle diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt index 1c0f5a49..1e690df1 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt @@ -18,6 +18,10 @@ package io.emeraldpay.dshackle.upstream import com.fasterxml.jackson.databind.ObjectMapper import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.config.UpstreamsConfigReader +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstream +import io.emeraldpay.dshackle.upstream.ethereum.EthereumWs +import io.emeraldpay.dshackle.upstream.grpc.GrpcUpstreams import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.DefaultRpcClient import io.infinitape.etherjar.rpc.transport.DefaultRpcTransport diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectCallMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectCallMethods.kt index 4ef9ef7a..939bf032 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectCallMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectCallMethods.kt @@ -15,6 +15,9 @@ */ package io.emeraldpay.dshackle.upstream +import io.emeraldpay.dshackle.quorum.AlwaysQuorum +import io.emeraldpay.dshackle.quorum.CallQuorum + class DirectCallMethods : CallMethods { override fun getQuorumFor(method: String): CallQuorum { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/FilteringApiIterator.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/FilteringApiIterator.kt index 1daad19e..5ade8e4c 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/FilteringApiIterator.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/FilteringApiIterator.kt @@ -15,6 +15,8 @@ */ package io.emeraldpay.dshackle.upstream +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi + class FilteringApiIterator( private val upstreams: List, private var pos: Int, diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HeadLagObserver.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HeadLagObserver.kt index 4a954c4f..6e896b80 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HeadLagObserver.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HeadLagObserver.kt @@ -15,6 +15,7 @@ */ package io.emeraldpay.dshackle.upstream +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson import org.slf4j.LoggerFactory @@ -24,7 +25,6 @@ import reactor.core.publisher.Flux import reactor.core.publisher.toFlux import reactor.util.function.Tuple2 import reactor.util.function.Tuples -import java.io.Closeable import java.time.Duration class HeadLagObserver ( diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/QuorumBasedMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/QuorumBasedMethods.kt index 22402b3b..48eaa950 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/QuorumBasedMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/QuorumBasedMethods.kt @@ -16,6 +16,7 @@ package io.emeraldpay.dshackle.upstream import com.fasterxml.jackson.databind.ObjectMapper +import io.emeraldpay.dshackle.quorum.* import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.JacksonRpcConverter import io.infinitape.etherjar.rpc.RpcException diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/Upstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/Upstream.kt index 9aceba5f..95f92bde 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/Upstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/Upstream.kt @@ -16,6 +16,8 @@ package io.emeraldpay.dshackle.upstream import io.emeraldpay.dshackle.config.UpstreamsConfig +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import reactor.core.publisher.Flux interface Upstream { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/UpstreamValidator.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/UpstreamValidator.kt index e0ab3f3d..e93196f3 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/UpstreamValidator.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/UpstreamValidator.kt @@ -16,6 +16,7 @@ package io.emeraldpay.dshackle.upstream import io.emeraldpay.dshackle.config.UpstreamsConfig +import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstream import io.infinitape.etherjar.rpc.Batch import io.infinitape.etherjar.rpc.Commands import reactor.core.publisher.Flux diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectEthereumApi.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/DirectEthereumApi.kt similarity index 96% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectEthereumApi.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/DirectEthereumApi.kt index 44926af4..0bc726c4 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DirectEthereumApi.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/DirectEthereumApi.kt @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import com.fasterxml.jackson.databind.ObjectMapper +import io.emeraldpay.dshackle.upstream.CallMethods import io.infinitape.etherjar.rpc.RpcCall import io.infinitape.etherjar.rpc.RpcClient import io.infinitape.etherjar.rpc.RpcException diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EmptyEthereumHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EmptyEthereumHead.kt similarity index 94% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EmptyEthereumHead.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EmptyEthereumHead.kt index 89faf03c..40e8e7eb 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EmptyEthereumHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EmptyEthereumHead.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumApi.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumApi.kt similarity index 87% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumApi.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumApi.kt index 531ee39a..6093f217 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumApi.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumApi.kt @@ -13,17 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import com.fasterxml.jackson.databind.ObjectMapper -import io.emeraldpay.grpc.Chain -import io.infinitape.etherjar.hex.HexQuantity +import io.emeraldpay.dshackle.upstream.Upstream import io.infinitape.etherjar.rpc.* -import io.infinitape.etherjar.rpc.json.ResponseJson -import org.slf4j.LoggerFactory import reactor.core.publisher.Mono import java.io.InputStream -import java.time.Duration abstract class EthereumApi( objectMapper: ObjectMapper diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHead.kt similarity index 89% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHead.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHead.kt index 848a239d..94f9a6d5 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHead.kt @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum +import io.emeraldpay.dshackle.upstream.Head import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHeadMerge.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHeadMerge.kt similarity index 97% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHeadMerge.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHeadMerge.kt index 9c8ad957..ffe3682d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumHeadMerge.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumHeadMerge.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson @@ -23,7 +23,6 @@ import org.springframework.context.Lifecycle import reactor.core.Disposable import reactor.core.publisher.Flux import reactor.core.publisher.Mono -import java.io.Closeable import java.util.concurrent.atomic.AtomicReference class EthereumHeadMerge( diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcHead.kt similarity index 96% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcHead.kt index 24c670c6..51637ca5 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcHead.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.Batch @@ -53,7 +53,7 @@ class EthereumRpcHead( Mono.fromCompletionStage(f).timeout(Duration.ofSeconds(5)) } .onErrorContinue { err, _ -> - log.warn("RPC error ${err.message}") + log.debug("RPC error ${err.message}") } .distinctUntilChanged { it.hash } .filter { block -> diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt similarity index 97% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumUpstream.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt index 2b74f38e..149f265b 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import io.emeraldpay.dshackle.config.UpstreamsConfig +import io.emeraldpay.dshackle.upstream.* import io.emeraldpay.grpc.Chain import org.slf4j.LoggerFactory import org.springframework.context.Lifecycle diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWs.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt similarity index 98% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWs.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt index 16dc9865..7578007d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWs.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum import io.emeraldpay.dshackle.config.UpstreamsConfig import io.infinitape.etherjar.domain.TransactionId diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWsHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsHead.kt similarity index 96% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWsHead.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsHead.kt index e1a05ed8..ab3cd68f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumWsHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsHead.kt @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.ethereum -import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumGrpcTransport.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransport.kt similarity index 97% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumGrpcTransport.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransport.kt index 8b56d933..b2f5aa5a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumGrpcTransport.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransport.kt @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.grpc import com.fasterxml.jackson.databind.ObjectMapper import com.google.protobuf.ByteString import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.Common import io.emeraldpay.api.proto.ReactorBlockchainGrpc +import io.emeraldpay.dshackle.upstream.Selector import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.Batch import io.infinitape.etherjar.rpc.JacksonRpcConverter @@ -27,9 +28,6 @@ import io.infinitape.etherjar.rpc.RpcException import io.infinitape.etherjar.rpc.RpcResponseError import io.infinitape.etherjar.rpc.transport.BatchStatus import io.infinitape.etherjar.rpc.transport.RpcTransport -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono -import reactor.core.publisher.toFlux import reactor.util.function.Tuple3 import reactor.util.function.Tuples import java.time.Duration diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstream.kt similarity index 97% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstream.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstream.kt index f3099630..3857f21a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstream.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.grpc import com.fasterxml.jackson.databind.ObjectMapper import com.salesforce.reactorgrpc.GrpcRetry @@ -21,6 +21,9 @@ import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.Common import io.emeraldpay.api.proto.ReactorBlockchainGrpc import io.emeraldpay.dshackle.config.UpstreamsConfig +import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.domain.BlockHash import io.infinitape.etherjar.domain.TransactionId diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt similarity index 98% rename from src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstreams.kt rename to src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt index 1ccc975a..b7de4807 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/GrpcUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.grpc import com.fasterxml.jackson.databind.ObjectMapper import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.ReactorBlockchainGrpc import io.emeraldpay.dshackle.config.UpstreamsConfig +import io.emeraldpay.dshackle.upstream.Upstreams import io.emeraldpay.grpc.Chain import io.grpc.ManagedChannelBuilder import io.grpc.netty.NettyChannelBuilder @@ -26,7 +27,6 @@ import io.netty.handler.ssl.* import org.apache.commons.lang3.StringUtils import org.slf4j.LoggerFactory import reactor.core.publisher.Flux -import reactor.core.publisher.Mono import reactor.core.publisher.toFlux import reactor.util.function.Tuple2 import reactor.util.function.Tuples diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/BroadcastQuorumSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/quorum/BroadcastQuorumSpec.groovy similarity index 93% rename from src/test/groovy/io/emeraldpay/dshackle/upstream/BroadcastQuorumSpec.groovy rename to src/test/groovy/io/emeraldpay/dshackle/quorum/BroadcastQuorumSpec.groovy index c79db55e..e4bb504f 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/BroadcastQuorumSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/quorum/BroadcastQuorumSpec.groovy @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum import io.emeraldpay.dshackle.test.TestingCommons -import io.infinitape.etherjar.domain.TransactionId -import io.infinitape.etherjar.rpc.json.BlockJson -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.quorum.BroadcastQuorum import spock.lang.Specification class BroadcastQuorumSpec extends Specification { diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/NonceQuorumSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/quorum/NonceQuorumSpec.groovy similarity index 93% rename from src/test/groovy/io/emeraldpay/dshackle/upstream/NonceQuorumSpec.groovy rename to src/test/groovy/io/emeraldpay/dshackle/quorum/NonceQuorumSpec.groovy index 4a46f0d0..684fe742 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/NonceQuorumSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/quorum/NonceQuorumSpec.groovy @@ -13,9 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum import io.emeraldpay.dshackle.test.TestingCommons +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.quorum.NonceQuorum import spock.lang.Specification class NonceQuorumSpec extends Specification { diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/NotLaggingQuorumSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/quorum/NotLaggingQuorumSpec.groovy similarity index 92% rename from src/test/groovy/io/emeraldpay/dshackle/upstream/NotLaggingQuorumSpec.groovy rename to src/test/groovy/io/emeraldpay/dshackle/quorum/NotLaggingQuorumSpec.groovy index 5ac1714f..4bc9cbc3 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/NotLaggingQuorumSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/quorum/NotLaggingQuorumSpec.groovy @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.quorum +import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.quorum.NotLaggingQuorum import spock.lang.Specification class NotLaggingQuorumSpec extends Specification { diff --git a/src/test/groovy/io/emeraldpay/dshackle/rpc/NativeCallSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/rpc/NativeCallSpec.groovy index 70054dc5..e37db800 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/rpc/NativeCallSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/rpc/NativeCallSpec.groovy @@ -15,18 +15,13 @@ */ package io.emeraldpay.dshackle.rpc -import com.fasterxml.jackson.databind.ObjectMapper + import io.emeraldpay.api.proto.BlockchainOuterClass -import io.emeraldpay.api.proto.Common -import io.emeraldpay.dshackle.test.EthereumApiMock import io.emeraldpay.dshackle.test.TestingCommons -import io.emeraldpay.dshackle.upstream.AggregatedUpstream -import io.emeraldpay.dshackle.upstream.AlwaysQuorum +import io.emeraldpay.dshackle.quorum.AlwaysQuorum import io.emeraldpay.dshackle.upstream.CachingEthereumApi -import io.emeraldpay.dshackle.upstream.CallQuorum -import io.emeraldpay.dshackle.upstream.DirectEthereumApi -import io.emeraldpay.dshackle.upstream.EthereumApi -import io.emeraldpay.dshackle.upstream.NonEmptyQuorum +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.quorum.NonEmptyQuorum import io.emeraldpay.dshackle.upstream.Selector import io.emeraldpay.dshackle.upstream.Upstream import io.emeraldpay.dshackle.upstream.Upstreams @@ -34,7 +29,6 @@ import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.RpcClient import reactor.core.publisher.Mono import reactor.test.StepVerifier -import reactor.util.function.Tuples import spock.lang.Specification import java.time.Duration diff --git a/src/test/groovy/io/emeraldpay/dshackle/rpc/StreamHeadSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/rpc/StreamHeadSpec.groovy index 5ccc7152..314e5600 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/rpc/StreamHeadSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/rpc/StreamHeadSpec.groovy @@ -20,11 +20,9 @@ import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.Common import io.emeraldpay.dshackle.test.EthereumUpstreamMock import io.emeraldpay.dshackle.test.UpstreamsMock -import io.emeraldpay.dshackle.upstream.DirectEthereumApi -import io.emeraldpay.dshackle.upstream.EthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi import io.emeraldpay.dshackle.upstream.Upstream import io.emeraldpay.grpc.Chain -import io.infinitape.etherjar.domain.Address import io.infinitape.etherjar.domain.BlockHash import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumApiMock.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumApiMock.groovy index d2b4947d..5ca6ca00 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumApiMock.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumApiMock.groovy @@ -19,10 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.google.protobuf.ByteString import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.dshackle.upstream.DirectCallMethods -import io.emeraldpay.dshackle.upstream.DirectEthereumApi -import io.emeraldpay.dshackle.upstream.EthereumApi -import io.emeraldpay.dshackle.upstream.QuorumBasedMethods -import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi import io.emeraldpay.grpc.Chain import io.grpc.stub.StreamObserver import io.infinitape.etherjar.rpc.RpcClient diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy index 0a2fcf04..865d28c4 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy @@ -15,7 +15,7 @@ */ package io.emeraldpay.dshackle.test -import io.emeraldpay.dshackle.upstream.EthereumHead +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.infinitape.etherjar.domain.TransactionId import io.infinitape.etherjar.rpc.json.BlockJson import reactor.core.publisher.Flux diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy index 07b82e10..68ecc6cc 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy @@ -15,10 +15,9 @@ */ package io.emeraldpay.dshackle.test -import io.emeraldpay.dshackle.upstream.DirectEthereumApi -import io.emeraldpay.dshackle.upstream.EthereumApi -import io.emeraldpay.dshackle.upstream.EthereumHead -import io.emeraldpay.dshackle.upstream.EthereumUpstream +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead +import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstream import io.emeraldpay.dshackle.upstream.UpstreamAvailability import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.domain.TransactionId diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy index 49505e64..bfde8fab 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy @@ -22,21 +22,12 @@ import com.fasterxml.jackson.databind.module.SimpleModule import io.emeraldpay.dshackle.upstream.AggregatedUpstream import io.emeraldpay.dshackle.upstream.ChainUpstreams import io.emeraldpay.dshackle.upstream.DirectCallMethods -import io.emeraldpay.dshackle.upstream.DirectEthereumApi -import io.emeraldpay.dshackle.upstream.EthereumApi -import io.emeraldpay.dshackle.upstream.EthereumUpstream -import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi import io.emeraldpay.grpc.Chain -import io.infinitape.etherjar.rpc.Batch -import io.infinitape.etherjar.rpc.ExecutableBatch import io.infinitape.etherjar.rpc.JacksonRpcConverter -import io.infinitape.etherjar.rpc.RpcCall import io.infinitape.etherjar.rpc.RpcClient -import io.infinitape.etherjar.rpc.transport.BatchStatus -import spock.mock.MockingApi import java.text.SimpleDateFormat -import java.util.concurrent.CompletableFuture class TestingCommons { diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/FilteringApiIteratorSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/FilteringApiIteratorSpec.groovy index 4e100278..f09252cc 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/FilteringApiIteratorSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/FilteringApiIteratorSpec.groovy @@ -17,6 +17,9 @@ package io.emeraldpay.dshackle.upstream import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.test.TestingCommons +import io.emeraldpay.dshackle.upstream.ethereum.DirectEthereumApi +import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstream +import io.emeraldpay.dshackle.upstream.ethereum.EthereumWs import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.DefaultRpcClient import spock.lang.Specification diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/HeadLagObserverSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/HeadLagObserverSpec.groovy index 3d51517e..ca009e16 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/HeadLagObserverSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/HeadLagObserverSpec.groovy @@ -15,9 +15,9 @@ */ package io.emeraldpay.dshackle.upstream +import io.emeraldpay.dshackle.upstream.ethereum.EthereumHead import io.infinitape.etherjar.rpc.json.BlockJson import reactor.core.publisher.Flux -import reactor.core.publisher.Mono import reactor.core.publisher.TopicProcessor import reactor.test.StepVerifier import reactor.util.function.Tuples diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/EthereumGrpcTransportSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransportSpec.groovy similarity index 95% rename from src/test/groovy/io/emeraldpay/dshackle/upstream/EthereumGrpcTransportSpec.groovy rename to src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransportSpec.groovy index d1729876..c5817186 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/EthereumGrpcTransportSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/EthereumGrpcTransportSpec.groovy @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.grpc import com.fasterxml.jackson.databind.ObjectMapper import io.emeraldpay.api.proto.BlockchainOuterClass @@ -22,6 +22,9 @@ import io.emeraldpay.dshackle.rpc.NativeCall import io.emeraldpay.dshackle.test.EthereumApiMock import io.emeraldpay.dshackle.test.MockServer import io.emeraldpay.dshackle.test.TestingCommons +import io.emeraldpay.dshackle.upstream.QuorumBasedMethods +import io.emeraldpay.dshackle.upstream.Upstreams +import io.emeraldpay.dshackle.upstream.grpc.EthereumGrpcTransport import io.emeraldpay.grpc.Chain import io.infinitape.etherjar.rpc.Batch import io.infinitape.etherjar.rpc.RpcCall diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/GrpcUpstreamSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreamSpec.groovy similarity index 97% rename from src/test/groovy/io/emeraldpay/dshackle/upstream/GrpcUpstreamSpec.groovy rename to src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreamSpec.groovy index eefb396d..f26640d9 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/GrpcUpstreamSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreamSpec.groovy @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.emeraldpay.dshackle.upstream +package io.emeraldpay.dshackle.upstream.grpc import com.fasterxml.jackson.databind.ObjectMapper import com.google.protobuf.ByteString @@ -22,6 +22,9 @@ import io.emeraldpay.api.proto.BlockchainOuterClass import io.emeraldpay.api.proto.Common import io.emeraldpay.dshackle.test.MockServer import io.emeraldpay.dshackle.test.TestingCommons +import io.emeraldpay.dshackle.upstream.QuorumBasedMethods +import io.emeraldpay.dshackle.upstream.UpstreamAvailability +import io.emeraldpay.dshackle.upstream.grpc.GrpcUpstream import io.emeraldpay.grpc.Chain import io.grpc.stub.StreamObserver import io.infinitape.etherjar.domain.BlockHash