From 87cd759c80bec5caafdd0a491c46666273eaffbd Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Jul 2019 14:27:15 +0300 Subject: [PATCH 1/6] bump otp version --- .tool-versions | 4 ++-- mix.exs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.tool-versions b/.tool-versions index 71379b2fa7..785ba751f8 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -elixir 1.9 -erlang 21.0.4 +elixir 1.9.1-otp-22 +erlang 22.0 nodejs 10.11.0 diff --git a/mix.exs b/mix.exs index c6c74689f9..af903bbdb0 100644 --- a/mix.exs +++ b/mix.exs @@ -14,7 +14,7 @@ defmodule BlockScout.Mixfile do plt_add_apps: ~w(ex_unit mix)a, ignore_warnings: ".dialyzer-ignore" ], - elixir: "~> 1.9", + elixir: "~> 1.9.1", preferred_cli_env: [ coveralls: :test, "coveralls.detail": :test, From a8b75b102a1295ee0a68ca8540ed99b18bc6f3a9 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Jul 2019 14:29:04 +0300 Subject: [PATCH 2/6] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c8934f3d..1d501f80b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - [#2326](https://github.com/poanetwork/blockscout/pull/2326) - fix nested constructor arguments ### Chore +- [#2402](https://github.com/poanetwork/blockscout/pull/2402) - bump otp version to 22.0 - [#2363](https://github.com/poanetwork/blockscout/pull/2363) - add parameters example for eth rpc - [#2342](https://github.com/poanetwork/blockscout/pull/2342) - Upgrade Postgres image version in Docker setup - [#2325](https://github.com/poanetwork/blockscout/pull/2325) - Reduce function input to address' hash only where possible From a8f5f994b25bb07b20d17797fb4711b7c83aadbf Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Jul 2019 14:30:30 +0300 Subject: [PATCH 3/6] bump elixir version in circle ci --- .circleci/config.yml | 24 ++++++++++++------------ docker/Dockerfile | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f410162b48..b3abd48786 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ jobs: build: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0-node-browsers + - image: circleci/elixir:1.9.1-node-browsers environment: MIX_ENV: test # match POSTGRES_PASSWORD for postgres image below @@ -129,7 +129,7 @@ jobs: check_formatted: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test @@ -143,7 +143,7 @@ jobs: credo: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test @@ -177,7 +177,7 @@ jobs: dialyzer: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test @@ -247,7 +247,7 @@ jobs: gettext: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test @@ -286,7 +286,7 @@ jobs: release: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: prod @@ -312,7 +312,7 @@ jobs: sobelow: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test @@ -336,7 +336,7 @@ jobs: test_geth_http_websocket: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0-node-browsers + - image: circleci/elixir:1.9.1-node-browsers environment: MIX_ENV: test # match POSTGRES_PASSWORD for postgres image below @@ -390,7 +390,7 @@ jobs: test_geth_mox: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0-node-browsers + - image: circleci/elixir:1.9.1-node-browsers environment: MIX_ENV: test # match POSTGRES_PASSWORD for postgres image below @@ -444,7 +444,7 @@ jobs: test_parity_http_websocket: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0-node-browsers + - image: circleci/elixir:1.9.1-node-browsers environment: MIX_ENV: test # match POSTGRES_PASSWORD for postgres image below @@ -498,7 +498,7 @@ jobs: test_parity_mox: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0-node-browsers + - image: circleci/elixir:1.9.1-node-browsers environment: MIX_ENV: test # match POSTGRES_PASSWORD for postgres image below @@ -552,7 +552,7 @@ jobs: coveralls_merge: docker: # Ensure .tool-versions matches - - image: circleci/elixir:1.9.0 + - image: circleci/elixir:1.9.1 environment: MIX_ENV: test diff --git a/docker/Dockerfile b/docker/Dockerfile index f73c4b34f0..97580300c1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM bitwalker/alpine-elixir-phoenix:1.9.0 +FROM bitwalker/alpine-elixir-phoenix:1.9.1 RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python From 12ebc6fad8032b3aa89cfdfa027f69582a04db07 Mon Sep 17 00:00:00 2001 From: saneery Date: Mon, 29 Jul 2019 13:20:09 +0300 Subject: [PATCH 4/6] Add LAST_BLOCK var to reindex range of blocks --- apps/indexer/config/config.exs | 3 ++- .../lib/indexer/block/catchup/fetcher.ex | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/indexer/config/config.exs b/apps/indexer/config/config.exs index 4e84e9bcfe..9ab951d668 100644 --- a/apps/indexer/config/config.exs +++ b/apps/indexer/config/config.exs @@ -35,7 +35,8 @@ config :indexer, String.to_integer(System.get_env("TOKEN_METADATA_UPDATE_INTERVAL") || "#{2 * 24 * 60 * 60}"), # bytes memory_limit: 1 <<< 30, - first_block: System.get_env("FIRST_BLOCK") || "0" + first_block: System.get_env("FIRST_BLOCK") || "0", + last_block: System.get_env("LAST_BLOCK") || "" # config :indexer, Indexer.Fetcher.ReplacedTransaction.Supervisor, disabled?: true # config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true diff --git a/apps/indexer/lib/indexer/block/catchup/fetcher.ex b/apps/indexer/lib/indexer/block/catchup/fetcher.ex index bb15ebcd2d..59088ebc3f 100644 --- a/apps/indexer/lib/indexer/block/catchup/fetcher.ex +++ b/apps/indexer/lib/indexer/block/catchup/fetcher.ex @@ -72,7 +72,14 @@ defmodule Indexer.Block.Catchup.Fetcher do ) do Logger.metadata(fetcher: :block_catchup) - {:ok, latest_block_number} = EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) + {:ok, latest_block_number} = + case latest_block() do + nil -> + EthereumJSONRPC.fetch_block_number_by_tag("latest", json_rpc_named_arguments) + + number -> + {:ok, number} + end case latest_block_number do # let realtime indexer get the genesis block @@ -337,4 +344,13 @@ defmodule Indexer.Block.Catchup.Fetcher do _ -> 0 end end + + defp latest_block do + string_value = Application.get_env(:indexer, :last_block) + + case Integer.parse(string_value) do + {integer, ""} -> integer + _ -> nil + end + end end From bbf302d732ee1c626e6bdf6a6bfd17f20d949bb5 Mon Sep 17 00:00:00 2001 From: saneery Date: Mon, 29 Jul 2019 14:14:59 +0300 Subject: [PATCH 5/6] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8735521814..780de20f20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#2458](https://github.com/poanetwork/blockscout/pull/2458) - Add LAST_BLOCK var to index range of blocks ### Fixes From 8a225486703c3ee3b1904298b1662d975bfbaa1b Mon Sep 17 00:00:00 2001 From: saneery Date: Tue, 30 Jul 2019 13:57:22 +0300 Subject: [PATCH 6/6] Add entry about new var into doc --- docs/env-variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/env-variables.md b/docs/env-variables.md index d6dd56d7af..edb437ce2f 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -48,6 +48,7 @@ $ export NETWORK=POA | `BLOCK_TRANSFORMER` | | Transformer for blocks: base or clique. | base | v1.3.4+ | | `GRAPHIQL _TRANSACTION` | | Default transaction in query to GraphiQL. | (empty) | v1.3.4+ | | `FIRST_BLOCK` | | The block number, where indexing begins from. | 0 | v1.3.8+ | +| `LAST_BLOCK` | | The block number, where indexing stops. | (empty) | master | | `TXS_COUNT_CACHE_PERIOD` | | Interval in seconds to restart the task, which calculates the total txs count. | 60 * 60 * 2 | v1.3.9+ | | `ADDRESS_WITH_BALANCES`
`_UPDATE_INTERVAL`| | Interval in seconds to restart the task, which calculates addresses with balances. | 30 * 60 | v1.3.9+ | | `LINK_TO_OTHER_EXPLORERS` | | true/false. If true, links to other explorers are added in the footer | (empty) | v1.3.0+ |