refactor: remove websocket configurations
MODIFY
apps/omg_eth/config/config.exs
apps/omg_eth/config/config.exs
@@ -15,7 +15,6 @@ config :omg_eth,
eth_node: :geth,
child_block_interval: 1000,
min_exit_period_seconds: nil,
- ws_url: "ws://localhost:8546/ws",
ethereum_events_check_interval_ms: 8_000,
ethereum_stalled_sync_threshold_ms: 20_000,
node_logging_in_debug: false

MODIFY
apps/omg_eth/config/test.exs
apps/omg_eth/config/test.exs
@@ -21,6 +21,5 @@ config :omg_eth,
# of the umbrella project. This is useful because `mix test` and `mix coveralls --umbrella`
# have different views on the root dir when testing.
umbrella_root_dir: Path.join(__DIR__, "../../.."),
- ws_url: "ws://localhost:8546/ws",
eth_node: :geth,
run_test_eth_dev_node: true

MODIFY
apps/omg_eth/lib/omg_eth/release_tasks/set_ethereum_client.ex
apps/omg_eth/lib/omg_eth/release_tasks/set_ethereum_client.ex
@@ -26,9 +26,6 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClient do
rpc_url = get_ethereum_rpc_url()
Application.put_env(:ethereumex, :url, rpc_url, persistent: true)
- ws_url = get_ethereum_ws_rpc_url()
- Application.put_env(@app, :ws_url, ws_url, persistent: true)
-
rpc_client_type = get_rpc_client_type()
Application.put_env(@app, :eth_node, rpc_client_type, persistent: true)
:ok
@@ -41,14 +38,6 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClient do
url
end
- defp get_ethereum_ws_rpc_url() do
- url = validate_string(get_env("ETHEREUM_WS_RPC_URL"), Application.get_env(@app, :ws_url))
-
- _ = Logger.info("CONFIGURATION: App: #{@app} Key: ETHEREUM_WS_RPC_URL Value: #{inspect(url)}.")
-
- url
- end
-
defp get_rpc_client_type() do
rpc_client_type = validate_rpc_client_type(get_env("ETH_NODE"), Application.get_env(@app, :eth_node))
_ = Logger.info("CONFIGURATION: App: #{@app} Key: ETH_NODE Value: #{inspect(rpc_client_type)}.")

MODIFY
apps/omg_eth/test/omg_eth/release_tasks/set_ethereum_client_test.exs
apps/omg_eth/test/omg_eth/release_tasks/set_ethereum_client_test.exs
@@ -36,36 +36,29 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClientTest do
test "if defaults are used when env vars are not set" do
url = Application.get_env(:ethereumex, :url)
- ws_url = Application.get_env(:omg_eth, :ws_url)
eth_node = Application.get_env(@app, :eth_node)
:ok = SetEthereumClient.init([])
^url = Application.get_env(:ethereumex, :url)
- ^ws_url = Application.get_env(:omg_eth, :ws_url)
^eth_node = Application.get_env(@app, :eth_node)
end
test "if values are used when env vars set" do
- :ok = System.put_env("ETHEREUM_WS_RPC_URL", "ws_url")
:ok = System.put_env("ETHEREUM_RPC_URL", "url")
:ok = System.put_env("ETH_NODE", "geth")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:geth = Application.get_env(@app, :eth_node)
:ok = System.put_env("ETH_NODE", "parity")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:parity = Application.get_env(@app, :eth_node)
:ok = System.put_env("ETH_NODE", "infura")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:infura = Application.get_env(@app, :eth_node)
# cleanup
- :ok = System.delete_env("ETHEREUM_WS_RPC_URL")
:ok = System.delete_env("ETHEREUM_RPC_URL")
:ok = System.delete_env("ETH_NODE")
end

MODIFY
bin/variables
bin/variables
@@ -6,7 +6,6 @@ export APP_ENV=local_development
export HOSTNAME=yolo
export DB_PATH=~/plasma-data/
export ETHEREUM_RPC_URL=http://127.0.0.1:8545
-export ETHEREUM_WS_RPC_URL=ws://127.0.0.1:8546
export ETH_NODE=geth
export ETHEREUM_NETWORK=LOCALCHAIN
export DATABASE_URL=postgresql://omisego_dev:omisego_dev@127.0.0.1:5432/omisego_dev

MODIFY
docker-compose-infura.yml
docker-compose-infura.yml
@@ -13,13 +13,11 @@ services:
childchain:
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- PRIVATE_KEY=${AUTHORITY_PRIVATEKEY}
watcher:
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
geth:
# We don't need geth but docker-compose doesn't support overrides to remove or disable a service

MODIFY
docker-compose-watcher.yml
docker-compose-watcher.yml
@@ -21,7 +21,6 @@ services:
command: "full_local"
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- CHILD_CHAIN_URL=https://childchain-pre-lumphini.omg.network/
- ETHEREUM_NETWORK=RINKEBY
- TXHASH_CONTRACT=0xefc216dcfb01223253172514355fbe65e60acc043f214a9cdfad1e6f5cb566b4
@@ -49,7 +48,6 @@ services:
command: "full_local"
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- CHILD_CHAIN_URL=https://childchain-pre-lumphini.omg.network/
- ETHEREUM_NETWORK=RINKEBY
- TXHASH_CONTRACT=0xefc216dcfb01223253172514355fbe65e60acc043f214a9cdfad1e6f5cb566b4

MODIFY
docker-compose.yml
docker-compose.yml
@@ -29,6 +29,7 @@ services:
# 4. Unlocking the accounts by their indexes
echo "" > /tmp/geth-blank-password
# Starts geth
+ # Websocket is not used by the applications but enabled for debugging/testing convenience
geth --miner.gastarget 7500000 \
--miner.gasprice "10" \
--nodiscover \
@@ -65,14 +66,12 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- ERLANG_COOKIE=develop
- NODE_HOST=127.0.0.1
- APP_ENV=local_development
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000
- FEE_CLAIMER_ADDRESS=0x3b9f4c1dd26e0be593373b1d36cee2008cbeb837
@@ -99,7 +98,6 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- CHILD_CHAIN_URL=http://childchain:9656
- ERLANG_COOKIE=develop
- NODE_HOST=127.0.0.1
@@ -108,7 +106,6 @@ services:
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000
- EXIT_PROCESSOR_SLA_MARGIN=5520
@@ -135,7 +132,6 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- CHILD_CHAIN_URL=http://childchain:9656
- DATABASE_URL=postgresql://omisego_dev:omisego_dev@postgres:5432/omisego_dev
- ERLANG_COOKIE=develop
@@ -145,7 +141,6 @@ services:
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- EXIT_PROCESSOR_SLA_MARGIN=5520
restart: always

MODIFY
docs/deployment_configuration.md
docs/deployment_configuration.md
- "APP_ENV" - environment name in which the the application was deployed *mandatory*
- "DB_PATH" - directory of the KV db *mandatory*
- "ETHEREUM_RPC_URL" - address of Geth or Parity instance *mandatory*
-- "ETHEREUM_WS_RPC_URL" - address of Geth or Parity instance with websocket flags *mandatory*
- "ETH_NODE" - Geth, Parity or Infura *mandatory*
- "SENTRY_DSN" - if not set, Sentry is disabled
- "DD_HOSTNAME" - Datadog hostname

refactor: remove websocket configurations (#1309)