chore: bump elixir to 1.16.3 and Erlang OTP to 26.2.5.1 (#9256)

* feat: bump elixir to 1.16.0

* fix: failing tests

* fix: one more test

* fix: qemu arm build

* fix: failing market test

* fix: override version in ci

* chore: bump to 1.16.1

* fix: ci config override

* chore: bump to 1.16.3

* chore: mix format

* fix: faulty explorer tests

* fix: faulty block_scout_web tests

* chore: lint

* ci: remove arm build workaround

* chore: fix negative slice warnings

* Erlang 26.2.5.1

---------

Co-authored-by: Viktor Baranov <baranov.viktor.27@gmail.com>
pull/6801/merge
Kirill Fedoseev 5 months ago committed by GitHub
parent 18c0a61c34
commit 7fe5bb98de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.yml
  2. 4
      .github/workflows/config.yml
  3. 4
      .tool-versions
  4. 2
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex
  5. 2
      apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex
  6. 4
      apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex
  7. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex
  8. 6
      apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex
  9. 2
      apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex
  10. 4
      apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex
  11. 2
      apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex
  12. 4
      apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex
  13. 2
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  14. 7
      apps/block_scout_web/mix.exs
  15. 2
      apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs
  16. 28
      apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs
  17. 7
      apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs
  18. 12
      apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs
  19. 8
      apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs
  20. 5
      apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs
  21. 4
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex
  22. 9
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex
  23. 2
      apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs
  24. 3
      apps/explorer/lib/explorer/account/custom_abi.ex
  25. 3
      apps/explorer/lib/explorer/account/identity.ex
  26. 9
      apps/explorer/lib/explorer/account/notifier/email.ex
  27. 3
      apps/explorer/lib/explorer/account/tag_address.ex
  28. 3
      apps/explorer/lib/explorer/account/tag_transaction.ex
  29. 3
      apps/explorer/lib/explorer/account/watchlist_address.ex
  30. 9
      apps/explorer/lib/explorer/account/watchlist_notification.ex
  31. 4
      apps/explorer/lib/explorer/chain.ex
  32. 4
      apps/explorer/lib/explorer/chain/address.ex
  33. 4
      apps/explorer/lib/explorer/chain/address/counters.ex
  34. 2
      apps/explorer/lib/explorer/chain/hash.ex
  35. 2
      apps/explorer/lib/explorer/chain/log.ex
  36. 4
      apps/explorer/lib/explorer/chain/mud.ex
  37. 2
      apps/explorer/lib/explorer/chain/smart_contract.ex
  38. 4
      apps/explorer/lib/explorer/chain/smart_contract/audit_report.ex
  39. 5
      apps/explorer/lib/explorer/chain/stability/validator.ex
  40. 4
      apps/explorer/lib/explorer/chain/transaction.ex
  41. 8
      apps/explorer/lib/explorer/chain_spec/genesis_data.ex
  42. 2
      apps/explorer/lib/explorer/chain_spec/geth/importer.ex
  43. 4
      apps/explorer/lib/explorer/chain_spec/parity/importer.ex
  44. 2
      apps/explorer/lib/explorer/chain_spec/poa/importer.ex
  45. 2
      apps/explorer/lib/explorer/eth_rpc.ex
  46. 2
      apps/explorer/lib/explorer/exchange_rates/exchange_rates.ex
  47. 2
      apps/explorer/lib/explorer/history/process.ex
  48. 6
      apps/explorer/lib/explorer/market/history/cataloger.ex
  49. 4
      apps/explorer/lib/explorer/smart_contract/reader.ex
  50. 4
      apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex
  51. 4
      apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex
  52. 7
      apps/explorer/lib/explorer/third_party_integrations/sourcify.ex
  53. 18
      apps/explorer/lib/explorer/token/metadata_retriever.ex
  54. 3
      apps/explorer/mix.exs
  55. 5
      apps/explorer/test/explorer/chain/block_test.exs
  56. 2
      apps/explorer/test/explorer/chain/cache/gas_price_oracle_test.exs
  57. 2
      apps/explorer/test/explorer/chain/smart_contract/proxy_test.exs
  58. 10
      apps/explorer/test/explorer/chain_test.exs
  59. 6
      apps/explorer/test/explorer/counters/average_block_time_test.exs
  60. 2
      apps/explorer/test/explorer/exchange_rates/source/coin_gecko_test.exs
  61. 3
      apps/explorer/test/explorer/market/history/cataloger_test.exs
  62. 2
      apps/explorer/test/explorer/market/market_test.exs
  63. 2
      apps/indexer/lib/indexer/block/realtime/fetcher.ex
  64. 2
      apps/indexer/lib/indexer/buffered_task.ex
  65. 2
      apps/indexer/lib/indexer/fetcher/on_demand/token_balance.ex
  66. 2
      apps/indexer/lib/indexer/fetcher/token_instance/helper.ex
  67. 2
      apps/indexer/lib/indexer/fetcher/transaction_action.ex
  68. 2
      apps/indexer/lib/indexer/fetcher/withdrawal.ex
  69. 4
      apps/indexer/lib/indexer/memory/monitor.ex
  70. 4
      apps/indexer/lib/indexer/transform/transaction_actions.ex
  71. 3
      apps/indexer/test/indexer/buffered_task_test.exs
  72. 4
      docker/Dockerfile
  73. 2
      mix.lock

@ -81,7 +81,7 @@ body:
attributes: attributes:
label: Elixir & Erlang/OTP versions label: Elixir & Erlang/OTP versions
description: 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: validations:
required: true required: true

@ -32,8 +32,8 @@ on:
env: env:
MIX_ENV: test MIX_ENV: test
OTP_VERSION: ${{ vars.OTP_VERSION || '25.3.2.8' }} OTP_VERSION: ${{ github.ref_name == '9256/merge' && '26.2.5.1' || vars.OTP_VERSION }}
ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION || '1.14.5' }} ELIXIR_VERSION: ${{ github.ref_name == '9256/merge' && '1.16.3' || vars.ELIXIR_VERSION }}
ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com" ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com"
jobs: jobs:

