feat: Multiple json rpc urls (#10934)

* feat: Multiple json rpc urls

* Fix archive balances request in case of trace url is missing

* Add docs + specs for EndpointAvailabilityObserver public functions

* Update tests for internal transactions fetcher

* Fix archive balances request

* Fix adding unavailable endpoint
pull/10263/merge
Qwerty5Uiop 6 days ago committed by GitHub
parent 473d43333f
commit b7221bdb5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex
  2. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex
  3. 36
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex
  4. 11
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/common_helper.ex
  5. 14
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_checker.ex
  6. 111
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/utility/endpoint_availability_observer.ex
  7. 33
      apps/explorer/config/dev/besu.exs
  8. 33
      apps/explorer/config/dev/erigon.exs
  9. 35
      apps/explorer/config/dev/filecoin.exs
  10. 20
      apps/explorer/config/dev/ganache.exs
  11. 33
      apps/explorer/config/dev/geth.exs
  12. 33
      apps/explorer/config/dev/nethermind.exs
  13. 33
      apps/explorer/config/dev/rsk.exs
  14. 22
      apps/explorer/config/prod/besu.exs
  15. 22
      apps/explorer/config/prod/erigon.exs
  16. 20
      apps/explorer/config/prod/filecoin.exs
  17. 14
      apps/explorer/config/prod/ganache.exs
  18. 22
      apps/explorer/config/prod/geth.exs
  19. 22
      apps/explorer/config/prod/nethermind.exs
  20. 22
      apps/explorer/config/prod/rsk.exs
  21. 2
      apps/explorer/lib/explorer/chain/cache/optimism_finalization_period.ex
  22. 10
      apps/explorer/test/explorer/chain_test.exs
  23. 37
      apps/indexer/config/dev/besu.exs
  24. 37
      apps/indexer/config/dev/erigon.exs
  25. 35
      apps/indexer/config/dev/filecoin.exs
  26. 20
      apps/indexer/config/dev/ganache.exs
  27. 33
      apps/indexer/config/dev/geth.exs
  28. 37
      apps/indexer/config/dev/nethermind.exs
  29. 37
      apps/indexer/config/dev/rsk.exs
  30. 26
      apps/indexer/config/prod/besu.exs
  31. 26
      apps/indexer/config/prod/erigon.exs
  32. 20
      apps/indexer/config/prod/filecoin.exs
  33. 20
      apps/indexer/config/prod/ganache.exs
  34. 22
      apps/indexer/config/prod/geth.exs
  35. 26
      apps/indexer/config/prod/nethermind.exs
  36. 26
      apps/indexer/config/prod/rsk.exs
  37. 7
      apps/indexer/test/indexer/block/fetcher_test.exs
  38. 9
      config/config_helper.exs
  39. 7
      config/runtime.exs

@ -226,11 +226,14 @@ defmodule BlockScoutWeb.SmartContractView do
def cut_rpc_url(error) do def cut_rpc_url(error) do
transport_options = Application.get_env(:explorer, :json_rpc_named_arguments)[:transport_options] transport_options = Application.get_env(:explorer, :json_rpc_named_arguments)[:transport_options]
error all_urls =
|> String.replace(transport_options[:url], "rpc_url") (transport_options[:urls] || []) ++
|> (&if(transport_options[:fallback_url], (transport_options[:trace_urls] || []) ++
do: String.replace(&1, transport_options[:fallback_url], "rpc_url"), (transport_options[:eth_call_urls] || []) ++
else: &1 (transport_options[:fallback_urls] || []) ++
)).() (transport_options[:fallback_trace_urls] || []) ++
(transport_options[:fallback_eth_call_urls] || [])
String.replace(error, Enum.reject(all_urls, &(&1 in [nil, ""])), "rpc_url")
end end
end end

@ -552,7 +552,7 @@ defmodule EthereumJSONRPC do
CommonHelper.put_in_keyword_nested( CommonHelper.put_in_keyword_nested(
json_rpc_named_arguments, json_rpc_named_arguments,
[:transport_options, :method_to_url, :eth_getBalance], [:transport_options, :method_to_url, :eth_getBalance],
System.get_env("ETHEREUM_JSONRPC_TRACE_URL") :trace
) )
end end

@ -3,7 +3,8 @@ defmodule EthereumJSONRPC.HTTP do
JSONRPC over HTTP JSONRPC over HTTP
""" """
alias EthereumJSONRPC.{DecodeError, Transport, Utility.EndpointAvailabilityObserver} alias EthereumJSONRPC.{DecodeError, Transport}
alias EthereumJSONRPC.Utility.{CommonHelper, EndpointAvailabilityObserver}
require Logger require Logger
@ -238,23 +239,34 @@ defmodule EthereumJSONRPC.HTTP do
defp url(options, method) when is_list(options) and is_binary(method) do defp url(options, method) when is_list(options) and is_binary(method) do
with {:ok, method_to_url} <- Keyword.fetch(options, :method_to_url), with {:ok, method_to_url} <- Keyword.fetch(options, :method_to_url),
{:ok, method_atom} <- to_existing_atom(method), {:ok, method_atom} <- to_existing_atom(method),
{:ok, url} <- Keyword.fetch(method_to_url, method_atom) do {:ok, url_type} <- Keyword.fetch(method_to_url, method_atom) do
{url_type, fallback_url} = fallback_urls = CommonHelper.url_type_to_urls(url_type, options, :fallback)
case method_atom do
:eth_call -> {:eth_call, options[:fallback_eth_call_url]} url =
_ -> {:trace, options[:fallback_trace_url]} url_type
end |> CommonHelper.url_type_to_urls(options)
|> EndpointAvailabilityObserver.maybe_replace_urls(fallback_urls, url_type)
|> select_single_url()
{url_type, EndpointAvailabilityObserver.maybe_replace_url(url, fallback_url, url_type)} {url_type, url}
else else
_ -> _ ->
url_type = :http
url = url =
options url_type
|> Keyword.fetch!(:url) |> CommonHelper.url_type_to_urls(options)
|> EndpointAvailabilityObserver.maybe_replace_url(options[:fallback_url], :http) |> EndpointAvailabilityObserver.maybe_replace_urls(options[:fallback_urls], url_type)
|> select_single_url()
{:http, url} {url_type, url}
end
end end
defp select_single_url([]), do: nil
defp select_single_url(urls) do
Enum.random(urls)
end end
defp to_existing_atom(string) do defp to_existing_atom(string) do

@ -30,6 +30,17 @@ defmodule EthereumJSONRPC.Utility.CommonHelper do
Keyword.put(keyword || [], nearest_path, put_in_keyword_nested(keyword[nearest_path], rest_path, value)) Keyword.put(keyword || [], nearest_path, put_in_keyword_nested(keyword[nearest_path], rest_path, value))
end end
@doc """
Extracts urls corresponding to `url_type` from json rpc transport options
"""
@spec url_type_to_urls(atom(), Keyword.t(), atom() | String.t()) :: [String.t()]
def url_type_to_urls(url_type, json_rpc_transport_options, subtype \\ nil) do
key_prefix = (subtype && "#{subtype}_") || ""
url_prefix = (url_type == :http && "") || "#{url_type}_"
urls_key = String.to_existing_atom("#{key_prefix}#{url_prefix}urls")
json_rpc_transport_options[urls_key]
end
defp convert_to_ms(number, "s"), do: :timer.seconds(number) defp convert_to_ms(number, "s"), do: :timer.seconds(number)
defp convert_to_ms(number, "m"), do: :timer.minutes(number) defp convert_to_ms(number, "m"), do: :timer.minutes(number)
defp convert_to_ms(number, "h"), do: :timer.hours(number) defp convert_to_ms(number, "h"), do: :timer.hours(number)

@ -40,8 +40,7 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityChecker do
{:ok, _number} -> {:ok, _number} ->
url = json_rpc_named_arguments[:transport_options][:url] url = json_rpc_named_arguments[:transport_options][:url]
EndpointAvailabilityObserver.enable_endpoint(url, url_type) EndpointAvailabilityObserver.enable_endpoint(url, url_type, json_rpc_named_arguments)
log_url_available(url, url_type, json_rpc_named_arguments)
acc acc
_ -> _ ->
@ -54,17 +53,8 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityChecker do
{:noreply, %{state | unavailable_endpoints_arguments: new_unavailable_endpoints}} {:noreply, %{state | unavailable_endpoints_arguments: new_unavailable_endpoints}}
end end
defp log_url_available(url, url_type, json_rpc_named_arguments) do
message_extra =
if EndpointAvailabilityObserver.fallback_url_set?(url_type, json_rpc_named_arguments),
do: ", switching back to it",
else: ""
Logger.info("URL #{inspect(url)} is available now#{message_extra}")
end
defp fetch_latest_block_number(json_rpc_named_arguments) do defp fetch_latest_block_number(json_rpc_named_arguments) do
{_, arguments_without_fallback} = pop_in(json_rpc_named_arguments, [:transport_options, :fallback_url]) {_, arguments_without_fallback} = pop_in(json_rpc_named_arguments, [:transport_options, :fallback_urls])
%{id: 0, method: "eth_blockNumber", params: []} %{id: 0, method: "eth_blockNumber", params: []}
|> EthereumJSONRPC.request() |> EthereumJSONRPC.request()

@ -7,12 +7,14 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
require Logger require Logger
alias EthereumJSONRPC.Utility.EndpointAvailabilityChecker alias EthereumJSONRPC.Utility.{CommonHelper, EndpointAvailabilityChecker}
@max_error_count 3 @max_error_count 3
@window_duration 3 @window_duration 3
@cleaning_interval :timer.seconds(1) @cleaning_interval :timer.seconds(1)
@type url_type :: :ws | :trace | :http | :eth_call
def start_link(_) do def start_link(_) do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__) GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end end
@ -23,14 +25,34 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
{:ok, %{error_counts: %{}, unavailable_endpoints: %{ws: [], trace: [], http: [], eth_call: []}}} {:ok, %{error_counts: %{}, unavailable_endpoints: %{ws: [], trace: [], http: [], eth_call: []}}}
end end
@doc """
Increases `url` of `url_type` type error count asynchronously.
"""
@spec inc_error_count(binary(), Keyword.t(), url_type()) :: :ok
def inc_error_count(url, json_rpc_named_arguments, url_type) do def inc_error_count(url, json_rpc_named_arguments, url_type) do
GenServer.cast(__MODULE__, {:inc_error_count, url, json_rpc_named_arguments, url_type}) GenServer.cast(__MODULE__, {:inc_error_count, url, json_rpc_named_arguments, url_type})
end end
@doc """
Checks if `url` of `url_type` type is available.
"""
@spec check_endpoint(binary(), url_type()) :: :ok | :unavailable
def check_endpoint(url, url_type) do def check_endpoint(url, url_type) do
GenServer.call(__MODULE__, {:check_endpoint, url, url_type}) GenServer.call(__MODULE__, {:check_endpoint, url, url_type})
end end
@doc """
Filters out unavailable urls from `urls` of `url_type` type.
"""
@spec filter_unavailable_urls([binary()], url_type()) :: [binary()]
def filter_unavailable_urls(urls, url_type) do
GenServer.call(__MODULE__, {:filter_unavailable_urls, urls, url_type})
end
@doc """
Checks if `url` of `url_type` type is unavailable and replaces it with `replace_url` if it's not `nil`.
"""
@spec maybe_replace_url(binary(), binary() | nil, url_type()) :: binary()
def maybe_replace_url(url, replace_url, url_type) do def maybe_replace_url(url, replace_url, url_type) do
case check_endpoint(url, url_type) do case check_endpoint(url, url_type) do
:ok -> url :ok -> url
@ -38,8 +60,23 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
end end
end end
def enable_endpoint(url, url_type) do @doc """
GenServer.cast(__MODULE__, {:enable_endpoint, url, url_type}) Analogue of `maybe_replace_url/3` for multiple urls.
"""
@spec maybe_replace_urls([binary()] | nil, [binary()] | nil, url_type()) :: [binary()]
def maybe_replace_urls(urls, replace_urls, url_type) do
case filter_unavailable_urls(urls, url_type) do
[] -> replace_urls || urls || []
available_urls -> available_urls
end
end
@doc """
Marks `url` of `url_type` type as available.
"""
@spec enable_endpoint(binary(), url_type(), Keyword.t()) :: :ok
def enable_endpoint(url, url_type, json_rpc_named_arguments) do
GenServer.cast(__MODULE__, {:enable_endpoint, url, url_type, json_rpc_named_arguments})
end end
def handle_call({:check_endpoint, url, url_type}, _from, %{unavailable_endpoints: unavailable_endpoints} = state) do def handle_call({:check_endpoint, url, url_type}, _from, %{unavailable_endpoints: unavailable_endpoints} = state) do
@ -48,6 +85,14 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
{:reply, result, state} {:reply, result, state}
end end
def handle_call(
{:filter_unavailable_urls, urls, url_type},
_from,
%{unavailable_endpoints: unavailable_endpoints} = state
) do
{:reply, do_filter_unavailable_urls(urls, unavailable_endpoints[url_type]), state}
end
def handle_cast({:inc_error_count, url, json_rpc_named_arguments, url_type}, state) do def handle_cast({:inc_error_count, url, json_rpc_named_arguments, url_type}, state) do
new_state = new_state =
if json_rpc_named_arguments[:api?], if json_rpc_named_arguments[:api?],
@ -57,7 +102,12 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
{:noreply, new_state} {:noreply, new_state}
end end
def handle_cast({:enable_endpoint, url, url_type}, %{unavailable_endpoints: unavailable_endpoints} = state) do def handle_cast(
{:enable_endpoint, url, url_type, json_rpc_named_arguments},
%{unavailable_endpoints: unavailable_endpoints} = state
) do
log_url_available(url, url_type, unavailable_endpoints, json_rpc_named_arguments)
{:noreply, {:noreply,
%{state | unavailable_endpoints: %{unavailable_endpoints | url_type => unavailable_endpoints[url_type] -- [url]}}} %{state | unavailable_endpoints: %{unavailable_endpoints | url_type => unavailable_endpoints[url_type] -- [url]}}}
end end
@ -81,6 +131,10 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
end end
end end
defp do_filter_unavailable_urls(urls, unavailable_urls) do
Enum.reject(urls || [], fn url -> url in unavailable_urls end)
end
defp do_increase_error_counts(url, json_rpc_named_arguments, url_type, %{error_counts: error_counts} = state) do defp do_increase_error_counts(url, json_rpc_named_arguments, url_type, %{error_counts: error_counts} = state) do
current_count = error_counts[url][url_type][:count] current_count = error_counts[url][url_type][:count]
unavailable_endpoints = state.unavailable_endpoints[url_type] unavailable_endpoints = state.unavailable_endpoints[url_type]
@ -94,11 +148,11 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
current_count + 1 >= @max_error_count -> current_count + 1 >= @max_error_count ->
EndpointAvailabilityChecker.add_endpoint( EndpointAvailabilityChecker.add_endpoint(
put_in(json_rpc_named_arguments[:transport_options][:url], url), put_in(json_rpc_named_arguments[:transport_options][:urls], [url]),
url_type url_type
) )
log_url_unavailable(url, url_type, json_rpc_named_arguments) log_url_unavailable(url, url_type, unavailable_endpoints, json_rpc_named_arguments)
%{ %{
state state
@ -114,20 +168,49 @@ defmodule EthereumJSONRPC.Utility.EndpointAvailabilityObserver do
end end
end end
defp log_url_unavailable(url, url_type, json_rpc_named_arguments) do defp log_url_unavailable(url, :ws, _unavailable_endpoints, _json_rpc_named_arguments) do
Logger.warning("URL #{inspect(url)} is unavailable")
end
defp log_url_unavailable(url, url_type, unavailable_endpoints, json_rpc_named_arguments) do
available_urls =
url_type
|> available_urls(unavailable_endpoints, json_rpc_named_arguments)
|> Kernel.--([url])
fallback_url_message = fallback_url_message =
if fallback_url_set?(url_type, json_rpc_named_arguments), case {available_urls, fallback_url_set?(url_type, json_rpc_named_arguments)} do
do: "switching to fallback #{url_type} url", {[], true} -> "and there is no other #{url_type} url available, switching to fallback #{url_type} url"
else: "and no fallback is set" {[], false} -> "there is no other #{url_type} url available, and no fallback is set"
_ -> "switching to another #{url_type} url"
end
Logger.warning("URL #{inspect(url)} is unavailable, #{fallback_url_message}") Logger.warning("URL #{inspect(url)} is unavailable, #{fallback_url_message}")
end end
def fallback_url_set?(url_type, json_rpc_named_arguments) do defp log_url_available(url, url_type, unavailable_endpoints, json_rpc_named_arguments) do
available_urls = available_urls(url_type, unavailable_endpoints, json_rpc_named_arguments)
message_extra =
case {available_urls, fallback_url_set?(url_type, json_rpc_named_arguments)} do
{[], true} -> ", switching back from fallback urls"
_ -> ""
end
Logger.info("URL #{inspect(url)} of #{url_type} type is available now#{message_extra}")
end
defp available_urls(url_type, unavailable_endpoints, json_rpc_named_arguments) do
url_type
|> CommonHelper.url_type_to_urls(json_rpc_named_arguments[:transport_options])
|> do_filter_unavailable_urls(unavailable_endpoints)
end
defp fallback_url_set?(url_type, json_rpc_named_arguments) do
case url_type do case url_type do
:http -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_url]) :http -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_urls])
:trace -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_trace_url]) :trace -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_trace_urls])
:eth_call -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_eth_call_url]) :eth_call -> not is_nil(json_rpc_named_arguments[:transport_options][:fallback_eth_call_urls])
_ -> false _ -> false
end end
end end

