diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5e94950bad..858bb8587c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -81,7 +81,7 @@ body: attributes: label: Elixir & Erlang/OTP versions description: Elixir & Erlang/OTP versions. - placeholder: Elixir 1.14.5 (compiled with Erlang/OTP 25) + placeholder: Elixir 1.16.3 (compiled with Erlang/OTP 26) validations: required: true diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index bcf5b142e0..7a852ee6d0 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -32,8 +32,8 @@ on: env: MIX_ENV: test - OTP_VERSION: ${{ vars.OTP_VERSION || '25.3.2.8' }} - ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION || '1.14.5' }} + OTP_VERSION: ${{ github.ref_name == '9256/merge' && '26.2.5.1' || vars.OTP_VERSION }} + ELIXIR_VERSION: ${{ github.ref_name == '9256/merge' && '1.16.3' || vars.ELIXIR_VERSION }} ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com" jobs: diff --git a/.tool-versions b/.tool-versions index 32fecf31ec..15355e5294 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -elixir 1.14.5-otp-25 -erlang 25.3.2.8 +elixir 1.16.3-otp-26 +erlang 26.2.5.1 nodejs 18.17.1 diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex index b38a513fc4..c7d21eff87 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex @@ -42,7 +42,7 @@ defmodule BlockScoutWeb.API.V2.ImportController do |> render(:message, %{message: "Success"}) error -> - Logger.warn(fn -> ["Error on importing token info: ", inspect(error)] end) + Logger.warning(fn -> ["Error on importing token info: ", inspect(error)] end) conn |> put_view(ApiView) diff --git a/apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex b/apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex index 71cdef5103..2d09503128 100644 --- a/apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex +++ b/apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex @@ -117,7 +117,7 @@ defmodule BlockScoutWeb.Models.UserFromAuth do # default case if nothing matches defp avatar_from_auth(auth) do - Logger.warn(auth.provider <> " needs to find an avatar URL!") + Logger.warning(auth.provider <> " needs to find an avatar URL!") Logger.debug(Poison.encode!(auth)) nil end diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex index 94bcac97ac..65e046dbcb 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex @@ -4,7 +4,7 @@ <%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
-

<%= if RustVerifierInterface.enabled?(), do: gettext "New Solidity/Yul Smart Contract Verification", else: gettext "New Solidity Smart Contract Verification" %>

+

<%= if RustVerifierInterface.enabled?(), do: gettext("New Solidity/Yul Smart Contract Verification"), else: gettext("New Solidity Smart Contract Verification") %>

<%= form_for changeset, address_contract_verification_path(@conn, :create), @@ -69,7 +69,7 @@
-
<%= if RustVerifierInterface.enabled?(), do: gettext "Drop all Solidity or Yul contract source files into the drop zone.", else: gettext "Drop all Solidity contract source files into the drop zone." %>
+
<%= if RustVerifierInterface.enabled?(), do: gettext("Drop all Solidity or Yul contract source files into the drop zone."), else: gettext("Drop all Solidity contract source files into the drop zone.") %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex index 37f358b9e9..dad9e730ce 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex @@ -11,7 +11,7 @@

<%= gettext "Validated Transactions" %>

