From 1015bfd0a4432d2d39b580c35b617cbfe3daa5dd Mon Sep 17 00:00:00 2001 From: nikitosing <32202610+nikitosing@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:23:15 +0300 Subject: [PATCH 1/4] fix: Fix slow internal transactions query (#10346) --- apps/explorer/lib/explorer/chain/internal_transaction.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/internal_transaction.ex b/apps/explorer/lib/explorer/chain/internal_transaction.ex index 0678dfc97f75..793a7fc65eac 100644 --- a/apps/explorer/lib/explorer/chain/internal_transaction.ex +++ b/apps/explorer/lib/explorer/chain/internal_transaction.ex @@ -576,8 +576,10 @@ defmodule Explorer.Chain.InternalTransaction do """ def where_nonpending_block(query \\ nil) do (query || __MODULE__) - |> join(:left, [it], pending in assoc(it, :pending_block), as: :pending) - |> where([it, pending: pending], is_nil(pending.block_hash)) + |> where( + [it], + fragment("(SELECT block_hash FROM pending_block_operations WHERE block_hash = ? LIMIT 1) IS NULL", it.block_hash) + ) end def internal_transactions_to_raw(internal_transactions) when is_list(internal_transactions) do From 54538a3c1ce997a5be408b5c647f3cfe8a360907 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 2 Jul 2024 19:11:42 +0300 Subject: [PATCH 2/4] fix: Apply Ecto set explicit ssl_opts: [verify: :verify_none] to all prod repos (#10369) --- apps/explorer/config/prod.exs | 48 +++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/apps/explorer/config/prod.exs b/apps/explorer/config/prod.exs index 9f69dbd54b36..a7166e19aace 100644 --- a/apps/explorer/config/prod.exs +++ b/apps/explorer/config/prod.exs @@ -4,69 +4,85 @@ import Config config :explorer, Explorer.Repo, prepare: :unnamed, timeout: :timer.seconds(60), - migration_lock: nil + migration_lock: nil, + ssl_opts: [verify: :verify_none] # Configures API the database config :explorer, Explorer.Repo.Replica1, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] # Configures Account database config :explorer, Explorer.Repo.Account, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Optimism, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.PolygonEdge, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.PolygonZkevm, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.ZkSync, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.RSK, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Shibarium, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Suave, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Beacon, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Arbitrum, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.BridgedTokens, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Filecoin, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Stability, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Repo.Mud, prepare: :unnamed, - timeout: :timer.seconds(60) + timeout: :timer.seconds(60), + ssl_opts: [verify: :verify_none] config :explorer, Explorer.Tracer, env: "production", disabled?: true From f1a8b7e1a912313c4e9346115c4b037f05cc2dc7 Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Tue, 2 Jul 2024 22:13:18 +0300 Subject: [PATCH 3/4] 6.7.2 --- CHANGELOG.md | 16 ++++++++++++++++ apps/block_scout_web/mix.exs | 2 +- apps/ethereum_jsonrpc/mix.exs | 2 +- apps/explorer/mix.exs | 2 +- apps/indexer/mix.exs | 2 +- docker-compose/docker-compose.yml | 2 +- docker/Makefile | 2 +- mix.exs | 2 +- rel/config.exs | 2 +- 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 374183d4710e..bad1ddd88aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 6.7.2 + +### 🐛 Bug Fixes + +- Apply Ecto set explicit ssl_opts: [verify: :verify_none] to all prod repos ([#10369](https://github.com/blockscout/blockscout/issues/10369)) +- Fix slow internal transactions query ([#10346](https://github.com/blockscout/blockscout/issues/10346)) +- Don't execute update query for empty list ([#10344](https://github.com/blockscout/blockscout/issues/10344)) +- Add rescue on tx revert reason fetching ([#10366](https://github.com/blockscout/blockscout/issues/10366)) +- Reth compatibility ([#10335](https://github.com/blockscout/blockscout/issues/10335)) +- Public metrics enabling ([#10365](https://github.com/blockscout/blockscout/issues/10365)) +- Flaky market test ([#10262](https://github.com/blockscout/blockscout/issues/10262)) + +### ⚙️ Miscellaneous Tasks + +- Bump elixir to 1.16.3 and Erlang OTP to 26.2.5.1 ([#9256](https://github.com/blockscout/blockscout/issues/9256)) + ## 6.7.1 ### 🐛 Bug Fixes diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index ab9636fb798c..5db0828bffa4 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -23,7 +23,7 @@ defmodule BlockScoutWeb.Mixfile do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "6.7.1", + version: "6.7.2", xref: [ exclude: [ Explorer.Chain.PolygonZkevm.Reader, diff --git a/apps/ethereum_jsonrpc/mix.exs b/apps/ethereum_jsonrpc/mix.exs index 248837a13568..2dbbca47f4f7 100644 --- a/apps/ethereum_jsonrpc/mix.exs +++ b/apps/ethereum_jsonrpc/mix.exs @@ -23,7 +23,7 @@ defmodule EthereumJsonrpc.MixProject do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "6.7.1" + version: "6.7.2" ] end diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs index 069f9bcb1fc7..931d487de3fd 100644 --- a/apps/explorer/mix.exs +++ b/apps/explorer/mix.exs @@ -24,7 +24,7 @@ defmodule Explorer.Mixfile do dialyzer: :test ], start_permanent: Mix.env() == :prod, - version: "6.7.1", + version: "6.7.2", xref: [exclude: [BlockScoutWeb.Routers.WebRouter.Helpers, Indexer.Helper]] ] end diff --git a/apps/indexer/mix.exs b/apps/indexer/mix.exs index 91ed1604ad5b..7bccbcfcabfd 100644 --- a/apps/indexer/mix.exs +++ b/apps/indexer/mix.exs @@ -14,7 +14,7 @@ defmodule Indexer.MixProject do elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", start_permanent: Mix.env() == :prod, - version: "6.7.1", + version: "6.7.2", xref: [ exclude: [ Explorer.Chain.Optimism.Deposit, diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index afe26f15a9e9..167df068935f 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -37,7 +37,7 @@ services: CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED: "" CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "" ADMIN_PANEL_ENABLED: "" - RELEASE_VERSION: 6.7.1 + RELEASE_VERSION: 6.7.2 links: - db:database environment: diff --git a/docker/Makefile b/docker/Makefile index 71209daf9ec2..8264a37dbb87 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -10,7 +10,7 @@ STATS_CONTAINER_NAME := stats STATS_DB_CONTAINER_NAME := stats-db PROXY_CONTAINER_NAME := proxy PG_CONTAINER_NAME := postgres -RELEASE_VERSION ?= '6.7.1' +RELEASE_VERSION ?= '6.7.2' TAG := $(RELEASE_VERSION)-commit-$(shell git log -1 --pretty=format:"%h") STABLE_TAG := $(RELEASE_VERSION) diff --git a/mix.exs b/mix.exs index 0827352c0967..f3a29e2a0e40 100644 --- a/mix.exs +++ b/mix.exs @@ -7,7 +7,7 @@ defmodule BlockScout.Mixfile do [ # app: :block_scout, # aliases: aliases(config_env()), - version: "6.7.1", + version: "6.7.2", apps_path: "apps", deps: deps(), dialyzer: dialyzer(), diff --git a/rel/config.exs b/rel/config.exs index af0561f7bb5c..9090ce16b8e6 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -71,7 +71,7 @@ end # will be used by default release :blockscout do - set version: "6.7.1-beta" + set version: "6.7.2-beta" set applications: [ :runtime_tools, block_scout_web: :permanent, From ea9f6e5efac99e23ab735d23d70c3ce8f309791c Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 3 Jul 2024 17:43:52 +0300 Subject: [PATCH 4/4] fix: simplify query for weekly_deployed_smart_contracts_number public metric (#10372) --- .../lib/explorer/chain/metrics/queries.ex | 29 ++++++++++--------- .../lib/explorer/prometheus/instrumenter.ex | 3 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/metrics/queries.ex b/apps/explorer/lib/explorer/chain/metrics/queries.ex index 7fbe05e4a117..41b0c628b7ab 100644 --- a/apps/explorer/lib/explorer/chain/metrics/queries.ex +++ b/apps/explorer/lib/explorer/chain/metrics/queries.ex @@ -72,23 +72,24 @@ defmodule Explorer.Chain.Metrics.Queries do |> select([tx, block], tx.created_contract_address_hash) end - internal_transactions_query = - InternalTransaction - |> join(:inner, [it], transaction in assoc(it, :transaction)) - |> where([it, tx], not is_nil(it.created_contract_address_hash)) - |> where([it, tx], tx.block_timestamp >= ago(7, "day")) - |> where([it, tx], tx.block_consensus == true) - |> where([it, tx], tx.status == ^1) - |> select([it, tx], it.created_contract_address_hash) - |> wrapped_union_subquery() + # todo: this part is too slow, need to optimize + # internal_transactions_query = + # InternalTransaction + # |> join(:inner, [it], transaction in assoc(it, :transaction)) + # |> where([it, tx], not is_nil(it.created_contract_address_hash)) + # |> where([it, tx], tx.block_timestamp >= ago(7, "day")) + # |> where([it, tx], tx.block_consensus == true) + # |> where([it, tx], tx.status == ^1) + # |> select([it, tx], it.created_contract_address_hash) + # |> wrapped_union_subquery() - query = - transactions_query - |> wrapped_union_subquery() - |> union(^internal_transactions_query) + # query = + # transactions_query + # |> wrapped_union_subquery() + # |> union(^internal_transactions_query) from( - q in subquery(query), + q in subquery(transactions_query), select: fragment("COUNT(DISTINCT(?))", q.created_contract_address_hash) ) end diff --git a/apps/explorer/lib/explorer/prometheus/instrumenter.ex b/apps/explorer/lib/explorer/prometheus/instrumenter.ex index 452c66a7831e..ca3d619db93e 100644 --- a/apps/explorer/lib/explorer/prometheus/instrumenter.ex +++ b/apps/explorer/lib/explorer/prometheus/instrumenter.ex @@ -21,7 +21,8 @@ defmodule Explorer.Prometheus.Instrumenter do @gauge [ name: :weekly_deployed_smart_contracts_number, - help: "Number of deployed smart-contracts in the last 7 days", + help: + "Number of deployed smart-contracts (smart-contracts from internal transactions are not accounted) in the last 7 days", registry: :public ]