diff --git a/.circleci/config.yml b/.circleci/config.yml
index 53e5680e78..f410162b48 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -3,7 +3,7 @@ jobs:
build:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1-node-browsers
+ - image: circleci/elixir:1.9.0-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.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
@@ -143,7 +143,7 @@ jobs:
credo:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
@@ -177,7 +177,7 @@ jobs:
dialyzer:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
@@ -191,9 +191,9 @@ jobs:
- restore_cache:
keys:
- - v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- - v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- - v7-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
@@ -213,15 +213,15 @@ jobs:
cp ~/.mix/dialyxir*.plt plts/
- save_cache:
- key: v7-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: v7-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: v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
+ key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
paths:
- plts
@@ -247,7 +247,7 @@ jobs:
gettext:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
@@ -286,7 +286,7 @@ jobs:
release:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: prod
@@ -298,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: |
@@ -312,7 +312,7 @@ jobs:
sobelow:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
@@ -336,7 +336,7 @@ jobs:
test_geth_http_websocket:
docker:
# Ensure .tool-versions matches
- - image: circleci/elixir:1.8.1-node-browsers
+ - image: circleci/elixir:1.9.0-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.8.1-node-browsers
+ - image: circleci/elixir:1.9.0-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.8.1-node-browsers
+ - image: circleci/elixir:1.9.0-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.8.1-node-browsers
+ - image: circleci/elixir:1.9.0-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.8.1
+ - image: circleci/elixir:1.9.0
environment:
MIX_ENV: test
diff --git a/.dialyzer-ignore b/.dialyzer-ignore
index f017f1f6fc..de105bbd51 100644
--- a/.dialyzer-ignore
+++ b/.dialyzer-ignore
@@ -2,8 +2,12 @@
: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'
\ No newline at end of file
+apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true'
diff --git a/.tool-versions b/.tool-versions
index dc46bc2cfb..71379b2fa7 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,3 +1,3 @@
-elixir 1.8.1
+elixir 1.9
erlang 21.0.4
nodejs 10.11.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7cd9165b22..b9c8934f3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,15 @@
## Current
### Features
+- [#2379](https://github.com/poanetwork/blockscout/pull/2379) - Disable network selector when is empty
+- [#2360](https://github.com/poanetwork/blockscout/pull/2360) - add default evm version to smart contract verification
- [#2352](https://github.com/poanetwork/blockscout/pull/2352) - Fetch rewards in parallel with transactions
- [#2294](https://github.com/poanetwork/blockscout/pull/2294) - add healthy block period checking endpoint
### Fixes
+- [#2378](https://github.com/poanetwork/blockscout/pull/2378) - Page performance: exclude moment.js localization files except EN, remove unused css
+- [#2368](https://github.com/poanetwork/blockscout/pull/2368) - add two columns of smart contract info
+- [#2375](https://github.com/poanetwork/blockscout/pull/2375) - Update created_contract_code_indexed_at on transaction import conflict
- [#2346](https://github.com/poanetwork/blockscout/pull/2346) - Avoid fetching internal transactions of blocks that still need refetching
- [#2350](https://github.com/poanetwork/blockscout/pull/2350) - fix invalid User agent headers
- [#2345](https://github.com/poanetwork/blockscout/pull/2345) - do not override existing market records
@@ -27,8 +32,8 @@
- [#2302](https://github.com/poanetwork/blockscout/pull/2302) - fix names for xDai source
- [#2289](https://github.com/poanetwork/blockscout/pull/2289) - Optional websockets for dev environment
- [#2307](https://github.com/poanetwork/blockscout/pull/2307) - add GoJoy to README
-
- [#2293](https://github.com/poanetwork/blockscout/pull/2293) - remove request idle timeout configuration
+- [#2255](https://github.com/poanetwork/blockscout/pull/2255) - bump elixir version to 1.9.0
## 2.0.1-beta
@@ -115,6 +120,7 @@
### Chore
- [#2127](https://github.com/poanetwork/blockscout/pull/2127) - use previouse chromedriver version
- [#2118](https://github.com/poanetwork/blockscout/pull/2118) - show only the last decompiled contract
+- [#2255](https://github.com/poanetwork/blockscout/pull/2255) - upgrade elixir version to 1.9.0
- [#2256](https://github.com/poanetwork/blockscout/pull/2256) - use the latest version of chromedriver
## 2.0.0-beta
diff --git a/apps/block_scout_web/assets/css/components/_footer.scss b/apps/block_scout_web/assets/css/components/_footer.scss
index be1c10d44a..f2eae03c3f 100644
--- a/apps/block_scout_web/assets/css/components/_footer.scss
+++ b/apps/block_scout_web/assets/css/components/_footer.scss
@@ -61,10 +61,6 @@ $footer-logo-width: auto !default;
}
}
-.footer-info {
- padding-top: 1em;
-}
-
.footer-link {
color: $footer-link-color;
diff --git a/apps/block_scout_web/assets/css/components/_network-selector.scss b/apps/block_scout_web/assets/css/components/_network-selector.scss
index 8c433f28c3..e8b5f72e78 100644
--- a/apps/block_scout_web/assets/css/components/_network-selector.scss
+++ b/apps/block_scout_web/assets/css/components/_network-selector.scss
@@ -287,16 +287,6 @@ $network-selector-item-icon-dimensions: 30px !default;
}
}
-.network-selector-load-more-container {
- flex-shrink: 1;
- padding: 0 $network-selector-horizontal-padding;
-
- .btn-network-selector-load-more {
- @include btn-line($btn-network-selector-load-more-background, $btn-network-selector-load-more-color);
- width: 100%;
- }
-}
-
.network-selector-item-favorite {
align-items: center;
cursor: pointer;
diff --git a/apps/block_scout_web/assets/webpack.config.js b/apps/block_scout_web/assets/webpack.config.js
index 63c796d3f7..08a2f410e7 100644
--- a/apps/block_scout_web/assets/webpack.config.js
+++ b/apps/block_scout_web/assets/webpack.config.js
@@ -1,6 +1,7 @@
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
+const { ContextReplacementPlugin } = require('webpack')
const glob = require("glob");
function transpileViewScript(file) {
@@ -74,7 +75,8 @@ const appJs =
},
plugins: [
new ExtractTextPlugin('../css/app.css'),
- new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
+ new CopyWebpackPlugin([{ from: 'static/', to: '../' }]),
+ new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/)
]
}
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex
index 32f77425ca..340765a97f 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex
@@ -23,12 +23,22 @@
<%= if BlockScoutWeb.AddressView.smart_contract_verified?(@address) do %>
- - <%= gettext "Contract name:" %>
- - <%= @address.smart_contract.name %>
+ - <%= gettext "Contract name:" %>
+ - <%= @address.smart_contract.name %>
+
+
+ - <%= gettext "Optimization enabled" %>
+ - <%= format_optimization_text(@address.smart_contract.optimization) %>
- - <%= gettext "Compiler version" %>
- - <%= @address.smart_contract.compiler_version %>
+ - <%= gettext "Compiler version" %>
+ - <%= @address.smart_contract.compiler_version %>
+
+
+ <%= if @address.smart_contract.optimization && @address.smart_contract.optimization_runs do %>
+ - <%= gettext "Optimization runs" %>
+ - <%= @address.smart_contract.optimization_runs %>
+ <% end %>
<%= if @address.smart_contract.evm_version do %>
@@ -36,16 +46,6 @@
- <%= @address.smart_contract.evm_version %>
<% end %>
-
- - <%= gettext "Optimization enabled" %>
- - <%= format_optimization_text(@address.smart_contract.optimization) %>
-
- <%= if @address.smart_contract.optimization && @address.smart_contract.optimization_runs do %>
-
- - <%= gettext "Optimization runs" %>
- - <%= @address.smart_contract.optimization_runs %>
-
- <% end %>
<%= if @address.smart_contract.constructor_arguments do %>
- <%= gettext "Constructor arguments" %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex
index fd93b0af2b..e73e1434f0 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex
@@ -50,7 +50,7 @@
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
index 3ae4779284..4287a215e9 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
@@ -86,7 +86,7 @@
<% end %>
- " href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ " href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= render BlockScoutWeb.IconsView, "_active_icon.html" %>
diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs
index 02e9d203fb..e431d4ecf5 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.8",
+ elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
lockfile: "../../mix.lock",
package: package(),
diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot
index 021b81144e..af9f1a66a5 100644
--- a/apps/block_scout_web/priv/gettext/default.pot
+++ b/apps/block_scout_web/priv/gettext/default.pot
@@ -230,7 +230,7 @@ msgid "Compiler"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:30
+#: lib/block_scout_web/templates/address_contract/index.html.eex:34
msgid "Compiler version"
msgstr ""
@@ -509,11 +509,13 @@ msgstr ""
#: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:121
+#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:129
+#: lib/block_scout_web/views/transaction_view.ex:129
msgid "Max of"
msgstr ""
@@ -577,7 +579,7 @@ msgid "OUT"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:40
+#: lib/block_scout_web/templates/address_contract/index.html.eex:30
msgid "Optimization enabled"
msgstr ""
@@ -1487,7 +1489,7 @@ msgid "Search by address, token symbol name, transaction hash, or block number"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:35
+#: lib/block_scout_web/templates/address_contract/index.html.eex:45
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:51
msgid "EVM Version"
msgstr ""
@@ -1518,7 +1520,7 @@ msgid "Decompiler version"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:45
+#: lib/block_scout_web/templates/address_contract/index.html.eex:39
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:83
msgid "Optimization runs"
msgstr ""
diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
index abd5fcd3a3..73e720b110 100644
--- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
+++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
@@ -230,7 +230,7 @@ msgid "Compiler"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:30
+#: lib/block_scout_web/templates/address_contract/index.html.eex:34
msgid "Compiler version"
msgstr ""
@@ -509,11 +509,13 @@ msgstr ""
#: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:121
+#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:129
+#: lib/block_scout_web/views/transaction_view.ex:129
msgid "Max of"
msgstr ""
@@ -577,7 +579,7 @@ msgid "OUT"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:40
+#: lib/block_scout_web/templates/address_contract/index.html.eex:30
msgid "Optimization enabled"
msgstr ""
@@ -1487,7 +1489,7 @@ msgid "Search by address, token symbol name, transaction hash, or block number"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:35
+#: lib/block_scout_web/templates/address_contract/index.html.eex:45
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:51
msgid "EVM Version"
msgstr ""
@@ -1518,7 +1520,7 @@ msgid "Decompiler version"
msgstr ""
#, elixir-format
-#: lib/block_scout_web/templates/address_contract/index.html.eex:45
+#: lib/block_scout_web/templates/address_contract/index.html.eex:39
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:83
msgid "Optimization runs"
msgstr ""
diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex
index 82e4a54072..c1de043499 100644
--- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex
+++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex
@@ -209,14 +209,20 @@ defmodule EthereumJSONRPC.RollingWindow do
@doc """
Display the raw contents of all windows for a given key.
"""
- @spec inspect(table :: atom, key :: term()) :: nonempty_list(non_neg_integer)
+ @spec inspect(table :: atom, key :: term()) :: nonempty_list(non_neg_integer) | []
def inspect(table, key) do
- case :ets.lookup(table, key) do
- [{_, current_window, windows}] ->
- [current_window | windows]
-
- _ ->
+ case :ets.whereis(table) do
+ :undefined ->
[]
+
+ tid ->
+ case :ets.lookup(tid, key) do
+ [{_, current_window, windows}] ->
+ [current_window | windows]
+
+ _ ->
+ []
+ end
end
end
end
diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex
index 1301fa5675..dc7f1839a6 100644
--- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex
+++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transport.ex
@@ -88,10 +88,6 @@ defmodule EthereumJSONRPC.Transport do
`%{"id" => ..., "error" => reason}`. The transport can also give any `term()` for `reason` if a more specific
reason is possible.
- """
- @callback json_rpc(request, options) :: {:ok, result} | {:error, reason :: term()}
-
- @doc """
Runs a batch of Remote Procedure Call (RPC) `request`s with `options`.
## Returns
@@ -99,8 +95,9 @@ defmodule EthereumJSONRPC.Transport do
* `{:ok, [response]}` unlike `json_rpc(request, options)`, the individual `t:response.t/0` are not unwrapped and it
is the callers responsibility to extract the `t:result/0` or error `reason`.
* `{:error, reason}` an error that affects *all* `t:request/0`s, such as the batch as a whole being rejected.
-
"""
+ @callback json_rpc(request, options) :: {:ok, result} | {:error, reason :: term()}
+
@callback json_rpc(batch_request, options) :: {:ok, batch_response} | {:error, reason :: term()}
@doc """
diff --git a/apps/ethereum_jsonrpc/mix.exs b/apps/ethereum_jsonrpc/mix.exs
index a805dbd649..7c2299c4a8 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.8",
+ elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
lockfile: "../../mix.lock",
preferred_cli_env: [
diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs
index 25b7e41382..43f400434a 100644
--- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs
+++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs
@@ -10,7 +10,10 @@ defmodule EthereumJSONRPC.RollingWindowTest do
setup do
# We set `window_length` to a large time frame so that we can sweep manually to simulate
# time passing
- RollingWindow.start_link([table: @table, duration: :timer.minutes(120), window_count: 3], name: RollingWindow)
+ {:ok, pid} =
+ RollingWindow.start_link([table: @table, duration: :timer.minutes(120), window_count: 3], name: RollingWindow)
+
+ on_exit(fn -> Process.exit(pid, :normal) end)
:ok
end
diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs
index 65528753eb..defd5ae9e5 100644
--- a/apps/explorer/config/config.exs
+++ b/apps/explorer/config/config.exs
@@ -12,7 +12,7 @@ config :explorer,
token_functions_reader_max_retries: 3,
allowed_evm_versions:
System.get_env("ALLOWED_EVM_VERSIONS") ||
- "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg",
+ "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,default",
include_uncles_in_average_block_time:
if(System.get_env("UNCLES_IN_AVERAGE_BLOCK_TIME") == "false", do: false, else: true),
healthy_blocks_period: System.get_env("HEALTHY_BLOCKS_PERIOD") || :timer.minutes(5)
diff --git a/apps/explorer/lib/explorer/chain/import/runner/transactions.ex b/apps/explorer/lib/explorer/chain/import/runner/transactions.ex
index 2c36d7c7e5..570d934218 100644
--- a/apps/explorer/lib/explorer/chain/import/runner/transactions.ex
+++ b/apps/explorer/lib/explorer/chain/import/runner/transactions.ex
@@ -105,6 +105,7 @@ defmodule Explorer.Chain.Import.Runner.Transactions do
old_block_hash: transaction.block_hash,
block_number: fragment("EXCLUDED.block_number"),
created_contract_address_hash: fragment("EXCLUDED.created_contract_address_hash"),
+ created_contract_code_indexed_at: fragment("EXCLUDED.created_contract_code_indexed_at"),
cumulative_gas_used: fragment("EXCLUDED.cumulative_gas_used"),
error: fragment("EXCLUDED.error"),
from_address_hash: fragment("EXCLUDED.from_address_hash"),
@@ -128,10 +129,11 @@ defmodule Explorer.Chain.Import.Runner.Transactions do
],
where:
fragment(
- "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.created_contract_address_hash, EXCLUDED.cumulative_gas_used, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.internal_transactions_indexed_at, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ "(EXCLUDED.block_hash, EXCLUDED.block_number, EXCLUDED.created_contract_address_hash, EXCLUDED.created_contract_code_indexed_at, EXCLUDED.cumulative_gas_used, EXCLUDED.cumulative_gas_used, EXCLUDED.from_address_hash, EXCLUDED.gas, EXCLUDED.gas_price, EXCLUDED.gas_used, EXCLUDED.index, EXCLUDED.internal_transactions_indexed_at, EXCLUDED.input, EXCLUDED.nonce, EXCLUDED.r, EXCLUDED.s, EXCLUDED.status, EXCLUDED.to_address_hash, EXCLUDED.v, EXCLUDED.value) IS DISTINCT FROM (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
transaction.block_hash,
transaction.block_number,
transaction.created_contract_address_hash,
+ transaction.created_contract_code_indexed_at,
transaction.cumulative_gas_used,
transaction.cumulative_gas_used,
transaction.from_address_hash,
diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs
index 2e9ad1a248..4956363cc4 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.8",
+ elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
lockfile: "../../mix.lock",
package: package(),
diff --git a/apps/explorer/priv/compile_solc.js b/apps/explorer/priv/compile_solc.js
index 99048d9ffd..e6ba69c300 100755
--- a/apps/explorer/priv/compile_solc.js
+++ b/apps/explorer/priv/compile_solc.js
@@ -16,15 +16,7 @@ var solc = solc.setupMethods(compilerSnapshot);
var fs = require('fs');
var sourceCode = fs.readFileSync(sourceCodePath, 'utf8');
-const input = {
- language: 'Solidity',
- sources: {
- [newContractName]: {
- content: sourceCode
- }
- },
- settings: {
- evmVersion: evmVersion,
+var settings = {
optimizer: {
enabled: optimize == '1',
runs: optimizationRuns
@@ -37,7 +29,20 @@ const input = {
'*': ['*']
}
}
- }
+}
+
+if (evmVersion !== 'default') {
+ settings = Object.assign(settings, {evmVersion: evmVersion})
+}
+
+const input = {
+ language: 'Solidity',
+ sources: {
+ [newContractName]: {
+ content: sourceCode
+ }
+ },
+ settings: settings
}
diff --git a/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs b/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs
new file mode 100644
index 0000000000..2bfea8750b
--- /dev/null
+++ b/apps/explorer/test/explorer/chain/import/runner/transactions_test.exs
@@ -0,0 +1,50 @@
+defmodule Explorer.Chain.Import.Runner.TransactionsTest do
+ use Explorer.DataCase
+
+ alias Ecto.Multi
+ alias Explorer.Chain.{Address, Transaction}
+ alias Explorer.Chain.Import.Runner.Transactions
+
+ describe "run/1" do
+ test "transaction's created_contract_code_indexed_at is modified on update" do
+ %Address{hash: address_hash} = insert(:address)
+
+ transaction =
+ insert(:transaction,
+ created_contract_address_hash: address_hash,
+ created_contract_code_indexed_at: DateTime.utc_now()
+ )
+
+ assert not is_nil(transaction.created_contract_code_indexed_at)
+
+ non_indexed_transaction_params = %{
+ from_address_hash: transaction.from_address.hash,
+ gas: transaction.gas,
+ gas_price: transaction.gas_price,
+ hash: transaction.hash,
+ input: transaction.input,
+ nonce: transaction.nonce,
+ r: transaction.r,
+ s: transaction.s,
+ to_address_hash: transaction.to_address.hash,
+ v: transaction.v,
+ value: transaction.value,
+ created_contract_address_hash: address_hash,
+ created_contract_code_indexed_at: nil
+ }
+
+ assert {:ok, _} = run_transactions([non_indexed_transaction_params])
+
+ assert is_nil(Repo.get(Transaction, transaction.hash).created_contract_code_indexed_at)
+ end
+ end
+
+ defp run_transactions(changes_list) when is_list(changes_list) do
+ Multi.new()
+ |> Transactions.run(changes_list, %{
+ timeout: :infinity,
+ timestamps: %{inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now()}
+ })
+ |> Repo.transaction()
+ end
+end
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 d1c1d04b45..29674274ca 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
@@ -53,6 +53,26 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do
}} = response
end
+ test "compiles smart contract with default evm version", %{contract_code_info: contract_code_info} do
+ optimize = true
+
+ response =
+ CodeCompiler.run(
+ name: contract_code_info.name,
+ compiler_version: contract_code_info.version,
+ code: contract_code_info.source_code,
+ optimize: optimize,
+ evm_version: "default"
+ )
+
+ assert {:ok,
+ %{
+ "abi" => _,
+ "bytecode" => _,
+ "name" => _
+ }} = response
+ end
+
test "compiles code with external libraries" do
Enum.each(@compiler_tests, fn compiler_test ->
compiler_version = compiler_test["compiler_version"]
diff --git a/apps/indexer/mix.exs b/apps/indexer/mix.exs
index f70d758912..5b95f4ab5c 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.8",
+ elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
lockfile: "../../mix.lock",
preferred_cli_env: [
diff --git a/docs/requirements.md b/docs/requirements.md
index 2df13c6936..c64558afbc 100644
--- a/docs/requirements.md
+++ b/docs/requirements.md
@@ -5,7 +5,7 @@
| 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.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) |
+| [Elixir 1.9.0](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.x.x](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) |
diff --git a/mix.exs b/mix.exs
index 47ee0f7a75..c6c74689f9 100644
--- a/mix.exs
+++ b/mix.exs
@@ -6,6 +6,7 @@ defmodule BlockScout.Mixfile do
def project do
[
aliases: aliases(Mix.env()),
+ version: "2.0",
apps_path: "apps",
deps: deps(),
dialyzer: [
@@ -13,7 +14,7 @@ defmodule BlockScout.Mixfile do
plt_add_apps: ~w(ex_unit mix)a,
ignore_warnings: ".dialyzer-ignore"
],
- elixir: "~> 1.8",
+ elixir: "~> 1.9",
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
@@ -23,7 +24,17 @@ defmodule BlockScout.Mixfile do
dialyzer: :test
],
start_permanent: Mix.env() == :prod,
- test_coverage: [tool: ExCoveralls]
+ test_coverage: [tool: ExCoveralls],
+ releases: [
+ blockscout: [
+ applications: [
+ block_scout_web: :permanent,
+ ethereum_jsonrpc: :permanent,
+ explorer: :permanent,
+ indexer: :permanent
+ ]
+ ]
+ ]
]
end
@@ -61,8 +72,6 @@ defmodule BlockScout.Mixfile do
# and cannot be accessed from applications inside the apps folder
defp deps do
[
- # Release
- {:distillery, "~> 2.0", runtime: false},
# Documentation
{:ex_doc, "~> 0.19.0", only: [:dev]},
# Code coverage