@ -1,3 +1,3 @@
elixir 1.14.5-otp-25 elixir 1.16.3-otp-26
erlang 25.3.2.8 erlang 26.2.5.1
nodejs 18.17.1 nodejs 18.17.1

@ -42,7 +42,7 @@ defmodule BlockScoutWeb.API.V2.ImportController do
|> render(:message, %{message: "Success"}) |> render(:message, %{message: "Success"})
error -> error ->
Logger.warn(fn -> ["Error on importing token info: ", inspect(error)] end) Logger.warning(fn -> ["Error on importing token info: ", inspect(error)] end)
conn conn
|> put_view(ApiView) |> put_view(ApiView)

@ -117,7 +117,7 @@ defmodule BlockScoutWeb.Models.UserFromAuth do
# default case if nothing matches # default case if nothing matches
defp avatar_from_auth(auth) do 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)) Logger.debug(Poison.encode!(auth))
nil nil
end end

@ -4,7 +4,7 @@
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %> <%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
<div class="new-smart-contract-form"> <div class="new-smart-contract-form">
<h1 class="smart-contract-title"><%= if RustVerifierInterface.enabled?(), do: gettext "New Solidity/Yul Smart Contract Verification", else: gettext "New Solidity Smart Contract Verification" %></h1> <h1 class="smart-contract-title"><%= if RustVerifierInterface.enabled?(), do: gettext("New Solidity/Yul Smart Contract Verification"), else: gettext("New Solidity Smart Contract Verification") %></h1>
<%= form_for changeset, <%= form_for changeset,
address_contract_verification_path(@conn, :create), address_contract_verification_path(@conn, :create),
@ -69,7 +69,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="smart-contract-form-group-tooltip"><%= 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." %></div> <div class="smart-contract-form-group-tooltip"><%= 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.") %></div>
</div> </div>
<div class="add-contract-libraries-wrapper"> <div class="add-contract-libraries-wrapper">

@ -11,7 +11,7 @@
<div class="card-body" data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-listing="<%= @current_path %>">
<h1 class="card-title list-title-description"><%= gettext "Validated Transactions" %></h1> <h1 class="card-title list-title-description"><%= gettext "Validated Transactions" %></h1>
<div class="list-top-pagination-container-wrapper"> <div class="list-top-pagination-container-wrapper">
<%= 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) %>
</div> </div>
<div data-selector="channel-batching-message" class="d-none"> <div data-selector="channel-batching-message" class="d-none">

