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 d2541db02f..50c1eb09aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ ## 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 - [#2324](https://github.com/poanetwork/blockscout/pull/2324) - set timeout for loading message on the main page ### 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 @@ -19,6 +25,7 @@ - [#2326](https://github.com/poanetwork/blockscout/pull/2326) - fix nested constructor arguments ### Chore +- [#2363](https://github.com/poanetwork/blockscout/pull/2363) - add parameters example for eth rpc - [#2342](https://github.com/poanetwork/blockscout/pull/2342) - Upgrade Postgres image version in Docker setup - [#2325](https://github.com/poanetwork/blockscout/pull/2325) - Reduce function input to address' hash only where possible - [#2323](https://github.com/poanetwork/blockscout/pull/2323) - Group Explorer caches @@ -26,8 +33,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 @@ -114,6 +121,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/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index dc71bed50b..f6d9b8a30f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -23,7 +23,8 @@ defmodule BlockScoutWeb.AddressTransactionController do [token_transfers: :token] => :optional, [token_transfers: :to_address] => :optional, [token_transfers: :from_address] => :optional, - [token_transfers: :token_contract_address] => :optional + [token_transfers: :token_contract_address] => :optional, + :block => :required } ] @@ -34,7 +35,6 @@ defmodule BlockScoutWeb.AddressTransactionController do {:ok, address} <- Chain.hash_to_address(address_hash, address_options, false) do options = @transaction_necessity_by_association - |> put_in([:necessity_by_association, :block], :required) |> Keyword.merge(paging_options(params)) |> Keyword.merge(current_filter(params)) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/eth_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/eth_controller.ex index bb386940b1..028084e73f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/eth_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/eth_controller.ex @@ -12,12 +12,18 @@ defmodule BlockScoutWeb.API.RPC.EthController do notes: """ the `earliest` parameter will not work as expected currently, because genesis block balances are not currently imported + """, + example: """ + {"id": 0, "jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0x0000000000000000000000000000000000000007", "2"]} """ }, "eth_getLogs" => %{ action: :eth_get_logs, notes: """ Will never return more than 1000 log entries. + """, + example: """ + {"id": 0, "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"address": "0x0000000000000000000000000000000000000026","topics": ["0x01"]}]} """ } } 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 @@
<%= label :evm_version, :evm_version, gettext("EVM Version") %>
- <%= select f, :evm_version, @evm_versions, class: "form-control border-rounded", selected: "petersburg", "aria-describedby": "evm-version-help-block" %> + <%= select f, :evm_version, @evm_versions, class: "form-control border-rounded", selected: "default", "aria-describedby": "evm-version-help-block" %>
The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version. EVM version details.
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex index ba6be00103..134b3e13e1 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex @@ -22,11 +22,13 @@ Supported Method Notes + Parameters example <%= for {method, info} <- Map.to_list(@documentation) do %> <%= method %> <%= Map.get(info, :notes, "N/A") %> + <%= Map.get(info, :example, "N/A") %> <% end %> 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 f152ec6bf9..f965f20e0c 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 @@ -82,7 +82,7 @@