From e023ed454afbdfb08a7b4909176cc6d6defd28a5 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 6 Mar 2019 12:18:00 +0300 Subject: [PATCH] upgrade elixir to 1.8.1 --- .tool-versions | 2 +- README.md | 58 +++++++++---------- apps/block_scout_web/mix.exs | 4 +- .../lib/ethereum_jsonrpc/web_socket.ex | 6 +- apps/ethereum_jsonrpc/mix.exs | 4 +- apps/explorer/mix.exs | 4 +- .../smart_contract/publisher_test.exs | 2 +- .../solidity/code_compiler_test.exs | 2 +- .../explorer/smart_contract/verifier_test.exs | 2 +- apps/indexer/mix.exs | 4 +- mix.exs | 2 +- mix.lock | 4 +- rel/config.exs | 7 +-- 13 files changed, 50 insertions(+), 51 deletions(-) diff --git a/.tool-versions b/.tool-versions index bf2689b13f..dc46bc2cfb 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -elixir 1.7.1 +elixir 1.8.1 erlang 21.0.4 nodejs 10.11.0 diff --git a/README.md b/README.md index 15124e8cb2..0aa5158753 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ The [development stack page](https://github.com/poanetwork/blockscout/wiki/Devel | Dependency | Mac | Linux | |-------------|-----|-------| | [Erlang/OTP 21.0.4](https://github.com/erlang/otp) | `brew install erlang` | [Erlang Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L134) | -| [Elixir 1.7.1](https://elixir-lang.org/) | :point_up: | [Elixir Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L138) | +| [Elixir 1.8.1](https://elixir-lang.org/) | :point_up: | [Elixir Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L138) | | [Postgres 10.3](https://www.postgresql.org/) | `brew install postgresql` | [Postgres Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L187) | | [Node.js 10.5.0](https://nodejs.org/en/) | `brew install node` | [Node.js Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L66) | | [Automake](https://www.gnu.org/software/automake/) | `brew install automake` | [Automake Install Example](https://github.com/poanetwork/blockscout-terraform/blob/33f68e816e36dc2fb055911fa0372531f0e956e7/modules/stack/libexec/init.sh#L72) | @@ -88,31 +88,31 @@ The [development stack page](https://github.com/poanetwork/blockscout/wiki/Devel ### Build and Run - 1. Clone the repository. + 1. Clone the repository. `git clone https://github.com/poanetwork/blockscout` - 2. Go to the explorer subdirectory. + 2. Go to the explorer subdirectory. `cd blockscout` - 3. Set up default configurations. - `cp apps/explorer/config/dev.secret.exs.example apps/explorer/config/dev.secret.exs` + 3. Set up default configurations. + `cp apps/explorer/config/dev.secret.exs.example apps/explorer/config/dev.secret.exs` `cp apps/block_scout_web/config/dev.secret.exs.example apps/block_scout_web/config/dev.secret.exs`
Linux: Update the database username and password configuration in `apps/explorer/config/dev.secret.exs` -
Mac: Remove the `username` and `password` fields from `apps/explorer/config/dev.secret.exs` -
Optional: Set up default configuration for testing. - `cp apps/explorer/config/test.secret.exs.example apps/explorer/config/test.secret.exs` +
Mac: Remove the `username` and `password` fields from `apps/explorer/config/dev.secret.exs` +
Optional: Set up default configuration for testing. + `cp apps/explorer/config/test.secret.exs.example apps/explorer/config/test.secret.exs` Example usage: Changing the default Postgres port from localhost:15432 if [Boxen](https://github.com/boxen/boxen) is installed. - 4. Install dependencies. + 4. Install dependencies. `mix do deps.get, local.rebar --force, deps.compile, compile` - 5. Create and migrate database. - `mix ecto.create && mix ecto.migrate` -
_Note:_ If you have run previously, drop the previous database + 5. Create and migrate database. + `mix ecto.create && mix ecto.migrate` +
_Note:_ If you have run previously, drop the previous database `mix do ecto.drop, ecto.create, ecto.migrate` - 6. Install Node.js dependencies. - `cd apps/block_scout_web/assets && npm install; cd -` + 6. Install Node.js dependencies. + `cd apps/block_scout_web/assets && npm install; cd -` `cd apps/explorer && npm install; cd -` 7. Update your JSON RPC Variant in `apps/explorer/config/dev.exs` and `apps/indexer/config/dev.exs`. @@ -120,7 +120,7 @@ The [development stack page](https://github.com/poanetwork/blockscout/wiki/Devel 8. Update your JSON RPC Endpoint in `apps/explorer/config/dev/` and `apps/indexer/config/dev/` For the `variant` chosen in step 7, enter the correct information for the corresponding JSON RPC Endpoint in `parity.exs`, `geth.exs`, or `ganache.exs` - + 9. Enable HTTPS in development. The Phoenix server only runs with HTTPS. * `cd apps/block_scout_web` * `mix phx.gen.cert blockscout blockscout.local; cd -` @@ -132,14 +132,14 @@ The [development stack page](https://github.com/poanetwork/blockscout/wiki/Devel ``` * If using Chrome, Enable `chrome://flags/#allow-insecure-localhost`. - 9. Start Phoenix Server. + 9. Start Phoenix Server. `mix phx.server` Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. _Additional runtime options:_ -* Run Phoenix Server with IEx (Interactive Elixer) +* Run Phoenix Server with IEx (Interactive Elixer) `iex -S mix phx.server` * Run Phoenix Server with real time indexer @@ -204,29 +204,29 @@ To monitor build status, configure your local [CCMenu](http://ccmenu.org/) with #### Running the tests - 1. Build the assets. + 1. Build the assets. `cd apps/block_scout_web/assets && npm run build; cd -` - 2. Format the Elixir code. + 2. Format the Elixir code. `mix format` 3. Run the test suite with coverage for whole umbrella project. This step can be run with different configuration outlined below. `mix coveralls.html --umbrella` - 4. Lint the Elixir code. + 4. Lint the Elixir code. `mix credo --strict` - 5. Run the dialyzer. + 5. Run the dialyzer. `mix dialyzer --halt-exit-status` - 6. Check the Elixir code for vulnerabilities. - `cd apps/explorer && mix sobelow --config; cd -` + 6. Check the Elixir code for vulnerabilities. + `cd apps/explorer && mix sobelow --config; cd -` `cd apps/block_scout_web && mix sobelow --config; cd -` - 7. Lint the JavaScript code. + 7. Lint the JavaScript code. `cd apps/block_scout_web/assets && npm run eslint; cd -` - 8. Test the JavaScript code. + 8. Test the JavaScript code. `cd apps/block_scout_web/assets && npm run test; cd -` ##### Parity @@ -281,12 +281,12 @@ mix coveralls.html --umbrella --exclude no_geth To view Modules and API Reference documentation: -1. Generate documentation. +1. Generate documentation. `mix docs` -2. View the generated docs. +2. View the generated docs. `open doc/index.html` -## Front-end +## Front-end ### Javascript @@ -307,7 +307,7 @@ To understand how to build new pages that need redux in this project, see the [r The app is currently internationalized. It is only localized to U.S. English. To translate new strings. -1. To setup translation file. +1. To setup translation file. `cd apps/block_scout_web; mix gettext.extract --merge; cd -` 2. To edit the new strings, go to `apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po`. diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index 6b9ade4a74..dbaee13d48 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -15,7 +15,7 @@ defmodule BlockScoutWeb.Mixfile do plt_add_deps: :transitive, ignore_warnings: "../../.dialyzer-ignore" ], - elixir: "~> 1.6", + elixir: "~> 1.8", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", package: package(), @@ -122,7 +122,7 @@ defmodule BlockScoutWeb.Mixfile do # Tracing {:spandex, github: "spandex-project/spandex", branch: "allow-setting-trace-key", override: true}, # `:spandex` integration with Datadog - {:spandex_datadog, "~> 0.3.1"}, + {:spandex_datadog, "~> 0.4.0"}, # `:spandex` tracing of `:phoenix` {:spandex_phoenix, "~> 0.3.1"}, {:timex, "~> 3.4"}, diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex index a0523f2761..bdad4ea131 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket.ex @@ -37,14 +37,14 @@ defmodule EthereumJSONRPC.WebSocket do @doc """ Allow `c:start_link/1` to be called as part of a supervision tree. """ - @callback child_spec([url :: String.t() | options :: term()]) :: Supervisor.child_spec() + @callback child_spec([(url :: String.t()) | (options :: term())]) :: Supervisor.child_spec() @doc """ Starts web socket attached to `url` with `options`. """ # Return is same as `t:GenServer.on_start/0` - @callback start_link([url :: String.t() | options :: term()]) :: - {:ok, pid()} | :ignore | {:error, {:already_started, pid()} | reason :: term()} + @callback start_link([(url :: String.t()) | (options :: term())]) :: + {:ok, pid()} | :ignore | {:error, {:already_started, pid()} | (reason :: term())} @doc """ Run a single Remote Procedure Call (RPC) `t:EthereumJSONRPC.Transport.request/0` through `t:web_socket/0`. diff --git a/apps/ethereum_jsonrpc/mix.exs b/apps/ethereum_jsonrpc/mix.exs index 691ca91e9e..a805dbd649 100644 --- a/apps/ethereum_jsonrpc/mix.exs +++ b/apps/ethereum_jsonrpc/mix.exs @@ -15,7 +15,7 @@ defmodule EthereumJsonrpc.MixProject do plt_add_apps: [:mix], ignore_warnings: "../../.dialyzer-ignore" ], - elixir: "~> 1.6", + elixir: "~> 1.8", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", preferred_cli_env: [ @@ -80,7 +80,7 @@ defmodule EthereumJsonrpc.MixProject do # Tracing {:spandex, github: "spandex-project/spandex", branch: "allow-setting-trace-key", override: true}, # `:spandex` integration with Datadog - {:spandex_datadog, "~> 0.3.1"}, + {:spandex_datadog, "~> 0.4.0"}, # Convert unix timestamps in JSONRPC to DateTimes {:timex, "~> 3.4"}, # Encode/decode function names and arguments diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs index f110c9af8c..ee233e3386 100644 --- a/apps/explorer/mix.exs +++ b/apps/explorer/mix.exs @@ -15,7 +15,7 @@ defmodule Explorer.Mixfile do plt_add_apps: ~w(ex_unit mix)a, ignore_warnings: "../../.dialyzer-ignore" ], - elixir: "~> 1.6", + elixir: "~> 1.8", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", package: package(), @@ -108,7 +108,7 @@ defmodule Explorer.Mixfile do # Tracing {:spandex, github: "spandex-project/spandex", branch: "allow-setting-trace-key", override: true}, # `:spandex` integration with Datadog - {:spandex_datadog, "~> 0.3.1"}, + {:spandex_datadog, "~> 0.4.0"}, # `:spandex` tracing of `:ecto` {:spandex_ecto, "~> 0.4.0"}, # Attach `:prometheus_ecto` to `:ecto` diff --git a/apps/explorer/test/explorer/smart_contract/publisher_test.exs b/apps/explorer/test/explorer/smart_contract/publisher_test.exs index 003a9f68bf..2749da8ce2 100644 --- a/apps/explorer/test/explorer/smart_contract/publisher_test.exs +++ b/apps/explorer/test/explorer/smart_contract/publisher_test.exs @@ -99,7 +99,7 @@ defmodule Explorer.SmartContract.PublisherTest do test "validates and creates smart contract with external libraries" do contract_data = - "#{System.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" + "#{File.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" |> File.read!() |> Jason.decode!() |> List.first() diff --git a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs index b030c900bb..b48a6650af 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs @@ -6,7 +6,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do alias Explorer.Factory alias Explorer.SmartContract.Solidity.CodeCompiler - @compiler_tests "#{System.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" + @compiler_tests "#{File.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" |> File.read!() |> Jason.decode!() diff --git a/apps/explorer/test/explorer/smart_contract/verifier_test.exs b/apps/explorer/test/explorer/smart_contract/verifier_test.exs index 584bb568ef..92c23226f8 100644 --- a/apps/explorer/test/explorer/smart_contract/verifier_test.exs +++ b/apps/explorer/test/explorer/smart_contract/verifier_test.exs @@ -30,7 +30,7 @@ defmodule Explorer.SmartContract.VerifierTest do test "verifies the generated bytecode with external libraries" do contract_data = - "#{System.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" + "#{File.cwd!()}/test/support/fixture/smart_contract/compiler_tests.json" |> File.read!() |> Jason.decode!() |> List.first() diff --git a/apps/indexer/mix.exs b/apps/indexer/mix.exs index ad4807a767..9b8bd4d6ed 100644 --- a/apps/indexer/mix.exs +++ b/apps/indexer/mix.exs @@ -10,7 +10,7 @@ defmodule Indexer.MixProject do deps: deps(), deps_path: "../../deps", description: "Fetches block chain data from on-chain node for later reading with Explorer.", - elixir: "~> 1.6", + elixir: "~> 1.8", elixirc_paths: elixirc_paths(Mix.env()), lockfile: "../../mix.lock", preferred_cli_env: [ @@ -63,7 +63,7 @@ defmodule Indexer.MixProject do # Tracing {:spandex, github: "spandex-project/spandex", branch: "allow-setting-trace-key", override: true}, # `:spandex` integration with Datadog - {:spandex_datadog, "~> 0.3.1"} + {:spandex_datadog, "~> 0.4.0"} ] end diff --git a/mix.exs b/mix.exs index b76c81163c..47ee0f7a75 100644 --- a/mix.exs +++ b/mix.exs @@ -13,7 +13,7 @@ defmodule BlockScout.Mixfile do plt_add_apps: ~w(ex_unit mix)a, ignore_warnings: ".dialyzer-ignore" ], - elixir: "~> 1.6", + elixir: "~> 1.8", preferred_cli_env: [ coveralls: :test, "coveralls.detail": :test, diff --git a/mix.lock b/mix.lock index 0035d99eee..25c9621cc2 100644 --- a/mix.lock +++ b/mix.lock @@ -71,7 +71,7 @@ "mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm"}, "mock": {:hex, :mock, "0.3.2", "e98e998fd76c191c7e1a9557c8617912c53df3d4a6132f561eb762b699ef59fa", [:mix], [{:meck, "~> 0.8.8", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"}, "mox": {:hex, :mox, "0.4.0", "7f120840f7d626184a3d65de36189ca6f37d432e5d63acd80045198e4c5f7e6e", [:mix], [], "hexpm"}, - "msgpax": {:hex, :msgpax, "1.1.0", "e31625e256db2decca1ae2b841f21b4d2483b1332649ce3ebc96c7ff7a4986e3", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm"}, + "msgpax": {:hex, :msgpax, "2.2.2", "559a07806bbe5fdd31e4597455be030bd96356f7a621ca9eed832747c83bfb67", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm"}, "parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], []}, @@ -98,7 +98,7 @@ "set_locale": {:git, "https://github.com/minifast/set_locale.git", "da9ae029642bc0fbd9212c2aaf86c0adca70c084", [branch: "master"]}, "sobelow": {:hex, :sobelow, "0.7.4", "228cc6185b448b63ecc88429b43e864e8dd570e8e09f2d04b3aa71894db1bdbb", [:mix], [], "hexpm"}, "spandex": {:git, "https://github.com/spandex-project/spandex.git", "92992b4aaf3d92e031c2417ff2e6c9e94d27fe36", [branch: "allow-setting-trace-key"]}, - "spandex_datadog": {:hex, :spandex_datadog, "0.3.1", "984d27ad1f45cfd243509692f0f63b900a23b79566c529a644c7f3a2b4120603", [:mix], [{:msgpax, "~> 1.1", [hex: :msgpax, repo: "hexpm", optional: false]}, {:spandex, "~> 2.3", [hex: :spandex, repo: "hexpm", optional: false]}], "hexpm"}, + "spandex_datadog": {:hex, :spandex_datadog, "0.4.0", "75113a73e843123074886a2e31994af07d6e0632749a8d97e9ca6157b120c287", [:mix], [{:msgpax, "~> 2.2.1", [hex: :msgpax, repo: "hexpm", optional: false]}, {:spandex, "~> 2.3", [hex: :spandex, repo: "hexpm", optional: false]}], "hexpm"}, "spandex_ecto": {:hex, :spandex_ecto, "0.4.0", "deaeaddc11a35f1c551206c53d09bb93a0da5808dbef751430e465c8c7de01d3", [:mix], [{:spandex, "~> 2.2", [hex: :spandex, repo: "hexpm", optional: false]}], "hexpm"}, "spandex_phoenix": {:hex, :spandex_phoenix, "0.3.1", "9cb9a4a9f2161f171d9df9afa1289a0d037abbbeecabae674f959b57f106f201", [:mix], [{:plug, "~> 1.3", [hex: :plug, repo: "hexpm", optional: false]}, {:spandex, "~> 2.2", [hex: :spandex, repo: "hexpm", optional: false]}], "hexpm"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.4", "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], [], "hexpm"}, diff --git a/rel/config.exs b/rel/config.exs index 1a390a369a..8227d36621 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -12,10 +12,10 @@ defer = fn fun -> end app_root = fn -> - if String.contains?(System.cwd!(), "apps") do - Path.join([System.cwd!(), "/../../"]) + if String.contains?(File.cwd!(), "apps") do + Path.join([File.cwd!(), "/../../"]) else - System.cwd!() + File.cwd!() end end @@ -82,4 +82,3 @@ release :blockscout do seed: "rel/commands/seed.sh", ] end -