@ -20,7 +20,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
do_value_html(decoded_type, value, no_links) do_value_html(decoded_type, value, no_links)
rescue rescue
exception -> exception ->
Logger.warn(fn -> Logger.warning(fn ->
["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] ["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
end) end)
@ -33,7 +33,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
do_value_json(decoded_type, value) do_value_json(decoded_type, value)
rescue rescue
exception -> exception ->
Logger.warn(fn -> Logger.warning(fn ->
["Error determining value json for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] ["Error determining value json for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
end) end)
@ -46,7 +46,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
do_copy_text(decoded_type, value) do_copy_text(decoded_type, value)
rescue rescue
exception -> exception ->
Logger.warn(fn -> Logger.warning(fn ->
["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)] ["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
end) end)

@ -266,7 +266,7 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do
|> Enum.reduce("", fn p, a -> |> Enum.reduce("", fn p, a ->
a <> new_style <> p <> "</span>\n" a <> new_style <> p <> "</span>\n"
end) end)
|> String.slice(0..-2) |> String.slice(0..-2//1)
end end
end end
end end

@ -301,7 +301,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do
result result
rescue rescue
exception -> exception ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Error formatting constructor arguments for abi: #{inspect(abi)}, args: #{inspect(constructor_arguments)}: ", "Error formatting constructor arguments for abi: #{inspect(abi)}, args: #{inspect(constructor_arguments)}: ",
Exception.format(:error, exception) Exception.format(:error, exception)
@ -382,7 +382,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do
tuple_item_types = tuple_item_types =
rest rest
|> String.split("]") |> String.split("]")
|> Enum.slice(0..-3) |> Enum.slice(0..-3//1)
|> Enum.join("]") |> Enum.join("]")
array_str = "[" <> (rest |> String.split("[") |> List.last()) array_str = "[" <> (rest |> String.split("[") |> List.last())

@ -81,7 +81,7 @@ defmodule BlockScoutWeb.NFTHelper do
end end
defp ipfs_link(image_url, prefix) do 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 "https://ipfs.io/ipfs/" <> ipfs_uid
end end

@ -56,7 +56,7 @@ defmodule BlockScoutWeb.SmartContractView do
String.starts_with?(type, "tuple") -> String.starts_with?(type, "tuple") ->
tuple_types = tuple_types =
type type
|> String.slice(0..-3) |> String.slice(0..-3//1)
|> supplement_type_with_components(components) |> supplement_type_with_components(components)
values = values =
@ -132,7 +132,7 @@ defmodule BlockScoutWeb.SmartContractView do
to_string(address) 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)" "(decoding error)"
end end
end end

@ -597,7 +597,7 @@ defmodule BlockScoutWeb.TransactionView do
end end
def trim(length, string) do 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 end
defp template_to_string(template) when is_list(template) do defp template_to_string(template) when is_list(template) do

@ -135,8 +135,11 @@ defmodule BlockScoutWeb.Mixfile do
{:prometheus_phoenix, "~> 1.2"}, {:prometheus_phoenix, "~> 1.2"},
# Expose metrics from URL Prometheus server can scrape # Expose metrics from URL Prometheus server can scrape
{:prometheus_plugs, "~> 1.1"}, {:prometheus_plugs, "~> 1.1"},
# OS process metrics for Prometheus # OS process metrics for Prometheus, custom ref to include https://github.com/deadtrickster/prometheus_process_collector/pull/30
{:prometheus_process_collector, "~> 1.3"}, {:prometheus_process_collector,
git: "https://github.com/Phybbit/prometheus_process_collector.git",
ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f",
override: true},
{:remote_ip, "~> 1.0"}, {:remote_ip, "~> 1.0"},
{:qrcode, "~> 0.1.0"}, {:qrcode, "~> 0.1.0"},
{:sobelow, ">= 0.7.0", only: [:dev, :test], runtime: false}, {:sobelow, ">= 0.7.0", only: [:dev, :test], runtime: false},

@ -207,11 +207,9 @@ defmodule BlockScoutWeb.AddressTokenTransferControllerTest do
:index, :index,
Address.checksum(address.hash), Address.checksum(address.hash),
Address.checksum(token.contract_address_hash), Address.checksum(token.contract_address_hash),
%{
block_number: page_last_transfer.block_number, block_number: page_last_transfer.block_number,
index: page_last_transfer.index, index: page_last_transfer.index,
items_count: "50" items_count: "50"
}
) )
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path assert Map.get(json_response(conn, 200), "next_page_path") == expected_path

@ -876,7 +876,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
for _ <- 0..50 do for _ <- 0..50 do
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() 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, insert(:token_transfer,
transaction: tx, transaction: tx,
@ -941,7 +946,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
for _ <- 0..50 do for _ <- 0..50 do
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() 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 end
request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers") request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers")
@ -986,7 +996,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
for _ <- 0..50 do for _ <- 0..50 do
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() 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 end
for _ <- 0..50 do for _ <- 0..50 do
@ -1013,7 +1028,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
for _ <- 0..49 do for _ <- 0..49 do
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block() 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 end
tt_to = tt_to =

@ -98,12 +98,7 @@ defmodule BlockScoutWeb.BlockControllerTest do
conn = get(conn, blocks_path(conn, :index), %{"type" => "JSON"}) conn = get(conn, blocks_path(conn, :index), %{"type" => "JSON"})
expected_path = expected_path = blocks_path(conn, :index, block_number: number, block_type: "Block", items_count: "50")
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 assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
end end

@ -53,9 +53,17 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do
test "includes token transfers for the transaction", %{conn: conn} do test "includes token transfers for the transaction", %{conn: conn} do
transaction = insert(:transaction) |> with_block() 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) path = transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash)

@ -63,12 +63,12 @@ defmodule BlockScoutWeb.VerifiedContractsControllerTest do
conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"}) conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"})
expected_path = expected_path =
verified_contracts_path(conn, :index, %{ verified_contracts_path(conn, :index,
smart_contract_id: id,
items_count: "50",
coin_balance: nil, coin_balance: nil,
items_count: "50",
smart_contract_id: id,
tx_count: nil tx_count: nil
}) )
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
end end

@ -41,10 +41,7 @@ defmodule BlockScoutWeb.WithdrawalControllerTest do
conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"}) conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"})
expected_path = expected_path =
withdrawal_path(conn, :index, %{ withdrawal_path(conn, :index, index: index, items_count: "50")
index: index,
items_count: "50"
})
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
end end