@ -12,14 +12,33 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,33 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,13 +12,36 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:1234/rpc/v1", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list(
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), "ETHEREUM_JSONRPC_HTTP_URLS",
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), "ETHEREUM_JSONRPC_HTTP_URL",
"http://localhost:1234/rpc/v1"
),
trace_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:1234/rpc/v1"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:1234/rpc/v1"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:1234/rpc/v1"), eth_call: :eth_call,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:1234/rpc/v1" trace_block: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,11 +12,23 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:7545"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:7545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:7545") eth_call: :eth_call
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,33 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
debug_traceTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", debug_traceTransaction: :trace,
debug_traceBlockByNumber: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" debug_traceBlockByNumber: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,33 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,33 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,22 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,22 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,13 +12,21 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_block: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,11 +12,17 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url() eth_call: :eth_call
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,22 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
debug_traceTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), debug_traceTransaction: :trace,
debug_traceBlockByNumber: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") debug_traceBlockByNumber: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,22 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -12,14 +12,22 @@ config :explorer,
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -42,7 +42,7 @@ defmodule Explorer.Chain.Cache.OptimismFinalizationPeriod do
transport: EthereumJSONRPC.HTTP, transport: EthereumJSONRPC.HTTP,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: optimism_l1_rpc, urls: [optimism_l1_rpc],
http_options: [ http_options: [
recv_timeout: :timer.minutes(10), recv_timeout: :timer.minutes(10),
timeout: :timer.minutes(10), timeout: :timer.minutes(10),

@ -756,6 +756,13 @@ defmodule Explorer.ChainTest do
insert(:pending_block_operation, block: block, block_number: block.number) insert(:pending_block_operation, block: block, block_number: block.number)
configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor)
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false)
on_exit(fn ->
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration)
end)
refute Chain.finished_indexing_internal_transactions?() refute Chain.finished_indexing_internal_transactions?()
end end
end end
@ -1066,9 +1073,12 @@ defmodule Explorer.ChainTest do
setup do setup do
Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCache.child_id()) Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCache.child_id())
Supervisor.restart_child(Explorer.Supervisor, PendingBlockOperationCache.child_id()) Supervisor.restart_child(Explorer.Supervisor, PendingBlockOperationCache.child_id())
configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor)
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false)
on_exit(fn -> on_exit(fn ->
Application.put_env(:indexer, :trace_first_block, 0) Application.put_env(:indexer, :trace_first_block, 0)
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration)
Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCache.child_id()) Supervisor.terminate_child(Explorer.Supervisor, PendingBlockOperationCache.child_id())
end) end)
end end

