Skip to content

Commit

Permalink
chore: bump elixir to 1.16.3 and Erlang OTP to 26.2.5.1 (#9256)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
k1rill-fedoseev and vbaranov authored Jul 1, 2024
1 parent 18c0a61 commit 7fe5bb9
Show file tree
Hide file tree
Showing 73 changed files with 191 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>

<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,
address_contract_verification_path(@conn, :create),
Expand Down Expand Up @@ -69,7 +69,7 @@
</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 class="add-contract-libraries-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="card-body" data-async-listing="<%= @current_path %>">
<h1 class="card-title list-title-description"><%= gettext "Validated Transactions" %></h1>
<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 data-selector="channel-batching-message" class="d-none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do
|> Enum.reduce("", fn p, a ->
a <> new_style <> p <> "</span>\n"
end)
|> String.slice(0..-2)
|> String.slice(0..-2//1)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions apps/block_scout_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
19 changes: 7 additions & 12 deletions apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(%{
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/custom_abi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/identity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 7fe5bb9

Please sign in to comment.