@ -101,7 +101,7 @@ defmodule EthereumJSONRPC.Encoder do
decoded_data = decoded_data =
result result
|> String.slice(2..-1) |> String.slice(2..-1//1)
|> Base.decode16!(case: :lower) |> Base.decode16!(case: :lower)
|> TypeDecoder.decode_raw(types_list) |> TypeDecoder.decode_raw(types_list)
|> Enum.zip(types_list) |> Enum.zip(types_list)
@ -120,7 +120,7 @@ defmodule EthereumJSONRPC.Encoder do
def unescape(data) do def unescape(data) do
if String.starts_with?(data, "\\x") do if String.starts_with?(data, "\\x") do
charlist = String.to_charlist(data) charlist = String.to_charlist(data)
erlang_literal = '"#{charlist}"' erlang_literal = ~c"\"#{charlist}\""
{:ok, [{:string, _, unescaped_charlist}], _} = :erl_scan.string(erlang_literal) {:ok, [{:string, _, unescaped_charlist}], _} = :erl_scan.string(erlang_literal)
List.to_string(unescaped_charlist) List.to_string(unescaped_charlist)
else else

@ -100,14 +100,9 @@ defmodule EthereumJSONRPC.Variant do
variant = System.get_env("ETHEREUM_JSONRPC_VARIANT", default_variant) variant = System.get_env("ETHEREUM_JSONRPC_VARIANT", default_variant)
cond do if variant == "parity" do
is_nil(variant) ->
"nethermind" "nethermind"
else
variant == "parity" ->
"nethermind"
true ->
variant variant
|> String.split(".") |> String.split(".")
|> List.last() |> List.last()

@ -15,7 +15,7 @@ defmodule EthereumJSONRPC.ReceiptTest do
%{"new_key" => "new_value", "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"} %{"new_key" => "new_value", "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"}
Errors: Errors:
{:unknown_key, %{key: "new_key", value: "new_value"}} {:unknown_key, %{value: "new_value", key: "new_key"}}
""", """,
fn -> fn ->
Receipt.to_elixir(%{ Receipt.to_elixir(%{

@ -50,8 +50,9 @@ defmodule Explorer.Account.CustomABI do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset 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 end
defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do

@ -36,7 +36,8 @@ defmodule Explorer.Account.Identity do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset changeset
|> put_change(:uid_hash, get_field(changeset, :uid)) |> force_change(:uid_hash, get_field(changeset, :uid))
end end
end end

@ -5,7 +5,6 @@ defmodule Explorer.Account.Notifier.Email do
require Logger require Logger
alias BlockScoutWeb.Routers.WebRouter.Helpers
alias Explorer.Account.{Identity, Watchlist, WatchlistAddress, WatchlistNotification} alias Explorer.Account.{Identity, Watchlist, WatchlistAddress, WatchlistNotification}
alias Explorer.Repo alias Explorer.Repo
@ -121,15 +120,15 @@ defmodule Explorer.Account.Notifier.Email do
end end
defp address_url(address_hash) do defp address_url(address_hash) do
Helpers.address_url(uri(), :show, address_hash) uri() |> URI.append_path("/address/#{address_hash}") |> to_string()
end end
defp block_url(notification) do 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 end
defp transaction_url(notification) do defp transaction_url(notification) do
Helpers.transaction_url(uri(), :show, notification.transaction_hash) uri() |> URI.append_path("/tx/#{notification.transaction_hash}") |> to_string()
end end
defp url_params do defp url_params do
@ -156,7 +155,7 @@ defmodule Explorer.Account.Notifier.Email do
raw_path = url_params()[:path] raw_path = url_params()[:path]
if raw_path |> String.ends_with?("/") do if raw_path |> String.ends_with?("/") do
raw_path |> String.slice(0..-2) raw_path |> String.slice(0..-2//1)
else else
raw_path raw_path
end end

@ -50,8 +50,9 @@ defmodule Explorer.Account.TagAddress do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset 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 end
defp check_existence_or_create_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do defp check_existence_or_create_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do

@ -48,8 +48,9 @@ defmodule Explorer.Account.TagTransaction do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset 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 end
defp check_transaction_existence(%Changeset{changes: %{tx_hash: tx_hash}} = changeset) do defp check_transaction_existence(%Changeset{changes: %{tx_hash: tx_hash}} = changeset) do

@ -68,8 +68,9 @@ defmodule Explorer.Account.WatchlistAddress do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset 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 end
def create(attrs) do def create(attrs) do

@ -58,11 +58,12 @@ defmodule Explorer.Account.WatchlistNotification do
end end
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset changeset
|> put_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash))) |> force_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))) |> force_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))) |> force_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash)))
|> put_change(:subject_hash, get_field(changeset, :subject)) |> force_change(:subject_hash, get_field(changeset, :subject))
end end
@doc """ @doc """

@ -5257,11 +5257,11 @@ defmodule Explorer.Chain do
result result
{:exit, reason} -> {:exit, reason} ->
Logger.warn("Query fetching token counters terminated: #{inspect(reason)}") Logger.warning("Query fetching token counters terminated: #{inspect(reason)}")
0 0
nil -> nil ->
Logger.warn("Query fetching token counters timed out.") Logger.warning("Query fetching token counters timed out.")
0 0
end end
end) end)

@ -192,7 +192,7 @@ defmodule Explorer.Chain.Address do
|> stream_binary() |> stream_binary()
|> Stream.zip(match_byte_stream) |> Stream.zip(match_byte_stream)
|> Enum.map(fn |> Enum.map(fn
{digit, _} when digit in '0123456789' -> {digit, _} when digit in ~c"0123456789" ->
digit digit
{alpha, 1} -> {alpha, 1} ->
@ -220,7 +220,7 @@ defmodule Explorer.Chain.Address do
|> stream_binary() |> stream_binary()
|> Stream.zip(match_byte_stream) |> Stream.zip(match_byte_stream)
|> Enum.map(fn |> Enum.map(fn
{digit, _} when digit in '0123456789' -> {digit, _} when digit in ~c"0123456789" ->
digit digit
{alpha, 1} -> {alpha, 1} ->

@ -490,7 +490,7 @@ defmodule Explorer.Chain.Address.Counters do
Map.put(acc, type, counter) Map.put(acc, type, counter)
{:exit, reason} -> {:exit, reason} ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Query fetching address counters for #{address_hash} terminated: #{inspect(reason)}" "Query fetching address counters for #{address_hash} terminated: #{inspect(reason)}"
] ]
@ -499,7 +499,7 @@ defmodule Explorer.Chain.Address.Counters do
acc acc
nil -> nil ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Query fetching address counters for #{address_hash} timed out." "Query fetching address counters for #{address_hash} timed out."
] ]

@ -153,7 +153,7 @@ defmodule Explorer.Chain.Hash do
def to_iodata(%__MODULE__{byte_count: byte_count} = hash) do def to_iodata(%__MODULE__{byte_count: byte_count} = hash) do
integer = to_integer(hash) integer = to_integer(hash)
hexadecimal_digit_count = byte_count_to_hexadecimal_digit_count(byte_count) 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] ["0x", unprefixed]
end end

@ -237,7 +237,7 @@ defmodule Explorer.Chain.Log do
end end
rescue rescue
e -> e ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Could not decode input data for log from transaction hash: ", "Could not decode input data for log from transaction hash: ",
Hash.to_iodata(transaction_hash), Hash.to_iodata(transaction_hash),

@ -30,7 +30,9 @@ defmodule Explorer.Chain.Mud do
@schema_prefix "mud" @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 # https://github.com/latticexyz/mud/blob/cc4f4246e52982354e398113c46442910f9b04bb/packages/store/src/codegen/tables/Tables.sol#L34-L42
@store_tables_table_schema %Schema{ @store_tables_table_schema %Schema{

@ -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(%{"message" => string} = error) when is_map(error), do: error_message_with_log(string)
defp error_message(error) do 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." "There was an error validating your contract, please try again."
end end

@ -58,7 +58,9 @@ defmodule Explorer.Chain.SmartContract.AuditReport do
|> cast(attrs, @optional_fields ++ @required_fields) |> cast(attrs, @optional_fields ++ @required_fields)
|> validate_required(@required_fields, message: "Required") |> validate_required(@required_fields, message: "Required")
|> validate_length(:submitter_email, max: @max_string_length) |> 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_format(:submitter_name, ~r/[a-zA-Z ]+/i, message: "only letters are allowed")
|> validate_length(:submitter_name, max: @max_string_length) |> validate_length(:submitter_name, max: @max_string_length)
|> validate_length(:project_name, max: @max_string_length) |> validate_length(:project_name, max: @max_string_length)

@ -145,7 +145,7 @@ defmodule Explorer.Chain.Stability.Validator do
%{active: active_validators_list, all: validators_list} %{active: active_validators_list, all: validators_list}
error -> error ->
Logger.warn(fn -> ["Error on getting validator lists: #{inspect(error)}"] end) Logger.warning(fn -> ["Error on getting validator lists: #{inspect(error)}"] end)
nil nil
end end
end end
@ -164,7 +164,8 @@ defmodule Explorer.Chain.Stability.Validator do
result = result =
case format_missing_blocks_result(response) do case format_missing_blocks_result(response) do
{:error, message} -> {: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 nil
amount -> amount ->

@ -992,7 +992,7 @@ defmodule Explorer.Chain.Transaction do
end end
rescue rescue
e -> e ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Could not decode input data for transaction: ", "Could not decode input data for transaction: ",
Hash.to_iodata(hash), Hash.to_iodata(hash),
@ -1022,7 +1022,7 @@ defmodule Explorer.Chain.Transaction do
{:ok, mapping} {:ok, mapping}
rescue rescue
e -> e ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Could not decode input data for transaction: ", "Could not decode input data for transaction: ",
Hash.to_iodata(hash), Hash.to_iodata(hash),

@ -33,7 +33,7 @@ defmodule Explorer.ChainSpec.GenesisData do
# Callback for errored fetch # Callback for errored fetch
@impl GenServer @impl GenServer
def handle_info({_ref, {:error, reason}}, state) do 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() fetch_genesis_data()
@ -90,7 +90,9 @@ defmodule Explorer.ChainSpec.GenesisData do
Logger.info(fn -> "Fetching precompiled config path: #{inspect(precompiled_config_path)}." end) 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 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 else
json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments) json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments)
variant = Keyword.fetch!(json_rpc_named_arguments, :variant) variant = Keyword.fetch!(json_rpc_named_arguments, :variant)
@ -143,7 +145,7 @@ defmodule Explorer.ChainSpec.GenesisData do
{:error, reason} -> {:error, reason} ->
# credo:disable-for-next-line Credo.Check.Refactor.Nesting # 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 nil
end end
else else

@ -119,7 +119,7 @@ defmodule Explorer.ChainSpec.Geth.Importer do
if accounts do if accounts do
parse_accounts(accounts) parse_accounts(accounts)
else else
Logger.warn(fn -> "No accounts are defined in genesis" end) Logger.warning(fn -> "No accounts are defined in genesis" end)
[] []
end end

@ -98,7 +98,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do
if accounts do if accounts do
parse_accounts(accounts) parse_accounts(accounts)
else else
Logger.warn(fn -> "No accounts are defined in chain spec" end) Logger.warning(fn -> "No accounts are defined in chain spec" end)
[] []
end end
@ -112,7 +112,7 @@ defmodule Explorer.ChainSpec.Parity.Importer do
|> parse_hex_numbers() |> parse_hex_numbers()
|> format_ranges() |> format_ranges()
else else
Logger.warn(fn -> "No rewards are defined in chain spec" end) Logger.warning(fn -> "No rewards are defined in chain spec" end)
[] []
end end

@ -39,7 +39,7 @@ defmodule Explorer.ChainSpec.POA.Importer do
def import_emission_rewards do def import_emission_rewards do
if is_nil(rewards_contract_address()) 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 else
block_reward = block_reward_amount() block_reward = block_reward_amount()
emission_funds = emission_funds_amount() emission_funds = emission_funds_amount()

@ -902,7 +902,7 @@ defmodule Explorer.EthRPC do
"from" => transaction.from_address_hash, "from" => transaction.from_address_hash,
"gasUsed" => encode_quantity(transaction.gas_used), "gasUsed" => encode_quantity(transaction.gas_used),
"logs" => Enum.map(transaction.logs, &render_log(&1, transaction)), "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), "status" => encode_quantity(status),
"to" => transaction.to_address_hash, "to" => transaction.to_address_hash,
"transactionHash" => transaction.hash, "transactionHash" => transaction.hash,

@ -41,7 +41,7 @@ defmodule Explorer.ExchangeRates do
# Callback for errored fetch # Callback for errored fetch
@impl GenServer @impl GenServer
def handle_info({_ref, {:error, reason}}, state) do 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() schedule_next_consolidation()

@ -60,7 +60,7 @@ defmodule Explorer.History.Process do
@spec failed_compilation(non_neg_integer(), module(), non_neg_integer()) :: any() @spec failed_compilation(non_neg_integer(), module(), non_neg_integer()) :: any()
defp failed_compilation(day_count, historian, failed_attempts) do 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) compile_historical_records(day_count, historian, failed_attempts + 1)
end end

