From 6e4fceb229d70fd82122899f1415c312470acad2 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 8 Sep 2020 15:40:17 +0300 Subject: [PATCH] Switch to RPC endpoint polling if ETHEREUM_JSONRPC_WS_URL is an empty string --- CHANGELOG.md | 5 +++-- apps/indexer/config/dev/besu.exs | 4 +++- apps/indexer/config/dev/ganache.exs | 4 +++- apps/indexer/config/dev/geth.exs | 4 +++- apps/indexer/config/dev/parity.exs | 4 +++- apps/indexer/config/dev/rsk.exs | 4 +++- apps/indexer/config/prod/besu.exs | 4 +++- apps/indexer/config/prod/ganache.exs | 4 +++- apps/indexer/config/prod/geth.exs | 4 +++- apps/indexer/config/prod/parity.exs | 4 +++- apps/indexer/config/prod/rsk.exs | 4 +++- 11 files changed, 33 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81dac6b901..6522e86154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - [#3282](https://github.com/poanetwork/blockscout/pull/3282) - Import bridged tokens custom metadata - [#3281](https://github.com/poanetwork/blockscout/pull/3281) - Write contract: display currently connected address - [#3279](https://github.com/poanetwork/blockscout/pull/3279) - NFT instance: link to the app -- [#3278](https://github.com/poanetwork/blockscout/pull/3278) - Support of fetching of NFT tokens metadata from IPFS +- [#3278](https://github.com/poanetwork/blockscout/pull/3278) - Support of fetching of NFT metadata from IPFS - [#3273](https://github.com/poanetwork/blockscout/pull/3273) - Update token metadata at burn/mint events - [#3268](https://github.com/poanetwork/blockscout/pull/3268) - Token total supply on-demand fetcher - [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table @@ -18,7 +18,8 @@ - [#3256](https://github.com/poanetwork/blockscout/pull/3256) - Fix for invisible validator address at block page and wrong alert text color at xDai ### Chore -- [#3274](https://github.com/poanetwork/blockscout/pull/3274) - Replace underscore with hyphen in routes in routes +- [#3285](https://github.com/poanetwork/blockscout/pull/3285) - Switch to RPC endpoint polling if ETHEREUM_JSONRPC_WS_URL is an empty string +- [#3274](https://github.com/poanetwork/blockscout/pull/3274) - Replace underscore with hyphen in routes - [#3260](https://github.com/poanetwork/blockscout/pull/3260) - Update NPM dependencies to fix known vulnerabilities - [#3258](https://github.com/poanetwork/blockscout/pull/3258) - Token transfer: check that block exists before retrieving timestamp diff --git a/apps/indexer/config/dev/besu.exs b/apps/indexer/config/dev/besu.exs index dc61acea33..995adbfb71 100644 --- a/apps/indexer/config/dev/besu.exs +++ b/apps/indexer/config/dev/besu.exs @@ -22,7 +22,9 @@ config :indexer, variant: EthereumJSONRPC.Besu ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/dev/ganache.exs b/apps/indexer/config/dev/ganache.exs index ab90c798bd..229d9d36d9 100644 --- a/apps/indexer/config/dev/ganache.exs +++ b/apps/indexer/config/dev/ganache.exs @@ -16,7 +16,9 @@ config :indexer, variant: EthereumJSONRPC.Ganache ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/dev/geth.exs b/apps/indexer/config/dev/geth.exs index 5b1e16a603..2132684de1 100644 --- a/apps/indexer/config/dev/geth.exs +++ b/apps/indexer/config/dev/geth.exs @@ -16,7 +16,9 @@ config :indexer, variant: EthereumJSONRPC.Geth ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/dev/parity.exs b/apps/indexer/config/dev/parity.exs index 0a99ce6690..bff27731f0 100644 --- a/apps/indexer/config/dev/parity.exs +++ b/apps/indexer/config/dev/parity.exs @@ -39,7 +39,9 @@ config :indexer, # ] # ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/dev/rsk.exs b/apps/indexer/config/dev/rsk.exs index ed504f91f6..28c19e6c7f 100644 --- a/apps/indexer/config/dev/rsk.exs +++ b/apps/indexer/config/dev/rsk.exs @@ -23,7 +23,9 @@ config :indexer, variant: EthereumJSONRPC.RSK ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/prod/besu.exs b/apps/indexer/config/prod/besu.exs index aad6529e5c..c6393935fe 100644 --- a/apps/indexer/config/prod/besu.exs +++ b/apps/indexer/config/prod/besu.exs @@ -21,7 +21,9 @@ config :indexer, variant: EthereumJSONRPC.Besu ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/prod/ganache.exs b/apps/indexer/config/prod/ganache.exs index ab90c798bd..229d9d36d9 100644 --- a/apps/indexer/config/prod/ganache.exs +++ b/apps/indexer/config/prod/ganache.exs @@ -16,7 +16,9 @@ config :indexer, variant: EthereumJSONRPC.Ganache ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/prod/geth.exs b/apps/indexer/config/prod/geth.exs index b7e391055c..f70b0057f5 100644 --- a/apps/indexer/config/prod/geth.exs +++ b/apps/indexer/config/prod/geth.exs @@ -16,7 +16,9 @@ config :indexer, variant: EthereumJSONRPC.Geth ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/prod/parity.exs b/apps/indexer/config/prod/parity.exs index 0a1c466ea7..8dec293444 100644 --- a/apps/indexer/config/prod/parity.exs +++ b/apps/indexer/config/prod/parity.exs @@ -21,7 +21,9 @@ config :indexer, variant: EthereumJSONRPC.Parity ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL") diff --git a/apps/indexer/config/prod/rsk.exs b/apps/indexer/config/prod/rsk.exs index 3101ca1f66..5d52ad470d 100644 --- a/apps/indexer/config/prod/rsk.exs +++ b/apps/indexer/config/prod/rsk.exs @@ -23,7 +23,9 @@ config :indexer, variant: EthereumJSONRPC.RSK ], subscribe_named_arguments: [ - transport: System.get_env("ETHEREUM_JSONRPC_WS_URL") && EthereumJSONRPC.WebSocket, + transport: + System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" && + EthereumJSONRPC.WebSocket, transport_options: [ web_socket: EthereumJSONRPC.WebSocket.WebSocketClient, url: System.get_env("ETHEREUM_JSONRPC_WS_URL")