From 85fa6f1925e1a76b0084712851dcd4502596f167 Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Fri, 14 Jul 2023 13:53:44 +0300 Subject: [PATCH] Small refactoring --- .dialyzer-ignore | 2 +- CHANGELOG.md | 2 +- apps/block_scout_web/lib/block_scout_web/api_router.ex | 4 ++-- apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex | 2 -- apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex | 4 ---- apps/indexer/lib/indexer/fetcher/block_reward.ex | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.dialyzer-ignore b/.dialyzer-ignore index 2292e39d13..84162c2785 100644 --- a/.dialyzer-ignore +++ b/.dialyzer-ignore @@ -3,7 +3,7 @@ :0: Unknown type 'Elixir.Map':t/0 :0: Unknown type 'Elixir.Hash':t/0 :0: Unknown type 'Elixir.Address':t/0 -lib/ethereum_jsonrpc/rolling_window.ex:173 +lib/ethereum_jsonrpc/rolling_window.ex:171 lib/explorer/smart_contract/solidity/publisher_worker.ex:1 lib/explorer/smart_contract/vyper/publisher_worker.ex:1 lib/explorer/smart_contract/solidity/publisher_worker.ex:6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0428bb019d..30d9374723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ ### Chore -- [#7934](https://github.com/blockscout/blockscout/pull/7934) - Explicitly set consensus == true in queries (convenient for search) +- [#7934](https://github.com/blockscout/blockscout/pull/7934), [#7936](https://github.com/blockscout/blockscout/pull/7936) - Explicitly set consensus == true in queries (convenient for search), remove logger requirements, where it is not used anymore - [#7901](https://github.com/blockscout/blockscout/pull/7901) - Fix Docker image build - [#7890](https://github.com/blockscout/blockscout/pull/7890), [#7918](https://github.com/blockscout/blockscout/pull/7918) - Resolve warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead - [#7863](https://github.com/blockscout/blockscout/pull/7863) - Add max_age for account sessions diff --git a/apps/block_scout_web/lib/block_scout_web/api_router.ex b/apps/block_scout_web/lib/block_scout_web/api_router.ex index ee5c4ffe5d..12245a9d9b 100644 --- a/apps/block_scout_web/lib/block_scout_web/api_router.ex +++ b/apps/block_scout_web/lib/block_scout_web/api_router.ex @@ -203,7 +203,7 @@ defmodule BlockScoutWeb.ApiRouter do scope "/v1", as: :api_v1 do pipe_through(:api) alias BlockScoutWeb.API.{EthRPC, RPC, V1} - alias BlockScoutWeb.API.V1.HealthController + alias BlockScoutWeb.API.V1.{GasPriceOracleController, HealthController} alias BlockScoutWeb.API.V2.SearchController # leave the same endpoint in v1 in order to keep backward compatibility @@ -215,7 +215,7 @@ defmodule BlockScoutWeb.ApiRouter do get("/readiness", HealthController, :readiness) end - get("/gas-price-oracle", V1.GasPriceOracleController, :gas_price_oracle) + get("/gas-price-oracle", GasPriceOracleController, :gas_price_oracle) if Application.compile_env(:block_scout_web, __MODULE__)[:reading_enabled] do get("/supply", V1.SupplyController, :supply) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex index 0b2c6b9594..65657e7b92 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex @@ -21,8 +21,6 @@ defmodule EthereumJSONRPC.RollingWindow do use GenServer - require Logger - def child_spec([init_arguments]) do child_spec([init_arguments, []]) end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex index b538612cb4..d9689a07cd 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex @@ -7,8 +7,6 @@ defmodule EthereumJSONRPC.Transaction do [`eth_getTransactionByBlockHashAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex), and [`eth_getTransactionByBlockNumberAndIndex`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex) """ - require Logger - import EthereumJSONRPC, only: [quantity_to_integer: 1, integer_to_quantity: 1, request: 1] alias EthereumJSONRPC @@ -425,8 +423,6 @@ defmodule EthereumJSONRPC.Transaction do end def to_elixir(transaction) when is_binary(transaction) do - # Logger.warn(["Fetched transaction is not full: ", transaction]) - nil end diff --git a/apps/indexer/lib/indexer/fetcher/block_reward.ex b/apps/indexer/lib/indexer/fetcher/block_reward.ex index 43ceac5268..f6825a5ffc 100644 --- a/apps/indexer/lib/indexer/fetcher/block_reward.ex +++ b/apps/indexer/lib/indexer/fetcher/block_reward.ex @@ -100,7 +100,7 @@ defmodule Indexer.Fetcher.BlockReward do {:error, reason} -> Logger.error( fn -> - ["failed to fetch: ", inspect(reason)] + ["failed to fetch: ", inspect(reason), " hash: ", inspect(hash_string_by_number)] end, error_count: consensus_number_count )