@ -119,7 +119,7 @@ defmodule Explorer.Market.History.Cataloger do
# Failed to get records. Try again. # Failed to get records. Try again.
@impl GenServer @impl GenServer
def handle_info({_ref, {:price_history, {day_count, failed_attempts, secondary_coin?, :error}}}, state) do 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) 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. # Failed to get records. Try again.
@impl GenServer @impl GenServer
def handle_info({_ref, {:market_cap_history, {day_count, failed_attempts, :error}}}, state) do 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) 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. # Failed to get records. Try again.
@impl GenServer @impl GenServer
def handle_info({_ref, {:tvl_history, {day_count, failed_attempts, :error}}}, state) do 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) fetch_tvl_history(day_count, failed_attempts + 1)

@ -868,7 +868,7 @@ defmodule Explorer.SmartContract.Reader do
result = result =
if String.ends_with?(type, "[]") do if String.ends_with?(type, "[]") do
value 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() |> flat_arrays_map()
else else
value value
@ -922,7 +922,7 @@ defmodule Explorer.SmartContract.Reader do
def zip_tuple_values_with_types(value, type) do def zip_tuple_values_with_types(value, type) do
types_string = types_string =
type type
|> String.slice(6..-2) |> String.slice(6..-2//1)
types = types =
if String.trim(types_string) == "" do if String.trim(types_string) == "" do

@ -125,7 +125,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do
error -> error ->
error = parse_error(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 {:error, [first_error | _]} = error
%{"message" => error_message} = first_error %{"message" => error_message} = first_error
{:error, :compilation, error_message} {:error, :compilation, error_message}
@ -164,7 +164,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do
error -> error ->
error = parse_error(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 {:error, [first_error | _]} = error
%{"message" => error_message} = first_error %{"message" => error_message} = first_error
{:error, :compilation, error_message} {:error, :compilation, error_message}

@ -444,9 +444,9 @@ defmodule Explorer.SmartContract.Solidity.Verifier do
defp extract_meta_from_deployed_bytecode(code_unknown_case) do defp extract_meta_from_deployed_bytecode(code_unknown_case) do
with true <- is_binary(code_unknown_case), with true <- is_binary(code_unknown_case),
code <- String.downcase(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_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} {meta, last_2_bytes}
else else
_ -> _ ->

@ -388,13 +388,10 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do
end end
defp prepare_additional_source(address_hash_string, %{"name" => _name, "content" => content, "path" => path}) do defp prepare_additional_source(address_hash_string, %{"name" => _name, "content" => content, "path" => path}) do
splitted_path = trimmed_path =
path path
|> String.split("/") |> String.split("/")
|> Enum.slice(9..-1)
trimmed_path =
splitted_path
|> Enum.slice(9..Enum.count(splitted_path))
|> Enum.join("/") |> Enum.join("/")
%{ %{

@ -507,7 +507,7 @@ defmodule Explorer.Token.MetadataRetriever do
if error =~ "execution reverted" or error =~ @vm_execution_error do if error =~ "execution reverted" or error =~ @vm_execution_error do
{:error, @vm_execution_error} {:error, @vm_execution_error}
else 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 # truncate error since it will be stored in DB
{:error, truncate_error(error)} {:error, truncate_error(error)}
@ -520,7 +520,7 @@ defmodule Explorer.Token.MetadataRetriever do
ipfs? = true ipfs? = true
fetch_json_from_uri({:ok, [ipfs_link(result)]}, ipfs?, token_id, hex_token_id, from_base_uri?) fetch_json_from_uri({:ok, [ipfs_link(result)]}, ipfs?, token_id, hex_token_id, from_base_uri?)
else 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)} {:error, truncate_error(result)}
end end
@ -575,7 +575,7 @@ defmodule Explorer.Token.MetadataRetriever do
end end
rescue rescue
e -> e ->
Logger.warn( Logger.warning(
[ [
"Unknown metadata format base64 #{inspect(base64_encoded_json)}.", "Unknown metadata format base64 #{inspect(base64_encoded_json)}.",
Exception.format(:error, e, __STACKTRACE__) Exception.format(:error, e, __STACKTRACE__)
@ -604,7 +604,7 @@ defmodule Explorer.Token.MetadataRetriever do
check_type(json, hex_token_id) check_type(json, hex_token_id)
rescue rescue
e -> 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 fetcher: :token_instances
) )
@ -612,7 +612,7 @@ defmodule Explorer.Token.MetadataRetriever do
end end
defp fetch_json_from_uri(uri, _ipfs?, _token_id, _hex_token_id, _from_base_uri?) do 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"} {:error, "unknown metadata uri format"}
end 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?) fetch_json_from_uri({:ok, [decoded_json]}, ipfs?, token_id, hex_token_id, from_base_uri?)
rescue rescue
e -> 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 fetcher: :token_instances
) )
@ -643,7 +643,7 @@ defmodule Explorer.Token.MetadataRetriever do
fetch_metadata_from_uri(prepared_uri, ipfs?, hex_token_id) fetch_metadata_from_uri(prepared_uri, ipfs?, hex_token_id)
rescue rescue
e -> e ->
Logger.warn( Logger.warning(
["Could not prepare token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], ["Could not prepare token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)],
fetcher: :token_instances fetcher: :token_instances
) )
@ -683,7 +683,7 @@ defmodule Explorer.Token.MetadataRetriever do
{:error_code, code} {:error_code, code}
{:error, %Error{reason: reason}} -> {:error, %Error{reason: reason}} ->
Logger.warn( Logger.warning(
["Request to token uri failed: #{inspect(uri)}.", inspect(reason)], ["Request to token uri failed: #{inspect(uri)}.", inspect(reason)],
fetcher: :token_instances fetcher: :token_instances
) )
@ -692,7 +692,7 @@ defmodule Explorer.Token.MetadataRetriever do
end end
rescue rescue
e -> e ->
Logger.warn( Logger.warning(
["Could not send request to token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)], ["Could not send request to token uri #{inspect(uri)}.", Exception.format(:error, e, __STACKTRACE__)],
fetcher: :token_instances fetcher: :token_instances
) )

@ -119,7 +119,8 @@ defmodule Explorer.Mixfile do
{:redix, "~> 1.1"}, {:redix, "~> 1.1"},
{:hammer_backend_redis, "~> 6.1"}, {:hammer_backend_redis, "~> 6.1"},
{:logger_json, "~> 5.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 end

@ -93,7 +93,10 @@ defmodule Explorer.Chain.BlockTest do
test "with uncles", %{emission_reward: %{reward: reward, block_range: range}} do test "with uncles", %{emission_reward: %{reward: reward, block_range: range}} do
block = block =
build(:block, number: range.from, uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"]) build(:block,
number: range.from,
uncles: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273311"]
)
expected_uncle_reward = Wei.div(reward, 32) expected_uncle_reward = Wei.div(reward, 32)

@ -1,5 +1,5 @@
defmodule Explorer.Chain.Cache.GasPriceOracleTest do defmodule Explorer.Chain.Cache.GasPriceOracleTest do
use Explorer.DataCase use Explorer.DataCase, async: false
alias Explorer.Chain.Cache.GasPriceOracle alias Explorer.Chain.Cache.GasPriceOracle
alias Explorer.Chain.Wei alias Explorer.Chain.Wei

@ -500,7 +500,7 @@ defmodule Explorer.Chain.SmartContract.ProxyTest do
case mode do case mode do
:full_32 -> "0x000000000000000000000000" <> beacon_contract_address_hash_string :full_32 -> "0x000000000000000000000000" <> beacon_contract_address_hash_string
:exact_20 -> "0x" <> 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 end
EthereumJSONRPC.Mox EthereumJSONRPC.Mox

@ -2333,7 +2333,11 @@ defmodule Explorer.ChainTest do
|> insert() |> insert()
|> with_block() |> 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{}}] = assert [%TokenTransfer{token: %Token{}, transaction: %Transaction{}}] =
Chain.transaction_to_token_transfers( Chain.transaction_to_token_transfers(
@ -2936,7 +2940,9 @@ defmodule Explorer.ChainTest do
decompiled_smart_contracts = decompiled_smart_contracts =
Repo.all( 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 assert Enum.count(decompiled_smart_contracts) == 2

@ -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: 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)) insert(:block, number: block_number, consensus: false, timestamp: Timex.shift(first_timestamp, seconds: -100 - 9))

@ -143,7 +143,7 @@ defmodule Explorer.ExchangeRates.Source.CoinGeckoTest do
Application.put_env(:explorer, CoinGecko, base_url: "http://localhost:#{bypass.port}") Application.put_env(:explorer, CoinGecko, base_url: "http://localhost:#{bypass.port}")
on_exit(fn -> on_exit(fn ->
Application.put_env(:explorer, :coin, "POA") Application.put_env(:explorer, :coin, "ETH")
end) end)
{:ok, bypass: bypass} {:ok, bypass: bypass}

@ -2,6 +2,7 @@ defmodule Explorer.Market.History.CatalogerTest do
use Explorer.DataCase, async: false use Explorer.DataCase, async: false
import Mox import Mox
import Ecto.Query, only: [order_by: 2]
alias Explorer.Market.MarketHistory alias Explorer.Market.MarketHistory
alias Explorer.Market.History.Cataloger alias Explorer.Market.History.Cataloger
@ -221,7 +222,7 @@ defmodule Explorer.Market.History.CatalogerTest do
%Explorer.Market.MarketHistory{ %Explorer.Market.MarketHistory{
date: ~D[2018-04-02] date: ~D[2018-04-02]
} = second_entry } = 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?(first_entry.closing_price, Decimal.new(10))
assert Decimal.eq?(second_entry.closing_price, Decimal.new(20)) assert Decimal.eq?(second_entry.closing_price, Decimal.new(20))

@ -18,6 +18,8 @@ defmodule Explorer.MarketTest do
end end
test "fetch_recent_history/1" do test "fetch_recent_history/1" do
ConCache.delete(:market_history, :last_update)
today = Date.utc_today() today = Date.utc_today()
records = records =

@ -236,7 +236,7 @@ defmodule Indexer.Block.Realtime.Fetcher do
end end
def import(_, _) do def import(_, _) do
Logger.warn("Empty parameters were provided for realtime fetcher") Logger.warning("Empty parameters were provided for realtime fetcher")
{:ok, []} {:ok, []}
end end

@ -438,7 +438,7 @@ defmodule Indexer.BufferedTask do
new_bound_queue new_bound_queue
{%BoundQueue{maximum_size: maximum_size} = new_bound_queue, remaining_entries} -> {%BoundQueue{maximum_size: maximum_size} = new_bound_queue, remaining_entries} ->
Logger.warn(fn -> Logger.warning(fn ->
[ [
"BufferedTask ", "BufferedTask ",
process(self()), process(self()),

@ -195,7 +195,7 @@ defmodule Indexer.Fetcher.OnDemand.TokenBalance do
end end
defp prepare_updated_balance({{:error, error}, ctb}, block_number) do 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}: ", "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) inspect(error)

@ -290,7 +290,7 @@ defmodule Indexer.Fetcher.TokenInstance.Helper do
rescue rescue
error in Postgrex.Error -> error in Postgrex.Error ->
if retrying? do if retrying? do
Logger.warn( Logger.warning(
[ [
"Failed to upsert token instance: {#{to_string(token_contract_address_hash)}, #{token_id}}, error: #{inspect(error)}" "Failed to upsert token instance: {#{to_string(token_contract_address_hash)}, #{token_id}}, error: #{inspect(error)}"
], ],

@ -263,7 +263,7 @@ defmodule Indexer.Fetcher.TransactionAction do
end end
if next_block < first_block do 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 " <> "It seems #{__MODULE__} already finished work for the block range #{first_block}..#{last_block} and " <>
if(Enum.empty?(protocols), if(Enum.empty?(protocols),
do: "all supported protocols.", do: "all supported protocols.",

@ -67,7 +67,7 @@ defmodule Indexer.Fetcher.Withdrawal do
{:ok, state} {:ok, state}
else 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 :ignore
end end
end end

@ -112,7 +112,7 @@ defmodule Indexer.Memory.Monitor do
end end
defp log_memory(%{total: total, limit: limit}) do defp log_memory(%{total: total, limit: limit}) do
Logger.warn(fn -> Logger.warning(fn ->
[ [
to_string(total), to_string(total),
" / ", " / ",
@ -158,7 +158,7 @@ defmodule Indexer.Memory.Monitor do
end end
defp shrink([{pid, memory} | tail]) do defp shrink([{pid, memory} | tail]) do
Logger.warn(fn -> Logger.warning(fn ->
[ [
"Worst memory usage (", "Worst memory usage (",
to_string(memory), to_string(memory),

@ -544,10 +544,10 @@ defmodule Indexer.Transform.TransactionActions do
defp uniswap_handle_swap_amounts(log, amount0, amount1, symbol0, symbol1, address0, address1) do defp uniswap_handle_swap_amounts(log, amount0, amount1, symbol0, symbol1, address0, address1) do
cond do cond do
String.first(amount0) === "-" and String.first(amount1) !== "-" -> 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) !== "-" -> 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) !== "-" -> amount1 === "0" and String.first(amount0) !== "-" ->
{amount0, symbol0, address0, amount1, symbol1, address1, false} {amount0, symbol0, address0, amount1, symbol1, address1, false}

@ -243,7 +243,8 @@ defmodule Indexer.BufferedTaskTest do
flush_timer: nil, flush_timer: nil,
task_supervisor: BufferedTaskSup, task_supervisor: BufferedTaskSup,
max_batch_size: 1, max_batch_size: 1,
max_concurrency: 1 max_concurrency: 1,
poll: false
}) })
refute flush_timer == nil refute flush_timer == nil

@ -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 WORKDIR /app
@ -68,7 +68,7 @@ RUN mkdir -p /opt/release \
&& mv _build/${MIX_ENV}/rel/blockscout /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 ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION} ENV RELEASE_VERSION=${RELEASE_VERSION}

@ -115,7 +115,7 @@
"prometheus_ex": {:git, "https://github.com/lanodan/prometheus.ex", "31f7fbe4b71b79ba27efc2a5085746c4011ceb8f", [branch: "fix/elixir-1.14"]}, "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_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_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"}, "qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm", "a266b7fb7be0d3b713912055dde3575927eca920e5d604ded45cd534f6b7a447"},
"quantile_estimator": {:hex, :quantile_estimator, "0.2.1", "ef50a361f11b5f26b5f16d0696e46a9e4661756492c981f7b2229ef42ff1cd15", [:rebar3], [], "hexpm", "282a8a323ca2a845c9e6f787d166348f776c1d4a41ede63046d72d422e3da946"}, "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"}, "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"},

Loading…
Cancel
Save