solution: goerli support

Co-authored-by: Chase Wright <mysticryuujin@protonmail.com>
This commit is contained in:
Igor Artamonov
2020-08-23 20:19:00 -04:00
committed by GitHub
parent d9fd0619b3
commit 64c8cb35f3
13 changed files with 30 additions and 8 deletions

View File

@@ -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.

View File

@@ -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}"

View File

@@ -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}"

View File

@@ -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

View File

@@ -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

View File

@@ -23,6 +23,7 @@ enum ChainRef {
CHAIN_KOVAN = 10002;
CHAIN_TESTNET_BITCOIN = 10003;
CHAIN_FLOONET = 10004;
CHAIN_GOERLI = 10005;
// Non-standard starts from 50000
}

View File

@@ -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) {

View File

@@ -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
)

View File

@@ -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")
}
}

View File

@@ -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"() {

View File

@@ -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) {

View File

@@ -22,5 +22,6 @@ class DefaultEthereumMethodsSpec extends Specification {
Chain.ETHEREUM | '"0x0"'
Chain.ETHEREUM_CLASSIC | '"0x3d"'
Chain.TESTNET_KOVAN | '"0x2a"'
Chain.TESTNET_GOERLI | '"0x5"'
}
}

View File

@@ -33,6 +33,8 @@ proxy:
blockchain: ethereum_classic
- id: kovan
blockchain: kovan
- id: goerli
blockchain: goerli
cluster:
defaults: