Skip to content

Commit 7fe5bb9

Browse files
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 <[email protected]>
1 parent 18c0a61 commit 7fe5bb9

File tree

73 files changed

+191
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+191
-148
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ body:
8181
attributes:
8282
label: Elixir & Erlang/OTP versions
8383
description: Elixir & Erlang/OTP versions.
84-
placeholder: Elixir 1.14.5 (compiled with Erlang/OTP 25)
84+
placeholder: Elixir 1.16.3 (compiled with Erlang/OTP 26)
8585
validations:
8686
required: true
8787

.github/workflows/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ on:
3232

3333
env:
3434
MIX_ENV: test
35-
OTP_VERSION: ${{ vars.OTP_VERSION || '25.3.2.8' }}
36-
ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION || '1.14.5' }}
35+
OTP_VERSION: ${{ github.ref_name == '9256/merge' && '26.2.5.1' || vars.OTP_VERSION }}
36+
ELIXIR_VERSION: ${{ github.ref_name == '9256/merge' && '1.16.3' || vars.ELIXIR_VERSION }}
3737
ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com"
3838

3939
jobs:

.tool-versions

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
elixir 1.14.5-otp-25
2-
erlang 25.3.2.8
1+
elixir 1.16.3-otp-26
2+
erlang 26.2.5.1
33
nodejs 18.17.1

apps/block_scout_web/lib/block_scout_web/controllers/api/v2/import_controller.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ defmodule BlockScoutWeb.API.V2.ImportController do
4242
|> render(:message, %{message: "Success"})
4343

4444
error ->
45-
Logger.warn(fn -> ["Error on importing token info: ", inspect(error)] end)
45+
Logger.warning(fn -> ["Error on importing token info: ", inspect(error)] end)
4646

4747
conn
4848
|> put_view(ApiView)

apps/block_scout_web/lib/block_scout_web/models/user_from_auth.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ defmodule BlockScoutWeb.Models.UserFromAuth do
117117

118118
# default case if nothing matches
119119
defp avatar_from_auth(auth) do
120-
Logger.warn(auth.provider <> " needs to find an avatar URL!")
120+
Logger.warning(auth.provider <> " needs to find an avatar URL!")
121121
Logger.debug(Poison.encode!(auth))
122122
nil
123123
end

apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
55

66
<div class="new-smart-contract-form">
7-
<h1 class="smart-contract-title"><%= if RustVerifierInterface.enabled?(), do: gettext "New Solidity/Yul Smart Contract Verification", else: gettext "New Solidity Smart Contract Verification" %></h1>
7+
<h1 class="smart-contract-title"><%= if RustVerifierInterface.enabled?(), do: gettext("New Solidity/Yul Smart Contract Verification"), else: gettext("New Solidity Smart Contract Verification") %></h1>
88

99
<%= form_for changeset,
1010
address_contract_verification_path(@conn, :create),
@@ -69,7 +69,7 @@
6969
</div>
7070
</div>
7171
</div>
72-
<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>
72+
<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>
7373
</div>
7474

7575
<div class="add-contract-libraries-wrapper">

apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="card-body" data-async-listing="<%= @current_path %>">
1212
<h1 class="card-title list-title-description"><%= gettext "Validated Transactions" %></h1>
1313
<div class="list-top-pagination-container-wrapper">
14-
<%= 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 %>
14+
<%= 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) %>
1515
</div>
1616

1717
<div data-selector="channel-batching-message" class="d-none">

apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
2020
do_value_html(decoded_type, value, no_links)
2121
rescue
2222
exception ->
23-
Logger.warn(fn ->
23+
Logger.warning(fn ->
2424
["Error determining value html for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
2525
end)
2626

@@ -33,7 +33,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
3333
do_value_json(decoded_type, value)
3434
rescue
3535
exception ->
36-
Logger.warn(fn ->
36+
Logger.warning(fn ->
3737
["Error determining value json for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
3838
end)
3939

@@ -46,7 +46,7 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
4646
do_copy_text(decoded_type, value)
4747
rescue
4848
exception ->
49-
Logger.warn(fn ->
49+
Logger.warning(fn ->
5050
["Error determining copy text for #{inspect(type)}: ", Exception.format(:error, exception, __STACKTRACE__)]
5151
end)
5252

apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do
266266
|> Enum.reduce("", fn p, a ->
267267
a <> new_style <> p <> "</span>\n"
268268
end)
269-
|> String.slice(0..-2)
269+
|> String.slice(0..-2//1)
270270
end
271271
end
272272
end

apps/block_scout_web/lib/block_scout_web/views/api/v2/smart_contract_view.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do
301301
result
302302
rescue
303303
exception ->
304-
Logger.warn(fn ->
304+
Logger.warning(fn ->
305305
[
306306
"Error formatting constructor arguments for abi: #{inspect(abi)}, args: #{inspect(constructor_arguments)}: ",
307307
Exception.format(:error, exception)
@@ -382,7 +382,7 @@ defmodule BlockScoutWeb.API.V2.SmartContractView do
382382
tuple_item_types =
383383
rest
384384
|> String.split("]")
385-
|> Enum.slice(0..-3)
385+
|> Enum.slice(0..-3//1)
386386
|> Enum.join("]")
387387

388388
array_str = "[" <> (rest |> String.split("[") |> List.last())

apps/block_scout_web/lib/block_scout_web/views/nft_helper.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ defmodule BlockScoutWeb.NFTHelper do
8181
end
8282

8383
defp ipfs_link(image_url, prefix) do
84-
ipfs_uid = String.slice(image_url, String.length(prefix)..-1)
84+
ipfs_uid = String.slice(image_url, String.length(prefix)..-1//1)
8585

8686
"https://ipfs.io/ipfs/" <> ipfs_uid
8787
end

apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ defmodule BlockScoutWeb.SmartContractView do
5656
String.starts_with?(type, "tuple") ->
5757
tuple_types =
5858
type
59-
|> String.slice(0..-3)
59+
|> String.slice(0..-3//1)
6060
|> supplement_type_with_components(components)
6161

6262
values =
@@ -132,7 +132,7 @@ defmodule BlockScoutWeb.SmartContractView do
132132
to_string(address)
133133

134134
_ ->
135-
Logger.warn(fn -> ["Error decoding address value: #{inspect(value)}"] end)
135+
Logger.warning(fn -> ["Error decoding address value: #{inspect(value)}"] end)
136136
"(decoding error)"
137137
end
138138
end

apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ defmodule BlockScoutWeb.TransactionView do
597597
end
598598

599599
def trim(length, string) do
600-
%{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..String.length(string))}
600+
%{show: String.slice(string, 0..length), hide: String.slice(string, (length + 1)..-1//1)}
601601
end
602602

603603
defp template_to_string(template) when is_list(template) do

apps/block_scout_web/mix.exs

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ defmodule BlockScoutWeb.Mixfile do
135135
{:prometheus_phoenix, "~> 1.2"},
136136
# Expose metrics from URL Prometheus server can scrape
137137
{:prometheus_plugs, "~> 1.1"},
138-
# OS process metrics for Prometheus
139-
{:prometheus_process_collector, "~> 1.3"},
138+
# OS process metrics for Prometheus, custom ref to include https://github.com/deadtrickster/prometheus_process_collector/pull/30
139+
{:prometheus_process_collector,
140+
git: "https://github.com/Phybbit/prometheus_process_collector.git",
141+
ref: "3dc94dcff422d7b9cbd7ddf6bf2a896446705f3f",
142+
override: true},
140143
{:remote_ip, "~> 1.0"},
141144
{:qrcode, "~> 0.1.0"},
142145
{:sobelow, ">= 0.7.0", only: [:dev, :test], runtime: false},

apps/block_scout_web/test/block_scout_web/controllers/address_token_transfer_controller_test.exs

+3-5
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,9 @@ defmodule BlockScoutWeb.AddressTokenTransferControllerTest do
207207
:index,
208208
Address.checksum(address.hash),
209209
Address.checksum(token.contract_address_hash),
210-
%{
211-
block_number: page_last_transfer.block_number,
212-
index: page_last_transfer.index,
213-
items_count: "50"
214-
}
210+
block_number: page_last_transfer.block_number,
211+
index: page_last_transfer.index,
212+
items_count: "50"
215213
)
216214

217215
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path

apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs

+24-4
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
876876
for _ <- 0..50 do
877877
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block()
878878

879-
insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address)
879+
insert(:token_transfer,
880+
transaction: tx,
881+
block: tx.block,
882+
block_number: tx.block_number,
883+
from_address: address
884+
)
880885

881886
insert(:token_transfer,
882887
transaction: tx,
@@ -941,7 +946,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
941946
for _ <- 0..50 do
942947
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block()
943948

944-
insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address)
949+
insert(:token_transfer,
950+
transaction: tx,
951+
block: tx.block,
952+
block_number: tx.block_number,
953+
from_address: address
954+
)
945955
end
946956

947957
request = get(conn, "/api/v2/addresses/#{address.hash}/token-transfers")
@@ -986,7 +996,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
986996
for _ <- 0..50 do
987997
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block()
988998

989-
insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address)
999+
insert(:token_transfer,
1000+
transaction: tx,
1001+
block: tx.block,
1002+
block_number: tx.block_number,
1003+
from_address: address
1004+
)
9901005
end
9911006

9921007
for _ <- 0..50 do
@@ -1013,7 +1028,12 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
10131028
for _ <- 0..49 do
10141029
tx = insert(:transaction, input: "0xabcd010203040506") |> with_block()
10151030

1016-
insert(:token_transfer, transaction: tx, block: tx.block, block_number: tx.block_number, from_address: address)
1031+
insert(:token_transfer,
1032+
transaction: tx,
1033+
block: tx.block,
1034+
block_number: tx.block_number,
1035+
from_address: address
1036+
)
10171037
end
10181038

10191039
tt_to =

apps/block_scout_web/test/block_scout_web/controllers/block_controller_test.exs

+1-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,7 @@ defmodule BlockScoutWeb.BlockControllerTest do
9898

9999
conn = get(conn, blocks_path(conn, :index), %{"type" => "JSON"})
100100

101-
expected_path =
102-
blocks_path(conn, :index, %{
103-
block_number: number,
104-
block_type: "Block",
105-
items_count: "50"
106-
})
101+
expected_path = blocks_path(conn, :index, block_number: number, block_type: "Block", items_count: "50")
107102

108103
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
109104
end

apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs

+11-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do
5353
test "includes token transfers for the transaction", %{conn: conn} do
5454
transaction = insert(:transaction) |> with_block()
5555

56-
insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number)
57-
58-
insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number)
56+
insert(:token_transfer,
57+
transaction: transaction,
58+
block: transaction.block,
59+
block_number: transaction.block_number
60+
)
61+
62+
insert(:token_transfer,
63+
transaction: transaction,
64+
block: transaction.block,
65+
block_number: transaction.block_number
66+
)
5967

6068
path = transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash)
6169

apps/block_scout_web/test/block_scout_web/controllers/verified_contracts_controller_test.exs

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ defmodule BlockScoutWeb.VerifiedContractsControllerTest do
6363
conn = get(conn, verified_contracts_path(conn, :index), %{"type" => "JSON"})
6464

6565
expected_path =
66-
verified_contracts_path(conn, :index, %{
67-
smart_contract_id: id,
68-
items_count: "50",
66+
verified_contracts_path(conn, :index,
6967
coin_balance: nil,
68+
items_count: "50",
69+
smart_contract_id: id,
7070
tx_count: nil
71-
})
71+
)
7272

7373
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
7474
end

apps/block_scout_web/test/block_scout_web/controllers/withdrawal_controller_test.exs

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ defmodule BlockScoutWeb.WithdrawalControllerTest do
4141
conn = get(conn, withdrawal_path(conn, :index), %{"type" => "JSON"})
4242

4343
expected_path =
44-
withdrawal_path(conn, :index, %{
45-
index: index,
46-
items_count: "50"
47-
})
44+
withdrawal_path(conn, :index, index: index, items_count: "50")
4845

4946
assert Map.get(json_response(conn, 200), "next_page_path") == expected_path
5047
end

apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ defmodule EthereumJSONRPC.Encoder do
101101

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

apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex

+7-12
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,13 @@ defmodule EthereumJSONRPC.Variant do
100100

101101
variant = System.get_env("ETHEREUM_JSONRPC_VARIANT", default_variant)
102102

103-
cond do
104-
is_nil(variant) ->
105-
"nethermind"
106-
107-
variant == "parity" ->
108-
"nethermind"
109-
110-
true ->
111-
variant
112-
|> String.split(".")
113-
|> List.last()
114-
|> String.downcase()
103+
if variant == "parity" do
104+
"nethermind"
105+
else
106+
variant
107+
|> String.split(".")
108+
|> List.last()
109+
|> String.downcase()
115110
end
116111
end
117112

apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule EthereumJSONRPC.ReceiptTest do
1515
%{"new_key" => "new_value", "transactionHash" => "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"}
1616
1717
Errors:
18-
{:unknown_key, %{key: "new_key", value: "new_value"}}
18+
{:unknown_key, %{value: "new_value", key: "new_key"}}
1919
""",
2020
fn ->
2121
Receipt.to_elixir(%{

apps/explorer/lib/explorer/account/custom_abi.ex

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ defmodule Explorer.Account.CustomABI do
5050
end
5151

5252
defp put_hashed_fields(changeset) do
53+
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
5354
changeset
54-
|> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
55+
|> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
5556
end
5657

5758
defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do

apps/explorer/lib/explorer/account/identity.ex

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ defmodule Explorer.Account.Identity do
3636
end
3737

3838
defp put_hashed_fields(changeset) do
39+
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
3940
changeset
40-
|> put_change(:uid_hash, get_field(changeset, :uid))
41+
|> force_change(:uid_hash, get_field(changeset, :uid))
4142
end
4243
end

0 commit comments

Comments
 (0)