Merge branch 'master' into ab-verify-smart-contracts-with-external-libs

pull/1400/head
Ayrat Badykov 6 years ago committed by GitHub
commit 21f1ec3ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex
  2. 7
      apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs
  3. 9
      apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex
  4. 7
      docker/Dockerfile
  5. 2
      docker/Makefile

@ -258,7 +258,14 @@ defmodule EthereumJSONRPC.Receipt do
defp entry_to_elixir({key, quantity}) defp entry_to_elixir({key, quantity})
when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex) do 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 end
defp entry_to_elixir({"logs" = key, logs}) do defp entry_to_elixir({"logs" = key, logs}) do

@ -30,4 +30,11 @@ defmodule EthereumJSONRPC.ReceiptTest do
assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"} assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"}
end end
end end
test "leaves nil if blockNumber is nil" do
assert Receipt.to_elixir(%{"blockNumber" => nil, "transactionHash" => "0x0"}) == %{
"transactionHash" => "0x0",
"blockNumber" => nil
}
end
end end

@ -3,6 +3,7 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do
Triggers a refetch if a given block doesn't have consensus. Triggers a refetch if a given block doesn't have consensus.
""" """
require Logger
alias Explorer.Chain alias Explorer.Chain
alias Explorer.Chain.Hash alias Explorer.Chain.Hash
@ -14,6 +15,14 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do
:ignore :ignore
_ -> _ ->
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 # trigger refetch if consensus=false or block was not found
Fetcher.fetch_and_import_block(number, block_fetcher, true) Fetcher.fetch_and_import_block(number, block_fetcher, true)
end end

@ -1,6 +1,6 @@
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 RUN apk --no-cache --update add automake libtool inotify-tools autoconf python
EXPOSE 4000 EXPOSE 4000
@ -19,6 +19,9 @@ RUN mix do deps.get, deps.compile
ADD . . 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 forderground build and phoenix digest
RUN mix compile RUN mix compile

@ -53,7 +53,7 @@ ifdef HAS_BLOCKSCOUT_IMAGE
@echo "==> Image exist. Using $(DOCKER_IMAGE)" @echo "==> Image exist. Using $(DOCKER_IMAGE)"
else else
@echo "==> No image found trying to build one..." @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 endif
migrate: build postgres migrate: build postgres

Loading…
Cancel
Save