@ -18,16 +18,35 @@ config :indexer,
else: EthereumJSONRPC.IPC, else: EthereumJSONRPC.IPC,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -18,16 +18,35 @@ config :indexer,
else: EthereumJSONRPC.IPC, else: EthereumJSONRPC.IPC,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,13 +17,36 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:1234/rpc/v1", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list(
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), "ETHEREUM_JSONRPC_HTTP_URLS",
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), "ETHEREUM_JSONRPC_HTTP_URL",
"http://localhost:1234/rpc/v1"
),
trace_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:1234/rpc/v1"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:1234/rpc/v1"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:1234/rpc/v1"), eth_call: :eth_call,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:1234/rpc/v1" trace_block: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,11 +17,23 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:7545"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:7545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:7545") eth_call: :eth_call
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,14 +17,33 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
debug_traceTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", debug_traceTransaction: :trace,
debug_traceBlockByNumber: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" debug_traceBlockByNumber: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -18,16 +18,35 @@ config :indexer,
else: EthereumJSONRPC.IPC, else: EthereumJSONRPC.IPC,
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -19,16 +19,35 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:8545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:8545"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), trace_urls:
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_TRACE_URLS",
"ETHEREUM_JSONRPC_TRACE_URL",
"http://localhost:8545"
),
eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:8545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:8545"), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545", trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") || "http://localhost:8545" trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,16 +17,24 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,16 +17,24 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,13 +17,21 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_block: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,11 +17,23 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || "http://localhost:7545", urls:
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL", "http://localhost:7545"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_ETH_CALL_URL",
"http://localhost:7545"
),
fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url("http://localhost:7545") eth_call: :eth_call
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,14 +17,22 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
debug_traceTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), debug_traceTransaction: :trace,
debug_traceBlockByNumber: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") debug_traceBlockByNumber: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -17,16 +17,24 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -19,16 +19,24 @@ config :indexer,
), ),
transport_options: [ transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison, http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"), urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_HTTP_URLS", "ETHEREUM_JSONRPC_HTTP_URL"),
fallback_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"), trace_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_TRACE_URLS", "ETHEREUM_JSONRPC_TRACE_URL"),
fallback_trace_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"), eth_call_urls: ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_ETH_CALL_URLS", "ETHEREUM_JSONRPC_ETH_CALL_URL"),
fallback_eth_call_url: System.get_env("ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"), fallback_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_HTTP_URLS", "ETHEREUM_JSONRPC_FALLBACK_HTTP_URL"),
fallback_trace_urls:
ConfigHelper.parse_urls_list("ETHEREUM_JSONRPC_FALLBACK_TRACE_URLS", "ETHEREUM_JSONRPC_FALLBACK_TRACE_URL"),
fallback_eth_call_urls:
ConfigHelper.parse_urls_list(
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URLS",
"ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL"
),
method_to_url: [ method_to_url: [
eth_call: ConfigHelper.eth_call_url(), eth_call: :eth_call,
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), eth_getBalance: :trace,
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_block: :trace,
trace_replayBlockTransactions: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"), trace_replayBlockTransactions: :trace,
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL") trace_replayTransaction: :trace
], ],
http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts] http_options: [recv_timeout: timeout, timeout: timeout, hackney: hackney_opts]
], ],

