Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request blockscout#14 from celo-org/feature/sync_upstream
Browse files Browse the repository at this point in the history
Syncing with upstream (1)
  • Loading branch information
jcortejoso committed Oct 17, 2019
2 parents f6c3e08 + e3051b7 commit 4579f3b
Show file tree
Hide file tree
Showing 977 changed files with 57,589 additions and 14,689 deletions.
85 changes: 52 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2-node-browsers
- image: circleci/elixir:1.9.1-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
Expand All @@ -17,6 +17,9 @@ jobs:
- run: sudo apt-get update; sudo apt-get -y install autoconf build-essential libgmp3-dev libtool

- checkout
- run:
command: ./bin/install_chrome_headless.sh
no_output_timeout: 2400

- run: mix local.hex --force
- run: mix local.rebar --force
Expand All @@ -30,17 +33,17 @@ jobs:

- restore_cache:
keys:
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
- v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}

- run: mix deps.get

- restore_cache:
keys:
- v6-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
- v6-npm-install-{{ .Branch }}
- v6-npm-install
- v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
- v7-npm-install-{{ .Branch }}
- v7-npm-install

- run:
command: npm install
Expand All @@ -61,13 +64,13 @@ jobs:
working_directory: "apps/block_scout_web/assets"

- save_cache:
key: v6-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
key: v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
paths: "apps/block_scout_web/assets/node_modules"
- save_cache:
key: v6-npm-install-{{ .Branch }}
key: v7-npm-install-{{ .Branch }}
paths: "apps/block_scout_web/assets/node_modules"
- save_cache:
key: v6-npm-install
key: v7-npm-install
paths: "apps/block_scout_web/assets/node_modules"

- run: mix compile
Expand All @@ -80,17 +83,17 @@ jobs:
# `deps` needs to be cached with `_build` because `_build` will symlink into `deps`

- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
paths:
- deps
- _build
- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
paths:
- deps
- _build
- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
paths:
- deps
- _build
Expand Down Expand Up @@ -126,7 +129,7 @@ jobs:
check_formatted:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand All @@ -140,7 +143,7 @@ jobs:
credo:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand Down Expand Up @@ -174,7 +177,7 @@ jobs:
dialyzer:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand All @@ -188,9 +191,9 @@ jobs:

- restore_cache:
keys:
- v6-mix-dailyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
- v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}

- run:
name: Unpack PLT cache
Expand All @@ -210,15 +213,15 @@ jobs:
cp ~/.mix/dialyxir*.plt plts/
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
paths:
- plts
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
paths:
- plts
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
paths:
- plts

Expand All @@ -244,7 +247,7 @@ jobs:
gettext:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand Down Expand Up @@ -283,7 +286,7 @@ jobs:
release:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: prod

Expand All @@ -295,7 +298,7 @@ jobs:

- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix release --verbose --env prod
- run: MIX_ENV=prod mix release
- run:
name: Collecting artifacts
command: |
Expand All @@ -309,7 +312,7 @@ jobs:
sobelow:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand All @@ -333,7 +336,7 @@ jobs:
test_geth_http_websocket:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2-node-browsers
- image: circleci/elixir:1.9.1-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
Expand All @@ -357,6 +360,10 @@ jobs:
- attach_workspace:
at: .

- run:
command: ./bin/install_chrome_headless.sh
no_output_timeout: 2400

- run: mix local.hex --force
- run: mix local.rebar --force

Expand All @@ -383,7 +390,7 @@ jobs:
test_geth_mox:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2-node-browsers
- image: circleci/elixir:1.9.1-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
Expand All @@ -407,6 +414,10 @@ jobs:
- attach_workspace:
at: .

- run:
command: ./bin/install_chrome_headless.sh
no_output_timeout: 2400

- run: mix local.hex --force
- run: mix local.rebar --force

Expand All @@ -433,7 +444,7 @@ jobs:
test_parity_http_websocket:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2-node-browsers
- image: circleci/elixir:1.9.1-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
Expand All @@ -457,6 +468,10 @@ jobs:
- attach_workspace:
at: .

- run:
command: ./bin/install_chrome_headless.sh
no_output_timeout: 2400

- run: mix local.hex --force
- run: mix local.rebar --force

Expand All @@ -465,7 +480,7 @@ jobs:
command: dockerize -wait tcp://localhost:5432 -timeout 1m

- run:
name: mix test --exclude no_geth
name: mix test --exclude no_parity
command: |
# Don't submit coverage report for forks, but let the build succeed
if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then
Expand All @@ -483,7 +498,7 @@ jobs:
test_parity_mox:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2-node-browsers
- image: circleci/elixir:1.9.1-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
Expand All @@ -507,6 +522,10 @@ jobs:
- attach_workspace:
at: .

- run:
command: ./bin/install_chrome_headless.sh
no_output_timeout: 2400

- run: mix local.hex --force
- run: mix local.rebar --force

Expand All @@ -515,7 +534,7 @@ jobs:
command: dockerize -wait tcp://localhost:5432 -timeout 1m

- run:
name: mix test --exclude no_geth
name: mix test --exclude no_parity
command: |
# Don't submit coverage report for forks, but let the build succeed
if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then
Expand All @@ -533,7 +552,7 @@ jobs:
coveralls_merge:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.7.2
- image: circleci/elixir:1.9.1
environment:
MIX_ENV: test

Expand Down
6 changes: 4 additions & 2 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
{Credo.Check.Readability.TrailingBlankLine, false},
{Credo.Check.Readability.TrailingWhiteSpace, false},

# outdated by lazy Logger in Elixir 1.7. See https://elixir-lang.org/blog/2018/07/25/elixir-v1-7-0-released/
{Credo.Check.Warning.LazyLogging, false},

# not handled by formatter
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.ParameterPatternMatching},
Expand All @@ -86,7 +89,7 @@
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
#
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
{Credo.Check.Design.DuplicatedCode, excluded_macros: [], mass_threshold: 80},

# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
Expand Down Expand Up @@ -118,7 +121,6 @@
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect},
{Credo.Check.Warning.LazyLogging},
{Credo.Check.Warning.OperationOnSameValues},
{Credo.Check.Warning.OperationWithConstantResult},
{Credo.Check.Warning.UnusedEnumOperation},
Expand Down
12 changes: 12 additions & 0 deletions .dialyzer-ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
:0: Unknown function 'Elixir.ExUnit.Callbacks':'__merge__'/3
:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2
:0: Unknown type 'Elixir.Map':t/0
apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return
lib/block_scout_web/views/layout_view.ex:174: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t()
lib/explorer/repo/prometheus_logger.ex:8
lib/block_scout_web/views/layout_view.ex:175
lib/explorer/smart_contract/publisher_worker.ex:6
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer()
apps/block_scout_web/lib/block_scout_web/views/layout_view.ex:175: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t()
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'false' can never match the type 'true'
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true'
lib/block_scout_web/router.ex:1
lib/phoenix/router.ex:324
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
elixir 1.7.1
erlang 21.0.4
elixir 1.9.1-otp-22
erlang 22.0
nodejs 10.11.0

0 comments on commit 4579f3b

Please sign in to comment.