- <%= render BlockScoutWeb.CommonComponentsView, "_rap_pagination_container.html", position: "top", showing_limit: if Chain.transactions_available_count() == Chain.limit_showing_transactions(), do: Chain.limit_showing_transactions(), else: nil %> + <%= render BlockScoutWeb.CommonComponentsView, "_rap_pagination_container.html", position: "top", showing_limit: if(Chain.transactions_available_count() == Chain.limit_showing_transactions(), do: Chain.limit_showing_transactions(), else: nil) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex index c25dbbf539..5fee550b6b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex @@ -20,7 +20,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do do_value_html(decoded_type, value, no_links) rescue exception -> - Logger.warn(fn -> + Logger.warning(fn -> ["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] end) @@ -33,7 +33,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do do_value_json(decoded_type, value) rescue exception -> - Logger.warn(fn -> + Logger.warning(fn -> ["Error determining value json for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] end) @@ -46,7 +46,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do do_copy_text(decoded_type, value) rescue exception -> - Logger.warn(fn -> + Logger.warning(fn -> ["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] end) diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex index 4e06e377dc..daab6b54b1 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex @@ -266,7 +266,7 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do |> Enum.reduce("", fn p, a -> a <> new_style <> p <> "\n" end) - |> String.slice(0..-2) + |> String.slice(0..-2//1) end end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex index d208826869..4a523f9270 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex @@ -301,7 +301,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do result rescue exception -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Error formatting constructor arguments for abi: #{inspect(abi)}, args: #{inspect(constructor_arguments)}: ", Exception.format(:error, exception) @@ -382,7 +382,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do tuple_item_types = rest |> String.split("]") - |> Enum.slice(0..-3) + |> Enum.slice(0..-3//1) |> Enum.join("]") array_str = "[" <> (rest |> String.split("[") |> List.last()) diff --git a/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex b/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex index d13ba23676..b7dbc3e158 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex @@ -81,7 +81,7 @@ defmodule BlockScoutWeb.NFTHelper do end defp ipfs_link(image_url, prefix) do - ipfs_uid = String.slice(image_url, String.length(prefix)..-1) + ipfs_uid = String.slice(image_url, String.length(prefix)..-1//1) "https://ipfs.io/ipfs/" <> ipfs_uid end diff --git a/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex index 6ceeeb6561..e6459593ba 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex @@ -56,7 +56,7 @@ defmodule BlockScoutWeb.SmartContractView do String.starts_with?(type, "tuple") -> tuple_types = type - |> String.slice(0..-3) + |> String.slice(0..-3//1) |> supplement_type_with_components(components) values = @@ -132,7 +132,7 @@ defmodule BlockScoutWeb.SmartContractView do to_string(address) _ -> - Logger.warn(fn -> ["Error decoding address value: #{inspect(value)}"] end) + Logger.warning(fn -> ["Error decoding address value: #{inspect(value)}"] end) "(decoding error)" end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 713a890d66..d89ab6f738 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -597,7 +597,7 @@ defmodule BlockScoutWeb.TransactionView do end def trim(length, string) do - %{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..String.length(string))} + %{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..-1//1)} end defp template_to_string(template) when is_list(template) do diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index ebf3286020..ab9636fb79 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -135,8 +135,11 @@ defmodule BlockScoutWeb.Mixfile do {:prometheus_phoenix, "~> 1.2"}, # Expose metrics from URL Prometheus server can scrape {:prometheus_plugs, "~> 1.1"}, - # OS process metrics for Prometheus - {:prometheus_process_collector, "~> 1.3"}, + # OS process metrics for Prometheus, custom ref to include https://github.com/deadtrickster/prometheus_process_collector/pull/30 + {:prometheus_process_collector, + git: "https://github.com/Phybbit/prometheus_process_collector.git", + ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f", + override: true}, {:remote_ip, "~> 1.0"}, {:qrcode, "~> 0.1.0"}, {:sobelow, ">= 0.7.0", only: [:dev, :test], runtime: false}, diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs index 7d6bac1bf8..e6ea85081b 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs @@ -207,11 +207,9 @@ defmodule BlockScoutWeb.AddressTokenTransferControllerTest do :index, Address.checksum(address.hash), Address.checksum(token.contract_address_hash), - %{ - block_number: page_last_transfer.block_number, - index: page_last_transfer.index, - items_count: "50" - } + block_number: page_last_transfer.block_number, + index: page_last_transfer.index, + items_count: "50" ) assert Map.get(json_response(conn, 200), "next_page_path") == expected_path diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs index 612156a8db..6e07605fdf 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs @@ -876,7 +876,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do for _ <- 0..50 do tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() - insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address) + insert(:token_transfer, + transaction: tx, + block: tx.block, + block_number: tx.block_number, + from_address: address + ) insert(:token_transfer, transaction: tx, @@ -941,7 +946,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do for _ <- 0..50 do tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() - insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address) + insert(:token_transfer, + transaction: tx, + block: tx.block, + block_number: tx.block_number, + from_address: address + ) end request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") @@ -986,7 +996,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do for _ <- 0..50 do tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() - insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address) + insert(:token_transfer, + transaction: tx, + block: tx.block, + block_number: tx.block_number, + from_address: address + ) end for _ <- 0..50 do @@ -1013,7 +1028,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do for _ <- 0..49 do tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() - insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address) + insert(:token_transfer, + transaction: tx, + block: tx.block, + block_number: tx.block_number, + from_address: address + ) end tt_to = diff --git a/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs index 8c5333adfc..0ebc98bfc9 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs @@ -98,12 +98,7 @@ defmodule BlockScoutWeb.BlockControllerTest do conn = get(conn, blocks_path(conn, :index), %{"type" => "JSON"}) - expected_path = - blocks_path(conn, :index, %{ - block_number: number, - block_type: "Block", - items_count: "50" - }) + expected_path = blocks_path(conn, :index, block_number: number, block_type: "Block", items_count: "50") assert Map.get(json_response(conn, 200), "next_page_path") == expected_path end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs index 5d7fa34b80..de82d6c155 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs @@ -53,9 +53,17 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do test "includes token transfers for the transaction", %{conn: conn} do transaction = insert(:transaction) |> with_block() - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) - - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) + + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) path = transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs index b7ac5eb7e0..7e5a91e064 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs @@ -63,12 +63,12 @@ defmodule BlockScoutWeb.VerifiedContractsControllerTest do conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"}) expected_path = - verified_contracts_path(conn, :index, %{ - smart_contract_id: id, - items_count: "50", + verified_contracts_path(conn, :index, coin_balance: nil, + items_count: "50", + smart_contract_id: id, tx_count: nil - }) + ) assert Map.get(json_response(conn, 200), "next_page_path") == expected_path end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs index 2ce5bea711..f649e5787a 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs @@ -41,10 +41,7 @@ defmodule BlockScoutWeb.WithdrawalControllerTest do conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"}) expected_path = - withdrawal_path(conn, :index, %{ - index: index, - items_count: "50" - }) + withdrawal_path(conn, :index, index: index, items_count: "50") assert Map.get(json_response(conn, 200), "next_page_path") == expected_path end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex index 1b6feee0ad..052765f9a9 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex @@ -101,7 +101,7 @@ defmodule EthereumJSONRPC.Encoder do decoded_data = result - |> String.slice(2..-1) + |> String.slice(2..-1//1) |> Base.decode16!(case: :lower) |> TypeDecoder.decode_raw(types_list) |> Enum.zip(types_list) @@ -120,7 +120,7 @@ defmodule EthereumJSONRPC.Encoder do def unescape(data) do if String.starts_with?(data, "\\x") do charlist = String.to_charlist(data) - erlang_literal = '"#{charlist}"' + erlang_literal = ~c"\"#{charlist}\"" {:ok, [{:string, _, unescaped_charlist}], _} = :erl_scan.string(erlang_literal) List.to_string(unescaped_charlist) else diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex index 9cf459e5c2..b1256b3ce5 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex @@ -100,18 +100,13 @@ defmodule EthereumJSONRPC.Variant do variant = System.get_env("ETHEREUM_JSONRPC_VARIANT", default_variant) - cond do - is_nil(variant) -> - "nethermind" - - variant == "parity" -> - "nethermind" - - true -> - variant - |> String.split(".") - |> List.last() - |> String.downcase() + if variant == "parity" do + "nethermind" + else + variant + |> String.split(".") + |> List.last() + |> String.downcase() end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs index b5ee4ae2ef..0c7feed17f 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs @@ -15,7 +15,7 @@ defmodule EthereumJSONRPC.ReceiptTest do %{"new_key" => "new_value", "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"} Errors: - {:unknown_key, %{key: "new_key", value: "new_value"}} + {:unknown_key, %{value: "new_value", key: "new_key"}} """, fn -> Receipt.to_elixir(%{ diff --git a/apps/explorer/lib/explorer/account/custom_abi.ex b/apps/explorer/lib/explorer/account/custom_abi.ex index 3a5429766e..6c618a1cc1 100644 --- a/apps/explorer/lib/explorer/account/custom_abi.ex +++ b/apps/explorer/lib/explorer/account/custom_abi.ex @@ -50,8 +50,9 @@ defmodule Explorer.Account.CustomABI do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) end defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do diff --git a/apps/explorer/lib/explorer/account/identity.ex b/apps/explorer/lib/explorer/account/identity.ex index 1fd3300db5..c9c55e6e69 100644 --- a/apps/explorer/lib/explorer/account/identity.ex +++ b/apps/explorer/lib/explorer/account/identity.ex @@ -36,7 +36,8 @@ defmodule Explorer.Account.Identity do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:uid_hash, get_field(changeset, :uid)) + |> force_change(:uid_hash, get_field(changeset, :uid)) end end diff --git a/apps/explorer/lib/explorer/account/notifier/email.ex b/apps/explorer/lib/explorer/account/notifier/email.ex index a47a0155ae..98e33be377 100644 --- a/apps/explorer/lib/explorer/account/notifier/email.ex +++ b/apps/explorer/lib/explorer/account/notifier/email.ex @@ -5,7 +5,6 @@ defmodule Explorer.Account.Notifier.Email do require Logger - alias BlockScoutWeb.Routers.WebRouter.Helpers alias Explorer.Account.{Identity, Watchlist, WatchlistAddress, WatchlistNotification} alias Explorer.Repo @@ -121,15 +120,15 @@ defmodule Explorer.Account.Notifier.Email do end defp address_url(address_hash) do - Helpers.address_url(uri(), :show, address_hash) + uri() |> URI.append_path("/address/#{address_hash}") |> to_string() end defp block_url(notification) do - Helpers.block_url(uri(), :show, Integer.to_string(notification.block_number)) + uri() |> URI.append_path("/block/#{notification.block_number}") |> to_string() end defp transaction_url(notification) do - Helpers.transaction_url(uri(), :show, notification.transaction_hash) + uri() |> URI.append_path("/tx/#{notification.transaction_hash}") |> to_string() end defp url_params do @@ -156,7 +155,7 @@ defmodule Explorer.Account.Notifier.Email do raw_path = url_params()[:path] if raw_path |> String.ends_with?("/") do - raw_path |> String.slice(0..-2) + raw_path |> String.slice(0..-2//1) else raw_path end diff --git a/apps/explorer/lib/explorer/account/tag_address.ex b/apps/explorer/lib/explorer/account/tag_address.ex index 27d559a208..87d8c40310 100644 --- a/apps/explorer/lib/explorer/account/tag_address.ex +++ b/apps/explorer/lib/explorer/account/tag_address.ex @@ -50,8 +50,9 @@ defmodule Explorer.Account.TagAddress do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) end defp check_existence_or_create_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do diff --git a/apps/explorer/lib/explorer/account/tag_transaction.ex b/apps/explorer/lib/explorer/account/tag_transaction.ex index 2b576b933a..a11b770e03 100644 --- a/apps/explorer/lib/explorer/account/tag_transaction.ex +++ b/apps/explorer/lib/explorer/account/tag_transaction.ex @@ -48,8 +48,9 @@ defmodule Explorer.Account.TagTransaction do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:tx_hash_hash, hash_to_lower_case_string(get_field(changeset, :tx_hash))) + |> force_change(:tx_hash_hash, hash_to_lower_case_string(get_field(changeset, :tx_hash))) end defp check_transaction_existence(%Changeset{changes: %{tx_hash: tx_hash}} = changeset) do diff --git a/apps/explorer/lib/explorer/account/watchlist_address.ex b/apps/explorer/lib/explorer/account/watchlist_address.ex index ee87c03529..14302eb0d5 100644 --- a/apps/explorer/lib/explorer/account/watchlist_address.ex +++ b/apps/explorer/lib/explorer/account/watchlist_address.ex @@ -68,8 +68,9 @@ defmodule Explorer.Account.WatchlistAddress do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) + |> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash))) end def create(attrs) do diff --git a/apps/explorer/lib/explorer/account/watchlist_notification.ex b/apps/explorer/lib/explorer/account/watchlist_notification.ex index fe28c7efac..bf747c32a1 100644 --- a/apps/explorer/lib/explorer/account/watchlist_notification.ex +++ b/apps/explorer/lib/explorer/account/watchlist_notification.ex @@ -58,11 +58,12 @@ defmodule Explorer.Account.WatchlistNotification do end defp put_hashed_fields(changeset) do + # Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53 changeset - |> put_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash))) - |> put_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash))) - |> put_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash))) - |> put_change(:subject_hash, get_field(changeset, :subject)) + |> force_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash))) + |> force_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash))) + |> force_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash))) + |> force_change(:subject_hash, get_field(changeset, :subject)) end @doc """ diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 0c2dddce6b..30ecb22f92 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -5257,11 +5257,11 @@ defmodule Explorer.Chain do result {:exit, reason} -> - Logger.warn("Query fetching token counters terminated: #{inspect(reason)}") + Logger.warning("Query fetching token counters terminated: #{inspect(reason)}") 0 nil -> - Logger.warn("Query fetching token counters timed out.") + Logger.warning("Query fetching token counters timed out.") 0 end end) diff --git a/apps/explorer/lib/explorer/chain/address.ex b/apps/explorer/lib/explorer/chain/address.ex index a3776d014a..a4749aab9c 100644 --- a/apps/explorer/lib/explorer/chain/address.ex +++ b/apps/explorer/lib/explorer/chain/address.ex @@ -192,7 +192,7 @@ defmodule Explorer.Chain.Address do |> stream_binary() |> Stream.zip(match_byte_stream) |> Enum.map(fn - {digit, _} when digit in '0123456789' -> + {digit, _} when digit in ~c"0123456789" -> digit {alpha, 1} -> @@ -220,7 +220,7 @@ defmodule Explorer.Chain.Address do |> stream_binary() |> Stream.zip(match_byte_stream) |> Enum.map(fn - {digit, _} when digit in '0123456789' -> + {digit, _} when digit in ~c"0123456789" -> digit {alpha, 1} -> diff --git a/apps/explorer/lib/explorer/chain/address/counters.ex b/apps/explorer/lib/explorer/chain/address/counters.ex index be88c3c33d..d6d1da965c 100644 --- a/apps/explorer/lib/explorer/chain/address/counters.ex +++ b/apps/explorer/lib/explorer/chain/address/counters.ex @@ -490,7 +490,7 @@ defmodule Explorer.Chain.Address.Counters do Map.put(acc, type, counter) {:exit, reason} -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Query fetching address counters for #{address_hash} terminated: #{inspect(reason)}" ] @@ -499,7 +499,7 @@ defmodule Explorer.Chain.Address.Counters do acc nil -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Query fetching address counters for #{address_hash} timed out." ] diff --git a/apps/explorer/lib/explorer/chain/hash.ex b/apps/explorer/lib/explorer/chain/hash.ex index 64e67aabec..8bac3ff442 100644 --- a/apps/explorer/lib/explorer/chain/hash.ex +++ b/apps/explorer/lib/explorer/chain/hash.ex @@ -153,7 +153,7 @@ defmodule Explorer.Chain.Hash do def to_iodata(%__MODULE__{byte_count: byte_count} = hash) do integer = to_integer(hash) hexadecimal_digit_count = byte_count_to_hexadecimal_digit_count(byte_count) - unprefixed = :io_lib.format('~#{hexadecimal_digit_count}.16.0b', [integer]) + unprefixed = :io_lib.format(~c"~#{hexadecimal_digit_count}.16.0b", [integer]) ["0x", unprefixed] end diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index c8acde43f6..46510f8e34 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -237,7 +237,7 @@ defmodule Explorer.Chain.Log do end rescue e -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Could not decode input data for log from transaction hash: ", Hash.to_iodata(transaction_hash), diff --git a/apps/explorer/lib/explorer/chain/mud.ex b/apps/explorer/lib/explorer/chain/mud.ex index 4f8f2895d9..c9832d90b4 100644 --- a/apps/explorer/lib/explorer/chain/mud.ex +++ b/apps/explorer/lib/explorer/chain/mud.ex @@ -30,7 +30,9 @@ defmodule Explorer.Chain.Mud do @schema_prefix "mud" - @store_tables_table_id Base.decode16!("746273746f72650000000000000000005461626c657300000000000000000000", case: :lower) + @store_tables_table_id Base.decode16!("746273746f72650000000000000000005461626c657300000000000000000000", + case: :lower + ) # https://github.com/latticexyz/mud/blob/cc4f4246e52982354e398113c46442910f9b04bb/packages/store/src/codegen/tables/Tables.sol#L34-L42 @store_tables_table_schema %Schema{ diff --git a/apps/explorer/lib/explorer/chain/smart_contract.ex b/apps/explorer/lib/explorer/chain/smart_contract.ex index cfac2ed864..9d44ed40bf 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract.ex @@ -1149,7 +1149,7 @@ defmodule Explorer.Chain.SmartContract do defp error_message(%{"message" => string} = error) when is_map(error), do: error_message_with_log(string) defp error_message(error) do - Logger.warn(fn -> ["Unknown verifier error: ", inspect(error)] end) + Logger.warning(fn -> ["Unknown verifier error: ", inspect(error)] end) "There was an error validating your contract, please try again." end diff --git a/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex b/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex index 76a6cf6378..e92a4cf82a 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex @@ -58,7 +58,9 @@ defmodule Explorer.Chain.SmartContract.AuditReport do |> cast(attrs, @optional_fields ++ @required_fields) |> validate_required(@required_fields, message: "Required") |> validate_length(:submitter_email, max: @max_string_length) - |> validate_format(:submitter_email, ~r/^[A-Z0-9._%+-]+@[A-Z0-9-]+.+.[A-Z]{2,4}$/i, message: "invalid email address") + |> validate_format(:submitter_email, ~r/^[A-Z0-9._%+-]+@[A-Z0-9-]+.+.[A-Z]{2,4}$/i, + message: "invalid email address" + ) |> validate_format(:submitter_name, ~r/[a-zA-Z ]+/i, message: "only letters are allowed") |> validate_length(:submitter_name, max: @max_string_length) |> validate_length(:project_name, max: @max_string_length) diff --git a/apps/explorer/lib/explorer/chain/stability/validator.ex b/apps/explorer/lib/explorer/chain/stability/validator.ex index 309d95814b..e5567c0953 100644 --- a/apps/explorer/lib/explorer/chain/stability/validator.ex +++ b/apps/explorer/lib/explorer/chain/stability/validator.ex @@ -145,7 +145,7 @@ defmodule Explorer.Chain.Stability.Validator do %{active: active_validators_list, all: validators_list} error -> - Logger.warn(fn -> ["Error on getting validator lists: #{inspect(error)}"] end) + Logger.warning(fn -> ["Error on getting validator lists: #{inspect(error)}"] end) nil end end @@ -164,7 +164,8 @@ defmodule Explorer.Chain.Stability.Validator do result = case format_missing_blocks_result(response) do {:error, message} -> - Logger.warn(fn -> ["Error on getValidatorMissingBlocks for #{validators_address_hashes}: #{message}"] end) + Logger.warning(fn -> ["Error on getValidatorMissingBlocks for #{validators_address_hashes}: #{message}"] end) + nil amount -> diff --git a/apps/explorer/lib/explorer/chain/transaction.ex b/apps/explorer/lib/explorer/chain/transaction.ex index 448299893c..c1c0918e81 100644 --- a/apps/explorer/lib/explorer/chain/transaction.ex +++ b/apps/explorer/lib/explorer/chain/transaction.ex @@ -992,7 +992,7 @@ defmodule Explorer.Chain.Transaction do end rescue e -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Could not decode input data for transaction: ", Hash.to_iodata(hash), @@ -1022,7 +1022,7 @@ defmodule Explorer.Chain.Transaction do {:ok, mapping} rescue e -> - Logger.warn(fn -> + Logger.warning(fn -> [ "Could not decode input data for transaction: ", Hash.to_iodata(hash), diff --git a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex index abab4aeccb..556819872d 100644 --- a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex +++ b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex @@ -33,7 +33,7 @@ defmodule Explorer.ChainSpec.GenesisData do # Callback for errored fetch @impl GenServer def handle_info({_ref, {:error, reason}}, state) do - Logger.warn(fn -> "Failed to fetch and import genesis data or precompiled contracts: '#{reason}'." end) + Logger.warning(fn -> "Failed to fetch and import genesis data or precompiled contracts: '#{reason}'." end) fetch_genesis_data() @@ -90,7 +90,9 @@ defmodule Explorer.ChainSpec.GenesisData do Logger.info(fn -> "Fetching precompiled config path: #{inspect(precompiled_config_path)}." end) if is_nil(chain_spec_path) and is_nil(precompiled_config_path) do - Logger.warn(fn -> "Genesis data is not fetched. Neither chain spec path or precompiles config path are set." end) + Logger.warning(fn -> + "Genesis data is not fetched. Neither chain spec path or precompiles config path are set." + end) else json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) variant = Keyword.fetch!(json_rpc_named_arguments, :variant) @@ -143,7 +145,7 @@ defmodule Explorer.ChainSpec.GenesisData do {:error, reason} -> # credo:disable-for-next-line Credo.Check.Refactor.Nesting - Logger.warn(fn -> "#{warn_message_prefix} #{inspect(reason)}" end) + Logger.warning(fn -> "#{warn_message_prefix} #{inspect(reason)}" end) nil end else diff --git a/apps/explorer/lib/explorer/chain_spec/geth/importer.ex b/apps/explorer/lib/explorer/chain_spec/geth/importer.ex index bc2dd89f66..1a7e86d2bf 100644 --- a/apps/explorer/lib/explorer/chain_spec/geth/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/geth/importer.ex @@ -119,7 +119,7 @@ defmodule Explorer.ChainSpec.Geth.Importer do if accounts do parse_accounts(accounts) else - Logger.warn(fn -> "No accounts are defined in genesis" end) + Logger.warning(fn -> "No accounts are defined in genesis" end) [] end diff --git a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex index 58dde7fcaa..d104b59312 100644 --- a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex @@ -98,7 +98,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do if accounts do parse_accounts(accounts) else - Logger.warn(fn -> "No accounts are defined in chain spec" end) + Logger.warning(fn -> "No accounts are defined in chain spec" end) [] end @@ -112,7 +112,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do |> parse_hex_numbers() |> format_ranges() else - Logger.warn(fn -> "No rewards are defined in chain spec" end) + Logger.warning(fn -> "No rewards are defined in chain spec" end) [] end diff --git a/apps/explorer/lib/explorer/chain_spec/poa/importer.ex b/apps/explorer/lib/explorer/chain_spec/poa/importer.ex index 7f69e59be1..d97da4b8a9 100644 --- a/apps/explorer/lib/explorer/chain_spec/poa/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/poa/importer.ex @@ -39,7 +39,7 @@ defmodule Explorer.ChainSpec.POA.Importer do def import_emission_rewards do if is_nil(rewards_contract_address()) do - Logger.warn(fn -> "No rewards contract address is defined" end) + Logger.warning(fn -> "No rewards contract address is defined" end) else block_reward = block_reward_amount() emission_funds = emission_funds_amount() diff --git a/apps/explorer/lib/explorer/eth_rpc.ex b/apps/explorer/lib/explorer/eth_rpc.ex index 0487a60c61..30c3022528 100644 --- a/apps/explorer/lib/explorer/eth_rpc.ex +++ b/apps/explorer/lib/explorer/eth_rpc.ex @@ -902,7 +902,7 @@ defmodule Explorer.EthRPC do "from" => transaction.from_address_hash, "gasUsed" => encode_quantity(transaction.gas_used), "logs" => Enum.map(transaction.logs, &render_log(&1, transaction)), - 'logsBloom' => "0x" <> (transaction.logs |> BloomFilter.logs_bloom() |> Base.encode16(case: :lower)), + "logsBloom" => "0x" <> (transaction.logs |> BloomFilter.logs_bloom() |> Base.encode16(case: :lower)), "status" => encode_quantity(status), "to" => transaction.to_address_hash, "transactionHash" => transaction.hash, diff --git a/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex b/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex index b3497d8b4c..9bc60675ee 100644 --- a/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex +++ b/apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex @@ -41,7 +41,7 @@ defmodule Explorer.ExchangeRates do # Callback for errored fetch @impl GenServer def handle_info({_ref, {:error, reason}}, state) do - Logger.warn(fn -> "Failed to get exchange rates with reason '#{reason}'." end) + Logger.warning(fn -> "Failed to get exchange rates with reason '#{reason}'." end) schedule_next_consolidation() diff --git a/apps/explorer/lib/explorer/history/process.ex b/apps/explorer/lib/explorer/history/process.ex index bf975a0d46..79731459a3 100644 --- a/apps/explorer/lib/explorer/history/process.ex +++ b/apps/explorer/lib/explorer/history/process.ex @@ -60,7 +60,7 @@ defmodule Explorer.History.Process do @spec failed_compilation(non_neg_integer(), module(), non_neg_integer()) :: any() defp failed_compilation(day_count, historian, failed_attempts) do - Logger.warn(fn -> "Failed to fetch market history. Trying again." end) + Logger.warning(fn -> "Failed to fetch market history. Trying again." end) compile_historical_records(day_count, historian, failed_attempts + 1) end diff --git a/apps/explorer/lib/explorer/market/history/cataloger.ex b/apps/explorer/lib/explorer/market/history/cataloger.ex index 19b0c7bc4f..dc5c4f40e7 100644 --- a/apps/explorer/lib/explorer/market/history/cataloger.ex +++ b/apps/explorer/lib/explorer/market/history/cataloger.ex @@ -119,7 +119,7 @@ defmodule Explorer.Market.History.Cataloger do # Failed to get records. Try again. @impl GenServer def handle_info({_ref, {:price_history, {day_count, failed_attempts, secondary_coin?, :error}}}, state) do - Logger.warn(fn -> "Failed to fetch price history. Trying again." end) + Logger.warning(fn -> "Failed to fetch price history. Trying again." end) fetch_price_history(day_count, secondary_coin?, failed_attempts + 1) @@ -129,7 +129,7 @@ defmodule Explorer.Market.History.Cataloger do # Failed to get records. Try again. @impl GenServer def handle_info({_ref, {:market_cap_history, {day_count, failed_attempts, :error}}}, state) do - Logger.warn(fn -> "Failed to fetch market cap history. Trying again." end) + Logger.warning(fn -> "Failed to fetch market cap history. Trying again." end) fetch_market_cap_history(day_count, failed_attempts + 1) @@ -139,7 +139,7 @@ defmodule Explorer.Market.History.Cataloger do # Failed to get records. Try again. @impl GenServer def handle_info({_ref, {:tvl_history, {day_count, failed_attempts, :error}}}, state) do - Logger.warn(fn -> "Failed to fetch tvl history. Trying again." end) + Logger.warning(fn -> "Failed to fetch tvl history. Trying again." end) fetch_tvl_history(day_count, failed_attempts + 1) diff --git a/apps/explorer/lib/explorer/smart_contract/reader.ex b/apps/explorer/lib/explorer/smart_contract/reader.ex index 804e27ff69..073b17b47d 100644 --- a/apps/explorer/lib/explorer/smart_contract/reader.ex +++ b/apps/explorer/lib/explorer/smart_contract/reader.ex @@ -868,7 +868,7 @@ defmodule Explorer.SmartContract.Reader do result = if String.ends_with?(type, "[]") do value - |> Enum.map(fn tuple -> new_value(%{"type" => String.slice(type, 0..-3)}, [tuple], 0) end) + |> Enum.map(fn tuple -> new_value(%{"type" => String.slice(type, 0..-3//1)}, [tuple], 0) end) |> flat_arrays_map() else value @@ -922,7 +922,7 @@ defmodule Explorer.SmartContract.Reader do def zip_tuple_values_with_types(value, type) do types_string = type - |> String.slice(6..-2) + |> String.slice(6..-2//1) types = if String.trim(types_string) == "" do diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index b63d01c57e..0e9489b067 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -125,7 +125,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do error -> error = parse_error(error) - Logger.warn(["There was an error compiling a provided contract: ", inspect(error)]) + Logger.warning(["There was an error compiling a provided contract: ", inspect(error)]) {:error, [first_error | _]} = error %{"message" => error_message} = first_error {:error, :compilation, error_message} @@ -164,7 +164,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do error -> error = parse_error(error) - Logger.warn(["There was an error compiling a provided contract: ", inspect(error)]) + Logger.warning(["There was an error compiling a provided contract: ", inspect(error)]) {:error, [first_error | _]} = error %{"message" => error_message} = first_error {:error, :compilation, error_message} diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex b/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex index 8eb602ba35..d5e61dc196 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex @@ -444,9 +444,9 @@ defmodule Explorer.SmartContract.Solidity.Verifier do defp extract_meta_from_deployed_bytecode(code_unknown_case) do with true <- is_binary(code_unknown_case), code <- String.downcase(code_unknown_case), - last_2_bytes <- code |> String.slice(-4..-1), + last_2_bytes <- code |> String.slice(-4..-1//1), {meta_length, ""} <- last_2_bytes |> Integer.parse(16), - meta <- String.slice(code, (-(meta_length + 2) * 2)..-5) do + meta <- String.slice(code, (-(meta_length + 2) * 2)..-5//1) do {meta, last_2_bytes} else _ -> diff --git a/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex b/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex index 605a50547e..a7cbb9df85 100644 --- a/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex +++ b/apps/explorer/lib/explorer/third_party_integrations/sourcify.ex @@ -388,13 +388,10 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do end defp prepare_additional_source(address_hash_string, %{"name" => _name, "content" => content, "path" => path}) do - splitted_path = + trimmed_path = path |> String.split("/") - - trimmed_path = - splitted_path - |> Enum.slice(9..Enum.count(splitted_path)) + |> Enum.slice(9..-1) |> Enum.join("/") %{ diff --git a/apps/explorer/lib/explorer/token/metadata_retriever.ex b/apps/explorer/lib/explorer/token/metadata_retriever.ex index 87dcb1d058..8570293f41 100644 --- a/apps/explorer/lib/explorer/token/metadata_retriever.ex +++ b/apps/explorer/lib/explorer/token/metadata_retriever.ex @@ -507,7 +507,7 @@ defmodule Explorer.Token.MetadataRetriever do if error =~ "execution reverted" or error =~ @vm_execution_error do {:error, @vm_execution_error} else - Logger.warn(["Unknown metadata format error #{inspect(error)}."], fetcher: :token_instances) + Logger.warning(["Unknown metadata format error #{inspect(error)}."], fetcher: :token_instances) # truncate error since it will be stored in DB {:error, truncate_error(error)} @@ -520,7 +520,7 @@ defmodule Explorer.Token.MetadataRetriever do ipfs? = true fetch_json_from_uri({:ok, [ipfs_link(result)]}, ipfs?, token_id, hex_token_id, from_base_uri?) else - Logger.warn(["Unknown metadata format result #{inspect(result)}."], fetcher: :token_instances) + Logger.warning(["Unknown metadata format result #{inspect(result)}."], fetcher: :token_instances) {:error, truncate_error(result)} end @@ -575,7 +575,7 @@ defmodule Explorer.Token.MetadataRetriever do end rescue e -> - Logger.warn( + Logger.warning( [ "Unknown metadata format base64 #{inspect(base64_encoded_json)}.", Exception.format(:error, e, __STACKTRACE__) @@ -604,7 +604,7 @@ defmodule Explorer.Token.MetadataRetriever do check_type(json, hex_token_id) rescue e -> - Logger.warn(["Unknown metadata format #{inspect(json)}.", Exception.format(:error, e, __STACKTRACE__)], + Logger.warning(["Unknown metadata format #{inspect(json)}.", Exception.format(:error, e, __STACKTRACE__)], fetcher: :token_instances ) @@ -612,7 +612,7 @@ defmodule Explorer.Token.MetadataRetriever do end defp fetch_json_from_uri(uri, _ipfs?, _token_id, _hex_token_id, _from_base_uri?) do - Logger.warn(["Unknown metadata uri format #{inspect(uri)}."], fetcher: :token_instances) + Logger.warning(["Unknown metadata uri format #{inspect(uri)}."], fetcher: :token_instances) {:error, "unknown metadata uri format"} end @@ -623,7 +623,7 @@ defmodule Explorer.Token.MetadataRetriever do fetch_json_from_uri({:ok, [decoded_json]}, ipfs?, token_id, hex_token_id, from_base_uri?) rescue e -> - Logger.warn(["Unknown metadata format #{inspect(json)}.", Exception.format(:error, e, __STACKTRACE__)], + Logger.warning(["Unknown metadata format #{inspect(json)}.", Exception.format(:error, e, __STACKTRACE__)], fetcher: :token_instances ) @@ -643,7 +643,7 @@ defmodule Explorer.Token.MetadataRetriever do fetch_metadata_from_uri(prepared_uri, ipfs?, hex_token_id) rescue e -> - Logger.warn( + Logger.warning( ["Could not prepare token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], fetcher: :token_instances ) @@ -683,7 +683,7 @@ defmodule Explorer.Token.MetadataRetriever do {:error_code, code} {:error, %Error{reason: reason}} -> - Logger.warn( + Logger.warning( ["Request to token uri failed: #{inspect(uri)}.", inspect(reason)], fetcher: :token_instances ) @@ -692,7 +692,7 @@ defmodule Explorer.Token.MetadataRetriever do end rescue e -> - Logger.warn( + Logger.warning( ["Could not send request to token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], fetcher: :token_instances ) diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs index 976b24dd92..069f9bcb1f 100644 --- a/apps/explorer/mix.exs +++ b/apps/explorer/mix.exs @@ -119,7 +119,8 @@ defmodule Explorer.Mixfile do {:redix, "~> 1.1"}, {:hammer_backend_redis, "~> 6.1"}, {:logger_json, "~> 5.1"}, - {:typed_ecto_schema, "~> 0.4.1", runtime: false} + {:typed_ecto_schema, "~> 0.4.1", runtime: false}, + {:ueberauth, "~> 0.7"} ] end diff --git a/apps/explorer/test/explorer/chain/block_test.exs b/apps/explorer/test/explorer/chain/block_test.exs index 3d09e2c592..932d3441cb 100644 --- a/apps/explorer/test/explorer/chain/block_test.exs +++ b/apps/explorer/test/explorer/chain/block_test.exs @@ -93,7 +93,10 @@ defmodule Explorer.Chain.BlockTest do test "with uncles", %{emission_reward: %{reward: reward, block_range: range}} do block = - build(:block, number: range.from, uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"]) + build(:block, + number: range.from, + uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"] + ) expected_uncle_reward = Wei.div(reward, 32) diff --git a/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs b/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs index 941c73633c..669dfded46 100644 --- a/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs +++ b/apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs @@ -1,5 +1,5 @@ defmodule Explorer.Chain.Cache.GasPriceOracleTest do - use Explorer.DataCase + use Explorer.DataCase, async: false alias Explorer.Chain.Cache.GasPriceOracle alias Explorer.Chain.Wei diff --git a/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs b/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs index ec321eec62..4bfda97853 100644 --- a/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs +++ b/apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs @@ -500,7 +500,7 @@ defmodule Explorer.Chain.SmartContract.ProxyTest do case mode do :full_32 -> "0x000000000000000000000000" <> beacon_contract_address_hash_string :exact_20 -> "0x" <> beacon_contract_address_hash_string - :short -> "0x" <> String.slice(beacon_contract_address_hash_string, 10..-1) + :short -> "0x" <> String.slice(beacon_contract_address_hash_string, 10..-1//1) end EthereumJSONRPC.Mox diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index eca2a97a09..78dd9085d6 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -2333,7 +2333,11 @@ defmodule Explorer.ChainTest do |> insert() |> with_block() - insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number) + insert(:token_transfer, + transaction: transaction, + block: transaction.block, + block_number: transaction.block_number + ) assert [%TokenTransfer{token: %Token{}, transaction: %Transaction{}}] = Chain.transaction_to_token_transfers( @@ -2936,7 +2940,9 @@ defmodule Explorer.ChainTest do decompiled_smart_contracts = Repo.all( - from(ds in DecompiledSmartContract, where: ds.address_hash == ^inserted_decompiled_smart_contract.address_hash) + from(ds in DecompiledSmartContract, + where: ds.address_hash == ^inserted_decompiled_smart_contract.address_hash + ) ) assert Enum.count(decompiled_smart_contracts) == 2 diff --git a/apps/explorer/test/explorer/counters/average_block_time_test.exs b/apps/explorer/test/explorer/counters/average_block_time_test.exs index 3472276d19..e5680774bb 100644 --- a/apps/explorer/test/explorer/counters/average_block_time_test.exs +++ b/apps/explorer/test/explorer/counters/average_block_time_test.exs @@ -36,7 +36,11 @@ defmodule Explorer.Counters.AverageBlockTimeTest do insert(:block, number: block_number, consensus: true, timestamp: Timex.shift(first_timestamp, seconds: -100 - 6)) - insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 12)) + insert(:block, + number: block_number, + consensus: false, + timestamp: Timex.shift(first_timestamp, seconds: -100 - 12) + ) insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 9)) diff --git a/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs b/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs index b990295698..136e5ffce0 100644 --- a/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs +++ b/apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs @@ -143,7 +143,7 @@ defmodule Explorer.ExchangeRates.Source.CoinGeckoTest do Application.put_env(:explorer, CoinGecko, base_url: "http://localhost:#{bypass.port}") on_exit(fn -> - Application.put_env(:explorer, :coin, "POA") + Application.put_env(:explorer, :coin, "ETH") end) {:ok, bypass: bypass} diff --git a/apps/explorer/test/explorer/market/history/cataloger_test.exs b/apps/explorer/test/explorer/market/history/cataloger_test.exs index 9dd20de55d..040033b702 100644 --- a/apps/explorer/test/explorer/market/history/cataloger_test.exs +++ b/apps/explorer/test/explorer/market/history/cataloger_test.exs @@ -2,6 +2,7 @@ defmodule Explorer.Market.History.CatalogerTest do use Explorer.DataCase, async: false import Mox + import Ecto.Query, only: [order_by: 2] alias Explorer.Market.MarketHistory alias Explorer.Market.History.Cataloger @@ -221,7 +222,7 @@ defmodule Explorer.Market.History.CatalogerTest do %Explorer.Market.MarketHistory{ date: ~D[2018-04-02] } = second_entry - ] = MarketHistory |> Repo.all() + ] = MarketHistory |> order_by(asc: :date) |> Repo.all() assert Decimal.eq?(first_entry.closing_price, Decimal.new(10)) assert Decimal.eq?(second_entry.closing_price, Decimal.new(20)) diff --git a/apps/explorer/test/explorer/market/market_test.exs b/apps/explorer/test/explorer/market/market_test.exs index 44342b3996..c4f6fbef48 100644 --- a/apps/explorer/test/explorer/market/market_test.exs +++ b/apps/explorer/test/explorer/market/market_test.exs @@ -18,6 +18,8 @@ defmodule Explorer.MarketTest do end test "fetch_recent_history/1" do + ConCache.delete(:market_history, :last_update) + today = Date.utc_today() records = diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index 85c12f4d0f..dc51dce76a 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -236,7 +236,7 @@ defmodule Indexer.Block.Realtime.Fetcher do end def import(_, _) do - Logger.warn("Empty parameters were provided for realtime fetcher") + Logger.warning("Empty parameters were provided for realtime fetcher") {:ok, []} end diff --git a/apps/indexer/lib/indexer/buffered_task.ex b/apps/indexer/lib/indexer/buffered_task.ex index bf6a9dfc82..3c9095d2cb 100644 --- a/apps/indexer/lib/indexer/buffered_task.ex +++ b/apps/indexer/lib/indexer/buffered_task.ex @@ -438,7 +438,7 @@ defmodule Indexer.BufferedTask do new_bound_queue {%BoundQueue{maximum_size: maximum_size} = new_bound_queue, remaining_entries} -> - Logger.warn(fn -> + Logger.warning(fn -> [ "BufferedTask ", process(self()), diff --git a/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex b/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex index b9f7e625ee..e082020e02 100644 --- a/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex +++ b/apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex @@ -195,7 +195,7 @@ defmodule Indexer.Fetcher.OnDemand.TokenBalance do end defp prepare_updated_balance({{:error, error}, ctb}, block_number) do - Logger.warn(fn -> + Logger.warning(fn -> [ "Error on updating current token #{to_string(ctb.token_contract_address_hash)} balance for address #{to_string(ctb.address_hash)} at block number #{block_number}: ", inspect(error) diff --git a/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex index 23f386b976..5067e601ab 100644 --- a/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex +++ b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex @@ -290,7 +290,7 @@ defmodule Indexer.Fetcher.TokenInstance.Helper do rescue error in Postgrex.Error -> if retrying? do - Logger.warn( + Logger.warning( [ "Failed to upsert token instance: {#{to_string(token_contract_address_hash)}, #{token_id}}, error: #{inspect(error)}" ], diff --git a/apps/indexer/lib/indexer/fetcher/transaction_action.ex b/apps/indexer/lib/indexer/fetcher/transaction_action.ex index ac851b3999..46dda6639e 100644 --- a/apps/indexer/lib/indexer/fetcher/transaction_action.ex +++ b/apps/indexer/lib/indexer/fetcher/transaction_action.ex @@ -263,7 +263,7 @@ defmodule Indexer.Fetcher.TransactionAction do end if next_block < first_block do - Logger.warn( + Logger.warning( "It seems #{__MODULE__} already finished work for the block range #{first_block}..#{last_block} and " <> if(Enum.empty?(protocols), do: "all supported protocols.", diff --git a/apps/indexer/lib/indexer/fetcher/withdrawal.ex b/apps/indexer/lib/indexer/fetcher/withdrawal.ex index eb700cd2ba..fc4924aaf7 100644 --- a/apps/indexer/lib/indexer/fetcher/withdrawal.ex +++ b/apps/indexer/lib/indexer/fetcher/withdrawal.ex @@ -67,7 +67,7 @@ defmodule Indexer.Fetcher.Withdrawal do {:ok, state} else - Logger.warn("Please, specify the first block of the block range for #{__MODULE__}.") + Logger.warning("Please, specify the first block of the block range for #{__MODULE__}.") :ignore end end diff --git a/apps/indexer/lib/indexer/memory/monitor.ex b/apps/indexer/lib/indexer/memory/monitor.ex index 121cd6496a..6fefce04a1 100644 --- a/apps/indexer/lib/indexer/memory/monitor.ex +++ b/apps/indexer/lib/indexer/memory/monitor.ex @@ -112,7 +112,7 @@ defmodule Indexer.Memory.Monitor do end defp log_memory(%{total: total, limit: limit}) do - Logger.warn(fn -> + Logger.warning(fn -> [ to_string(total), " / ", @@ -158,7 +158,7 @@ defmodule Indexer.Memory.Monitor do end defp shrink([{pid, memory} | tail]) do - Logger.warn(fn -> + Logger.warning(fn -> [ "Worst memory usage (", to_string(memory), diff --git a/apps/indexer/lib/indexer/transform/transaction_actions.ex b/apps/indexer/lib/indexer/transform/transaction_actions.ex index 9d525469b6..e2b951ffae 100644 --- a/apps/indexer/lib/indexer/transform/transaction_actions.ex +++ b/apps/indexer/lib/indexer/transform/transaction_actions.ex @@ -544,10 +544,10 @@ defmodule Indexer.Transform.TransactionActions do defp uniswap_handle_swap_amounts(log, amount0, amount1, symbol0, symbol1, address0, address1) do cond do String.first(amount0) === "-" and String.first(amount1) !== "-" -> - {amount1, symbol1, address1, String.slice(amount0, 1, String.length(amount0) - 1), symbol0, address0, false} + {amount1, symbol1, address1, String.slice(amount0, 1..-1//1), symbol0, address0, false} String.first(amount1) === "-" and String.first(amount0) !== "-" -> - {amount0, symbol0, address0, String.slice(amount1, 1, String.length(amount1) - 1), symbol1, address1, false} + {amount0, symbol0, address0, String.slice(amount1, 1..-1//1), symbol1, address1, false} amount1 === "0" and String.first(amount0) !== "-" -> {amount0, symbol0, address0, amount1, symbol1, address1, false} diff --git a/apps/indexer/test/indexer/buffered_task_test.exs b/apps/indexer/test/indexer/buffered_task_test.exs index 5c996cbf12..9dc3a7d2de 100644 --- a/apps/indexer/test/indexer/buffered_task_test.exs +++ b/apps/indexer/test/indexer/buffered_task_test.exs @@ -243,7 +243,8 @@ defmodule Indexer.BufferedTaskTest do flush_timer: nil, task_supervisor: BufferedTaskSup, max_batch_size: 1, - max_concurrency: 1 + max_concurrency: 1, + poll: false }) refute flush_timer == nil diff --git a/docker/Dockerfile b/docker/Dockerfile index ee2b67d289..3431a7182c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM hexpm/elixir:1.14.5-erlang-24.2.2-alpine-3.18.2 AS builder +FROM hexpm/elixir:1.16.3-erlang-26.2.5.1-alpine-3.18.7 AS builder WORKDIR /app @@ -68,7 +68,7 @@ RUN mkdir -p /opt/release \ && mv _build/${MIX_ENV}/rel/blockscout /opt/release ############################################################## -FROM hexpm/elixir:1.14.5-erlang-24.2.2-alpine-3.18.2 +FROM hexpm/elixir:1.16.3-erlang-26.2.5.1-alpine-3.18.7 ARG RELEASE_VERSION ENV RELEASE_VERSION=${RELEASE_VERSION} diff --git a/mix.lock b/mix.lock index 343e3ad248..1bfd4eae8b 100644 --- a/mix.lock +++ b/mix.lock @@ -115,7 +115,7 @@ "prometheus_ex": {:git, "https://github.com/lanodan/prometheus.ex", "31f7fbe4b71b79ba27efc2a5085746c4011ceb8f", [branch: "fix/elixir-1.14"]}, "prometheus_phoenix": {:hex, :prometheus_phoenix, "1.3.0", "c4b527e0b3a9ef1af26bdcfbfad3998f37795b9185d475ca610fe4388fdd3bb5", [:mix], [{:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.3 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "c4d1404ac4e9d3d963da601db2a7d8ea31194f0017057fabf0cfb9bf5a6c8c75"}, "prometheus_plugs": {:hex, :prometheus_plugs, "1.1.5", "25933d48f8af3a5941dd7b621c889749894d8a1082a6ff7c67cc99dec26377c5", [:mix], [{:accept, "~> 0.1", [hex: :accept, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}, {:prometheus_process_collector, "~> 1.1", [hex: :prometheus_process_collector, repo: "hexpm", optional: true]}], "hexpm", "0273a6483ccb936d79ca19b0ab629aef0dba958697c94782bb728b920dfc6a79"}, - "prometheus_process_collector": {:hex, :prometheus_process_collector, "1.6.0", "b169e224337497cd858da16f9361edabc5931b9d12201a97ee15d88ef5a6fcaa", [:rebar3], [{:prometheus, "~> 4.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "e9cd9846f204de7a04863f56308d8d1193bec714210bf6374d9d4fc088d2896d"}, + "prometheus_process_collector": {:git, "https://github.com/Phybbit/prometheus_process_collector.git", "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f", [ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f"]}, "qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm", "a266b7fb7be0d3b713912055dde3575927eca920e5d604ded45cd534f6b7a447"}, "quantile_estimator": {:hex, :quantile_estimator, "0.2.1", "ef50a361f11b5f26b5f16d0696e46a9e4661756492c981f7b2229ef42ff1cd15", [:rebar3], [], "hexpm", "282a8a323ca2a845c9e6f787d166348f776c1d4a41ede63046d72d422e3da946"}, "que": {:hex, :que, "0.10.1", "788ed0ec92ed69bdf9cfb29bf41a94ca6355b8d44959bd0669cf706e557ac891", [:mix], [{:ex_utils, "~> 0.1.6", [hex: :ex_utils, repo: "hexpm", optional: false]}, {:memento, "~> 0.3.0", [hex: :memento, repo: "hexpm", optional: false]}], "hexpm", "a737b365253e75dbd24b2d51acc1d851049e87baae08cd0c94e2bc5cd65088d5"},