From 24fb13233d8f85bbb9c969c792bade622f9e5c54 Mon Sep 17 00:00:00 2001 From: Andrew Cravenho Date: Wed, 30 Jan 2019 19:11:04 -0500 Subject: [PATCH 1/6] Add Chain Consensus Logging --- .../lib/indexer/block/realtime/consensus_ensurer.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex index a49a826a6b..a01cffeae1 100644 --- a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex +++ b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex @@ -3,6 +3,7 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do Triggers a refetch if a given block doesn't have consensus. """ + require Logger alias Explorer.Chain alias Explorer.Chain.Hash @@ -14,7 +15,14 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do :ignore _ -> - # trigger refetch if consensus=false or block was not found + Logger.info(fn -> + [ + "refetch from consensus was found on block (", + to_string(number), + "). A reorg initiated." + ] + end) + #trigger refetch if consensus=false or block was not found Fetcher.fetch_and_import_block(number, block_fetcher, true) end From f7456db04ceea56f99d0b8132b68ec7b5a393661 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 31 Jan 2019 12:55:42 +0300 Subject: [PATCH 2/6] fix receipts for pending transactions --- apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex | 9 ++++++++- .../test/ethereum_jsonrpc/receipt_test.exs | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex index c050776801..0a20f4ba5d 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex @@ -258,7 +258,14 @@ defmodule EthereumJSONRPC.Receipt do defp entry_to_elixir({key, quantity}) when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex) do - {:ok, {key, quantity_to_integer(quantity)}} + result = + if is_nil(quantity) do + nil + else + quantity_to_integer(quantity) + end + + {:ok, {key, result}} end defp entry_to_elixir({"logs" = key, logs}) do diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs index 38f5fa7a7a..b5ee4ae2ef 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs @@ -30,4 +30,11 @@ defmodule EthereumJSONRPC.ReceiptTest do assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"} end end + + test "leaves nil if blockNumber is nil" do + assert Receipt.to_elixir(%{"blockNumber" => nil, "transactionHash" => "0x0"}) == %{ + "transactionHash" => "0x0", + "blockNumber" => nil + } + end end From d2c74a4b6bc95174a7bc46687c82e317aa9d250e Mon Sep 17 00:00:00 2001 From: Andrew Cravenho Date: Fri, 1 Feb 2019 07:13:48 -0500 Subject: [PATCH 3/6] Fix formatting --- apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex index a01cffeae1..363f54fbed 100644 --- a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex +++ b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex @@ -22,7 +22,8 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do "). A reorg initiated." ] end) - #trigger refetch if consensus=false or block was not found + + # trigger refetch if consensus=false or block was not found Fetcher.fetch_and_import_block(number, block_fetcher, true) end From 5356e35857f119b1b5955e9273b0ba6b93827414 Mon Sep 17 00:00:00 2001 From: Michael Ira Krufky Date: Sat, 2 Feb 2019 19:38:00 -0500 Subject: [PATCH 4/6] Dockerfile: pin bitwalker/alpine-elixir-phoenix to image version 1.7.1 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9c1a4809e2..ca6fece635 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM bitwalker/alpine-elixir-phoenix:latest +FROM bitwalker/alpine-elixir-phoenix:1.7.1 RUN apk --no-cache --update add automake libtool inotify-tools autoconf From 3c8a6fb121d09252bb38b150ffafc44658b08c30 Mon Sep 17 00:00:00 2001 From: Michael Ira Krufky Date: Sat, 2 Feb 2019 19:40:14 -0500 Subject: [PATCH 5/6] Dockerfile: install missing python dependency --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ca6fece635..5962566355 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM bitwalker/alpine-elixir-phoenix:1.7.1 -RUN apk --no-cache --update add automake libtool inotify-tools autoconf +RUN apk --no-cache --update add automake libtool inotify-tools autoconf python EXPOSE 4000 From a55b97e92f8257ec688e518032a98900eebaac63 Mon Sep 17 00:00:00 2001 From: Michael Ira Krufky Date: Sun, 3 Feb 2019 08:03:34 -0500 Subject: [PATCH 6/6] Dockerfile: conditionally change coin name in gettext via env --- docker/Dockerfile | 3 +++ docker/Makefile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5962566355..a29c69baf4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,6 +19,9 @@ RUN mix do deps.get, deps.compile ADD . . +ARG COIN +RUN if [ "$COIN" != "" ]; then sed -i s/"POA"/"${COIN}"/g apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; fi + # Run forderground build and phoenix digest RUN mix compile diff --git a/docker/Makefile b/docker/Makefile index e280a753e5..1f49ff50b5 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -53,7 +53,7 @@ ifdef HAS_BLOCKSCOUT_IMAGE @echo "==> Image exist. Using $(DOCKER_IMAGE)" else @echo "==> No image found trying to build one..." - @docker build -f ./Dockerfile -t $(DOCKER_IMAGE) ../ + @docker build --build-arg COIN="$(COIN)" -f ./Dockerfile -t $(DOCKER_IMAGE) ../ endif migrate: build postgres