diff --git a/README.adoc b/README.adoc index 453c2490..910640ca 100644 --- a/README.adoc +++ b/README.adoc @@ -29,7 +29,7 @@ Dshackle allows to build a mesh network of interconnected Dshackle servers for b Blockchain support: -- Ethereum, Ethereum Classic and Kovan testnet +- Ethereum, Ethereum Classic, Kovan testnet, and Goerli testnet - Bitcoin and Bitcoin Testnet WARNING: The project is still under development, please use with caution. diff --git a/build.gradle b/build.gradle index d61ef801..654acff2 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ repositories { maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } maven { url "https://dl.bintray.com/infinitape/etherjar" } - maven { url "https://dl.bintray.com/emerald/emerald-grpc" } + maven { url "https://dl.bintray.com/emerald/emerald-api" } } configurations { @@ -57,7 +57,7 @@ configurations { } dependencies { - implementation "io.emeraldpay:emerald-grpc:0.6.0-0.2" + implementation "io.emeraldpay:emerald-api:0.7.1" implementation "io.grpc:grpc-protobuf:${grpcVersion}" implementation "io.grpc:grpc-stub:${grpcVersion}" diff --git a/demo/quick-start/dshackle.yaml b/demo/quick-start/dshackle.yaml index 490ba154..45136507 100644 --- a/demo/quick-start/dshackle.yaml +++ b/demo/quick-start/dshackle.yaml @@ -19,3 +19,9 @@ cluster: ethereum: rpc: url: "https://kovan.infura.io/v3/${INFURA_USER}" + - id: infura-goerli + chain: goerli + connection: + ethereum: + rpc: + url: "https://goerli.infura.io/v3/${INFURA_USER}" diff --git a/docs/reference-configuration.adoc b/docs/reference-configuration.adoc index 0578b840..e7f4084c 100644 --- a/docs/reference-configuration.adoc +++ b/docs/reference-configuration.adoc @@ -434,7 +434,7 @@ Fallback role mean that the upstream is used only after other upstreams failed o | yes | Blockchain which is the provided by the upstream. Cluster may have multiple upstreams for a single blockchain. -Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, or `kovan` +Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, `kovan`, or `goerli` | `labels` | no diff --git a/gradle.properties b/gradle.properties index e507548a..6d1250f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ protocVersion=3.7.1 # Main Libs slf4jVersion=1.7.25 jacksonVersion=2.11.0 -grpcVersion=1.20.0 +grpcVersion=1.25.0 protobufVersion=3.7.1 springBootVersion=2.1.14.RELEASE springVersion=5.2.6.RELEASE diff --git a/proto/common.proto b/proto/common.proto index 68c2f871..06388830 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -23,6 +23,7 @@ enum ChainRef { CHAIN_KOVAN = 10002; CHAIN_TESTNET_BITCOIN = 10003; CHAIN_FLOONET = 10004; + CHAIN_GOERLI = 10005; // Non-standard starts from 50000 } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt b/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt index bb632801..b71eb79e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt @@ -30,7 +30,7 @@ enum class BlockchainType { companion object { @JvmStatic fun fromBlockchain(blockchain: Chain): BlockchainType { - if (blockchain == Chain.ETHEREUM || blockchain == Chain.ETHEREUM_CLASSIC || blockchain == Chain.TESTNET_KOVAN || blockchain == Chain.TESTNET_MORDEN) { + if (blockchain == Chain.ETHEREUM || blockchain == Chain.ETHEREUM_CLASSIC || blockchain == Chain.TESTNET_KOVAN || blockchain == Chain.TESTNET_MORDEN || blockchain == Chain.TESTNET_GOERLI) { return ETHEREUM } if (blockchain == Chain.BITCOIN || blockchain == Chain.TESTNET_BITCOIN) { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt index 0ded56fa..54f3673f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt @@ -63,6 +63,8 @@ open class ConfiguredUpstreams( "morden" to Chain.TESTNET_MORDEN, "kovan" to Chain.TESTNET_KOVAN, "kovan-testnet" to Chain.TESTNET_KOVAN, + "goerli" to Chain.TESTNET_GOERLI, + "goerli-testnet" to Chain.TESTNET_GOERLI, "bitcoin" to Chain.BITCOIN, "bitcoin-testnet" to Chain.TESTNET_BITCOIN ) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt index ca75c7a8..2dcf5360 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -123,6 +123,9 @@ class DefaultEthereumMethods( Chain.TESTNET_KOVAN == chain -> { "42" } + Chain.TESTNET_GOERLI == chain -> { + "5" + } else -> throw RpcException(-32602, "Invalid chain") } } @@ -140,6 +143,9 @@ class DefaultEthereumMethods( Chain.TESTNET_KOVAN == chain -> { "\"0x2a\"" } + Chain.TESTNET_GOERLI == chain -> { + "\"0x5\"" + } else -> throw RpcException(-32602, "Invalid chain") } } diff --git a/src/test/groovy/io/emeraldpay/dshackle/BlockchainTypeSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/BlockchainTypeSpec.groovy index ced62328..a82f8560 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/BlockchainTypeSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/BlockchainTypeSpec.groovy @@ -24,7 +24,7 @@ class BlockchainTypeSpec extends Specification { expect: BlockchainType.fromBlockchain(chain) == BlockchainType.ETHEREUM where: - chain << [Chain.ETHEREUM, Chain.ETHEREUM_CLASSIC, Chain.TESTNET_KOVAN, Chain.TESTNET_MORDEN] + chain << [Chain.ETHEREUM, Chain.ETHEREUM_CLASSIC, Chain.TESTNET_KOVAN, Chain.TESTNET_GOERLI, Chain.TESTNET_MORDEN] } def "Correct type for bitcoin"() { diff --git a/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy index 2504f09f..5af51f84 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy @@ -51,7 +51,7 @@ class MainConfigReaderSpec extends Specification { port == 8082 tls != null routes != null - routes.size() == 3 + routes.size() == 4 with(routes[0]) { id == "eth" blockchain == Chain.ETHEREUM @@ -64,6 +64,10 @@ class MainConfigReaderSpec extends Specification { id == "kovan" blockchain == Chain.TESTNET_KOVAN } + with(routes[3]) { + id == "goerli" + blockchain == Chain.TESTNET_GOERLI + } } act.upstreams != null with(act.upstreams) { diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy index 8779d3d9..930f9aeb 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy @@ -22,5 +22,6 @@ class DefaultEthereumMethodsSpec extends Specification { Chain.ETHEREUM | '"0x0"' Chain.ETHEREUM_CLASSIC | '"0x3d"' Chain.TESTNET_KOVAN | '"0x2a"' + Chain.TESTNET_GOERLI | '"0x5"' } } diff --git a/src/test/resources/dshackle-full.yaml b/src/test/resources/dshackle-full.yaml index bd089499..d042984b 100644 --- a/src/test/resources/dshackle-full.yaml +++ b/src/test/resources/dshackle-full.yaml @@ -33,6 +33,8 @@ proxy: blockchain: ethereum_classic - id: kovan blockchain: kovan + - id: goerli + blockchain: goerli cluster: defaults: