problem: allows multiple different endpoints for same upstream
solution: simplify config, allow to setup only one connection type per upstream
This commit is contained in:
@@ -18,7 +18,6 @@ class UpstreamsConfigReaderSpec extends Specification {
|
||||
size() == 1
|
||||
with(get(0)) {
|
||||
chains == ["ethereum"]
|
||||
options.quorum == 1
|
||||
options.minPeers == 3
|
||||
options.disableSyncing
|
||||
}
|
||||
@@ -28,28 +27,26 @@ class UpstreamsConfigReaderSpec extends Specification {
|
||||
id == "local"
|
||||
chain == "ethereum"
|
||||
provider == "geth"
|
||||
endpoints.size() == 2
|
||||
with(endpoints.get(0)) {
|
||||
type == UpstreamsConfig.EndpointType.JSON_RPC
|
||||
url == new URI("http://localhost:8545")
|
||||
}
|
||||
with(endpoints.get(1)) {
|
||||
type == UpstreamsConfig.EndpointType.WEBSOCKET
|
||||
url == new URI("ws://localhost:8546")
|
||||
connection instanceof UpstreamsConfig.EthereumConnection
|
||||
with((UpstreamsConfig.EthereumConnection)connection) {
|
||||
rpc != null
|
||||
rpc.url == new URI("http://localhost:8545")
|
||||
ws != null
|
||||
ws.url == new URI("ws://localhost:8546")
|
||||
}
|
||||
}
|
||||
with(act.upstreams.get(1)) {
|
||||
id == "infura"
|
||||
chain == "ethereum"
|
||||
provider == "infura"
|
||||
endpoints.size() == 1
|
||||
with(endpoints.get(0)) {
|
||||
type == UpstreamsConfig.EndpointType.JSON_RPC
|
||||
url == new URI("https://mainnet.infura.io/v3/fa28c968191849c1aff541ad1d8511f2")
|
||||
auth instanceof UpstreamsConfig.BasicAuth
|
||||
with((UpstreamsConfig.BasicAuth)auth) {
|
||||
connection instanceof UpstreamsConfig.EthereumConnection
|
||||
with((UpstreamsConfig.EthereumConnection)connection) {
|
||||
rpc.url == new URI("https://mainnet.infura.io/v3/fa28c968191849c1aff541ad1d8511f2")
|
||||
rpc.auth instanceof UpstreamsConfig.BasicAuth
|
||||
with((UpstreamsConfig.BasicAuth)rpc.auth) {
|
||||
key == "4fc258fe41a68149c199ad8f281f2015"
|
||||
}
|
||||
ws == null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,11 +63,9 @@ class UpstreamsConfigReaderSpec extends Specification {
|
||||
act.upstreams.size() == 1
|
||||
with(act.upstreams.get(0)) {
|
||||
id == "remote"
|
||||
chain == "auto"
|
||||
provider == "dshackle"
|
||||
endpoints.size() == 1
|
||||
with(endpoints.get(0)) {
|
||||
type == UpstreamsConfig.EndpointType.DSHACKLE
|
||||
connection instanceof UpstreamsConfig.GrpcConnection
|
||||
with((UpstreamsConfig.GrpcConnection)connection) {
|
||||
host == "10.2.0.15"
|
||||
auth instanceof UpstreamsConfig.TlsAuth
|
||||
with((UpstreamsConfig.TlsAuth)auth) {
|
||||
|
||||
@@ -6,24 +6,25 @@ defaultOptions:
|
||||
options:
|
||||
disable-syncing: true
|
||||
min-peers: 3
|
||||
quorum: 1
|
||||
|
||||
upstreams:
|
||||
- id: local
|
||||
chain: ethereum
|
||||
provider: geth
|
||||
endpoints:
|
||||
- type: json-rpc
|
||||
url: "http://localhost:8545"
|
||||
- type: ws
|
||||
url: "ws://localhost:8546"
|
||||
origin: "http://localhost"
|
||||
connection:
|
||||
ethereum:
|
||||
rpc:
|
||||
url: "http://localhost:8545"
|
||||
ws:
|
||||
url: "ws://localhost:8546"
|
||||
origin: "http://localhost"
|
||||
- id: infura
|
||||
chain: ethereum
|
||||
provider: infura
|
||||
endpoints:
|
||||
- type: json-rpc
|
||||
url: "https://mainnet.infura.io/v3/fa28c968191849c1aff541ad1d8511f2"
|
||||
auth:
|
||||
type: basic
|
||||
key: 4fc258fe41a68149c199ad8f281f2015
|
||||
connection:
|
||||
ethereum:
|
||||
rpc:
|
||||
url: "https://mainnet.infura.io/v3/fa28c968191849c1aff541ad1d8511f2"
|
||||
auth:
|
||||
type: basic
|
||||
key: 4fc258fe41a68149c199ad8f281f2015
|
||||
@@ -6,14 +6,12 @@ defaultOptions:
|
||||
options:
|
||||
disable-syncing: true
|
||||
min-peers: 3
|
||||
quorum: 1
|
||||
|
||||
upstreams:
|
||||
- id: remote
|
||||
chain: auto
|
||||
provider: dshackle
|
||||
endpoints:
|
||||
- type: dshackle
|
||||
connection:
|
||||
grpc:
|
||||
host: "10.2.0.15"
|
||||
auth:
|
||||
type: tls
|
||||
|
||||
Reference in New Issue
Block a user