@ -54,6 +54,13 @@ defmodule Indexer.Block.FetcherTest do
poll: false poll: false
) )
configuration = Application.get_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor)
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, disabled?: false)
on_exit(fn ->
Application.put_env(:indexer, Indexer.Fetcher.InternalTransaction.Supervisor, configuration)
end)
ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) InternalTransaction.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments) Token.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

@ -337,4 +337,13 @@ defmodule ConfigHelper do
def eth_call_url(default \\ nil) do def eth_call_url(default \\ nil) do
System.get_env("ETHEREUM_JSONRPC_ETH_CALL_URL") || System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || default System.get_env("ETHEREUM_JSONRPC_ETH_CALL_URL") || System.get_env("ETHEREUM_JSONRPC_HTTP_URL") || default
end end
def parse_urls_list(urls_var, url_var, default_url \\ nil) do
default = default_url || System.get_env("ETHEREUM_JSONRPC_HTTP_URL")
case parse_list_env_var(urls_var) do
[] -> [safe_get_env(url_var, default)]
urls -> urls
end
end
end end

@ -176,10 +176,13 @@ config :ueberauth, Ueberauth, logout_url: "https://#{System.get_env("ACCOUNT_AUT
### Ethereum JSONRPC ### ### Ethereum JSONRPC ###
######################## ########################
trace_url_missing? = System.get_env("ETHEREUM_JSONRPC_TRACE_URL") in ["", nil]
config :ethereum_jsonrpc, config :ethereum_jsonrpc,
rpc_transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", do: :http, else: :ipc), rpc_transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", do: :http, else: :ipc),
ipc_path: System.get_env("IPC_PATH"), ipc_path: System.get_env("IPC_PATH"),
disable_archive_balances?: ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES"), disable_archive_balances?:
trace_url_missing? or ConfigHelper.parse_bool_env_var("ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES"),
archive_balances_window: ConfigHelper.parse_integer_env_var("ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW", 200) archive_balances_window: ConfigHelper.parse_integer_env_var("ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW", 200)
config :ethereum_jsonrpc, EthereumJSONRPC.HTTP, config :ethereum_jsonrpc, EthereumJSONRPC.HTTP,
@ -763,7 +766,7 @@ config :indexer, Indexer.Fetcher.BlockReward.Supervisor,
disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BLOCK_REWARD_FETCHER") disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_BLOCK_REWARD_FETCHER")
config :indexer, Indexer.Fetcher.InternalTransaction.Supervisor, config :indexer, Indexer.Fetcher.InternalTransaction.Supervisor,
disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER") disabled?: trace_url_missing? or ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER")
disable_coin_balances_fetcher? = ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER") disable_coin_balances_fetcher? = ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER")

Loading…
Cancel
Save