From 435799254fff745292e0c7242c775bb817bfed7d Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 7 Jun 2019 14:44:40 +0300 Subject: [PATCH 01/30] show only the last decompiled contract --- .../templates/address_decompiled_contract/index.html.eex | 7 ++++++- .../views/address_decompiled_contract_view.ex | 6 ++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex index 173744603c..6cb4ccf6ab 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_decompiled_contract/index.html.eex @@ -2,7 +2,8 @@ <%= render BlockScoutWeb.AddressView, "overview.html", assigns %>
<%= render BlockScoutWeb.AddressView, "_tabs.html", assigns %> - <%= for contract <- sort_contracts_by_version(@address.decompiled_smart_contracts) do %> + <% contract = last_decompiled_contract_version(@address.decompiled_smart_contracts) %> + <%= if contract do %>

<%= gettext "Decompiler version" %>

@@ -21,6 +22,10 @@
+ <% else %> +
+ <%= gettext "There is no decompilded contracts for this address." %> +
<% end %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex index b92d356479..438f344199 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex @@ -230,10 +230,8 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do end) end - def sort_contracts_by_version(decompiled_contracts) do - decompiled_contracts - |> Enum.sort_by(& &1.decompiler_version) - |> Enum.reverse() + def last_decompiled_contract_version(decompiled_contracts) do + Enum.max_by(decompiled_contracts, & &1.decompiler_version) end defp add_line_numbers(code) do From 8dc05ad646b6034391777bf785d856d3b7fe01c0 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 7 Jun 2019 14:47:16 +0300 Subject: [PATCH 02/30] add CHANGELOG entry --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24bc41eeec..b12df88d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,10 @@ - [#2090](https://github.com/poanetwork/blockscout/pull/2090) - updated some ETC theme colors - [#2096](https://github.com/poanetwork/blockscout/pull/2096) - RSK theme fixes - [#2093](https://github.com/poanetwork/blockscout/pull/2093) - detect token transfer type for deprecated erc721 spec -- [#2108](https://github.com/poanetwork/blockscout/pull/2108) - fixe uncle fetching without full transactions +- [#2108](https://github.com/poanetwork/blockscout/pull/2108) - fix uncle fetching without full transactions + +### Chore +- [#2118](https://github.com/poanetwork/blockscout/pull/2118) - show only the last decompiled contract ### Chore From 659f32ed88368c1ce649564dbca5f816cdbb88af Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 7 Jun 2019 14:48:16 +0300 Subject: [PATCH 03/30] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 11 ++++++++--- .../priv/gettext/en/LC_MESSAGES/default.po | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index e9763e2287..6a5a9d2e36 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1490,7 +1490,7 @@ msgid "EVM Version" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:16 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:17 msgid "Copy Decompiled Contract Code" msgstr "" @@ -1505,12 +1505,12 @@ msgid "Decompiled code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:14 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:15 msgid "Decompiled contract code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:7 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:8 msgid "Decompiler version" msgstr "" @@ -1697,3 +1697,8 @@ msgstr "" #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 +msgid "There is no decompilded contracts for this address." +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 654a848278..49ccd3f61a 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 @@ -1490,7 +1490,7 @@ msgid "EVM Version" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:16 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:17 msgid "Copy Decompiled Contract Code" msgstr "" @@ -1505,12 +1505,12 @@ msgid "Decompiled code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:14 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:15 msgid "Decompiled contract code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:7 +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:8 msgid "Decompiler version" msgstr "" @@ -1693,7 +1693,12 @@ msgstr "" msgid "New Smart Contract Verification" msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 +msgid "There is no decompilded contracts for this address." +msgstr "" From e8ae20cb275e876f6340d2315c96af856fa3756c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 7 Jun 2019 14:58:51 +0300 Subject: [PATCH 04/30] fix test --- .../views/address_decompiled_contract_view_test.exs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs index 334ea36baa..abac26beae 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_decompiled_contract_view_test.exs @@ -96,15 +96,15 @@ defmodule BlockScoutWeb.AddressDecompiledContractViewTest do end end - describe "sort_contracts_by_version/1" do - test "sorts contracts in lexicographical order" do + describe "last_decompiled_contract_version/1" do + test "returns last version" do contract2 = insert(:decompiled_smart_contract, decompiler_version: "v2") contract1 = insert(:decompiled_smart_contract, decompiler_version: "v1") contract3 = insert(:decompiled_smart_contract, decompiler_version: "v3") - result = AddressDecompiledContractView.sort_contracts_by_version([contract2, contract1, contract3]) + result = AddressDecompiledContractView.last_decompiled_contract_version([contract2, contract1, contract3]) - assert result == [contract3, contract2, contract1] + assert result == contract3 end end end From 5ccb464e28a5b7d323ba556b7d5f0f7110892a2e Mon Sep 17 00:00:00 2001 From: pasqu4le Date: Wed, 29 May 2019 17:27:54 +0200 Subject: [PATCH 05/30] Add optional arguments to Explorer.Chain.hash_to_address --- .../address_transaction_controller.ex | 2 +- apps/explorer/lib/explorer/chain.ex | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) 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 da22b8c042..6742d01b60 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 @@ -28,7 +28,7 @@ defmodule BlockScoutWeb.AddressTransactionController do def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), - {:ok, address} <- Chain.hash_to_address(address_hash) do + {:ok, address} <- Chain.hash_to_address(address_hash, [:names], false) do options = @transaction_necessity_by_association |> put_in([:necessity_by_association, :block], :required) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 4edc94887a..ef40eba7af 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -703,25 +703,32 @@ defmodule Explorer.Chain do iex> Explorer.Chain.hash_to_address(hash) {:error, :not_found} + Optionally accepts: + - a list of bindings to preload, just like `Ecto.Query.preload/3` + - a boolean to also fetch the `has_decompiled_code?` virtual field or not + """ - @spec hash_to_address(Hash.Address.t()) :: {:ok, Address.t()} | {:error, :not_found} - def hash_to_address(%Hash{byte_count: unquote(Hash.Address.byte_count())} = hash) do - query = - from( - address in Address, - preload: [ + @spec hash_to_address(Hash.Address.t(), [Macro.t()], boolean()) :: {:ok, Address.t()} | {:error, :not_found} + def hash_to_address( + %Hash{byte_count: unquote(Hash.Address.byte_count())} = hash, + preloads \\ [ :contracts_creation_internal_transaction, :names, :smart_contract, :token, :contracts_creation_transaction ], + query_decompiled_code_flag \\ true + ) do + query = + from( + address in Address, + preload: ^preloads, where: address.hash == ^hash ) - query_with_decompiled_flag = with_decompiled_code_flag(query, hash) - - query_with_decompiled_flag + query + |> with_decompiled_code_flag(hash, query_decompiled_code_flag) |> Repo.one() |> case do nil -> {:error, :not_found} @@ -3081,7 +3088,11 @@ defmodule Explorer.Chain do defp staking_pool_filter(query, _), do: query - defp with_decompiled_code_flag(query, hash) do + defp with_decompiled_code_flag(query, hash, use_option \\ true) + + defp with_decompiled_code_flag(query, _hash, false), do: query + + defp with_decompiled_code_flag(query, hash, true) do has_decompiled_code_query = from(decompiled_contract in DecompiledSmartContract, where: decompiled_contract.address_hash == ^hash, From fc7cf77db27c72a095d5b08b32ba51c6a61c1ecc Mon Sep 17 00:00:00 2001 From: pasqu4le Date: Fri, 31 May 2019 19:30:06 +0200 Subject: [PATCH 06/30] merge queries in address_to_transactions_with_rewards --- CHANGELOG.md | 1 + apps/explorer/lib/explorer/chain.ex | 67 ++++++------------- .../lib/explorer/chain/transaction.ex | 37 ++++++++-- 3 files changed, 51 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a847de3b1d..78f874c440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - [#2096](https://github.com/poanetwork/blockscout/pull/2096) - RSK theme fixes - [#2093](https://github.com/poanetwork/blockscout/pull/2093) - detect token transfer type for deprecated erc721 spec - [#2108](https://github.com/poanetwork/blockscout/pull/2108) - fixe uncle fetching without full transactions +- [#2111](https://github.com/poanetwork/blockscout/pull/2111) - improve address transaction controller ### Chore diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index ef40eba7af..11e2ef0bbb 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -227,60 +227,31 @@ defmodule Explorer.Chain do transaction_hashes_from_token_transfers = TokenTransfer.where_any_address_fields_match(direction, address_hash, paging_options) - token_transfers_query = - transaction_hashes_from_token_transfers - |> Transaction.where_transaction_hashes_match() - |> join_associations(necessity_by_association) - |> order_by([transaction], desc: transaction.block_number, desc: transaction.index) - |> Transaction.preload_token_transfers(address_hash) - - base_query = + transactions_list = paging_options |> fetch_transactions() + |> Transaction.where_transaction_matches(transaction_hashes_from_token_transfers, direction, address_hash) |> join_associations(necessity_by_association) |> Transaction.preload_token_transfers(address_hash) + |> Repo.all() - from_address_query = - base_query - |> where([t], t.from_address_hash == ^address_hash) - - to_address_query = - base_query - |> where([t], t.to_address_hash == ^address_hash) - - created_contract_query = - base_query - |> where([t], t.created_contract_address_hash == ^address_hash) - - queries = - [token_transfers_query] ++ - case direction do - :from -> [from_address_query] - :to -> [to_address_query, created_contract_query] - _ -> [from_address_query, to_address_query, created_contract_query] + if Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:has_emission_funds] do + address_hash + |> Reward.fetch_emission_rewards_tuples(paging_options) + |> Enum.concat(transactions_list) + |> Enum.sort_by(fn item -> + case item do + {%Reward{} = emission_reward, _} -> + {-emission_reward.block.number, 1} + + item -> + {-item.block_number, -item.index} end - - rewards_list = - if Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:has_emission_funds] do - Reward.fetch_emission_rewards_tuples(address_hash, paging_options) - else - [] - end - - queries - |> Stream.flat_map(&Repo.all/1) - |> Stream.uniq_by(& &1.hash) - |> Stream.concat(rewards_list) - |> Enum.sort_by(fn item -> - case item do - {%Reward{} = emission_reward, _} -> - {-emission_reward.block.number, 1} - - item -> - {-item.block_number, -item.index} - end - end) - |> Enum.take(paging_options.page_size) + end) + |> Enum.take(paging_options.page_size) + else + transactions_list + end end @spec address_to_logs(Address.t(), Keyword.t()) :: [ diff --git a/apps/explorer/lib/explorer/chain/transaction.ex b/apps/explorer/lib/explorer/chain/transaction.ex index de99198181..19f04dee2d 100644 --- a/apps/explorer/lib/explorer/chain/transaction.ex +++ b/apps/explorer/lib/explorer/chain/transaction.ex @@ -5,7 +5,7 @@ defmodule Explorer.Chain.Transaction do require Logger - import Ecto.Query, only: [from: 2, order_by: 3, preload: 3, subquery: 1, where: 3] + import Ecto.Query, only: [from: 2, preload: 3, subquery: 1, where: 3] alias ABI.FunctionSelector @@ -549,15 +549,40 @@ defmodule Explorer.Chain.Transaction do end @doc """ - Builds a query that will check for transactions within the hashes params. + Modifies a query to filter for transactions whose hash is in a list or that are + linked to the given address_hash through a direction. Be careful to not pass a large list, because this will lead to performance problems. """ - def where_transaction_hashes_match(transaction_hashes) do - Transaction - |> where([t], t.hash == fragment("ANY (?)", ^transaction_hashes)) - |> order_by([transaction], desc: transaction.block_number, desc: transaction.index) + def where_transaction_matches(query, transaction_hashes, :from, address_hash) do + where( + query, + [t], + t.hash in ^transaction_hashes or + t.from_address_hash == ^address_hash + ) + end + + def where_transaction_matches(query, transaction_hashes, :to, address_hash) do + where( + query, + [t], + t.hash in ^transaction_hashes or + t.to_address_hash == ^address_hash or + t.created_contract_address_hash == ^address_hash + ) + end + + def where_transaction_matches(query, transaction_hashes, _direction, address_hash) do + where( + query, + [t], + t.hash in ^transaction_hashes or + t.from_address_hash == ^address_hash or + t.to_address_hash == ^address_hash or + t.created_contract_address_hash == ^address_hash + ) end @collated_fields ~w(block_number cumulative_gas_used gas_used index)a From 271fc58ba059f9a744ab8d7543b45528c60636ee Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 13:19:23 +0300 Subject: [PATCH 07/30] add rsk format of checksum --- apps/explorer/lib/explorer/chain/address.ex | 68 ++++++++++++++----- .../test/explorer/chain/address_test.exs | 16 +++++ 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/address.ex b/apps/explorer/lib/explorer/chain/address.ex index a619d70546..d0711b4f8e 100644 --- a/apps/explorer/lib/explorer/chain/address.ex +++ b/apps/explorer/lib/explorer/chain/address.ex @@ -130,6 +130,20 @@ defmodule Explorer.Chain.Address do end def checksum(hash, iodata?) do + checksum_formatted = + case Application.get_env(:explorer, :checksum_function) || :eth do + :eth -> eth_checksum(hash) + :rsk -> rsk_checksum(hash) + end + + if iodata? do + ["0x" | checksum_formatted] + else + to_string(["0x" | checksum_formatted]) + end + end + + def eth_checksum(hash) do string_hash = hash |> to_string() @@ -137,26 +151,46 @@ defmodule Explorer.Chain.Address do match_byte_stream = stream_every_four_bytes_of_sha256(string_hash) - checksum_formatted = - string_hash - |> stream_binary() - |> Stream.zip(match_byte_stream) - |> Enum.map(fn - {digit, _} when digit in '0123456789' -> - digit + string_hash + |> stream_binary() + |> Stream.zip(match_byte_stream) + |> Enum.map(fn + {digit, _} when digit in '0123456789' -> + digit - {alpha, 1} -> - alpha - 32 + {alpha, 1} -> + alpha - 32 - {alpha, _} -> - alpha - end) + {alpha, _} -> + alpha + end) + end - if iodata? do - ["0x" | checksum_formatted] - else - to_string(["0x" | checksum_formatted]) - end + def rsk_checksum(hash) do + chain_id = Application.get_env(:explorer, :chain_id) + + string_hash = + hash + |> to_string() + |> String.trim_leading("0x") + + prefix = "#{chain_id}0x" + + match_byte_stream = stream_every_four_bytes_of_sha256("#{prefix}#{string_hash}") + + string_hash + |> stream_binary() + |> Stream.zip(match_byte_stream) + |> Enum.map(fn + {digit, _} when digit in '0123456789' -> + digit + + {alpha, 1} -> + alpha - 32 + + {alpha, _} -> + alpha + end) end defp stream_every_four_bytes_of_sha256(value) do diff --git a/apps/explorer/test/explorer/chain/address_test.exs b/apps/explorer/test/explorer/chain/address_test.exs index 22710e88bb..5f95d20471 100644 --- a/apps/explorer/test/explorer/chain/address_test.exs +++ b/apps/explorer/test/explorer/chain/address_test.exs @@ -28,6 +28,12 @@ defmodule Explorer.Chain.AddressTest do end describe "Phoenix.HTML.Safe.to_iodata/1" do + setup do + Application.put_env(:explorer, :checksum_function, :eth) + + :ok + end + defp str(value) do to_string(insert(:address, hash: value)) end @@ -39,5 +45,15 @@ defmodule Explorer.Chain.AddressTest do assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB" assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb" end + + test "returns the checksum rsk formatted address" do + Application.put_env(:explorer, :chain_id, 30) + Application.put_env(:explorer, :checksum_function, :rsk) + + assert str("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") == "0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD" + assert str("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359") == "0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359" + assert str("0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb") == "0xDBF03B407c01E7CD3cBea99509D93F8Dddc8C6FB" + assert str("0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb") == "0xD1220A0Cf47c7B9BE7a2e6ba89F429762E7B9adB" + end end end From 3f3705c40e5a642af3d825de36337c1252f690c6 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 13:55:41 +0300 Subject: [PATCH 08/30] add env vars for config --- apps/explorer/config/config.exs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index 94a1d79c6d..8a4f04dfca 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -80,7 +80,9 @@ if System.get_env("SOURCE_MODULE") == "TransactionAndLog" do end config :explorer, - solc_bin_api_url: "https://solc-bin.ethereum.org" + solc_bin_api_url: "https://solc-bin.ethereum.org", + chain_id: System.get_env("CHAIN_ID"), + checksum_function: System.get_env("CHECKSUM_FUNCTION") && String.to_atom(System.get_env("CHECKSUM_FUNCTION")) config :logger, :explorer, # keep synced with `config/config.exs` From 4010ff52e2837a640d10aa26fd3d17b7db14a391 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 14:06:29 +0300 Subject: [PATCH 09/30] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c4814ac3..87bd35fdf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - [#2123](https://github.com/poanetwork/blockscout/pull/2123) - fix coins percentage view - [#2119](https://github.com/poanetwork/blockscout/pull/2119) - fix map logging - [#2130](https://github.com/poanetwork/blockscout/pull/2130) - fix navigation +- [#2147](https://github.com/poanetwork/blockscout/pull/2147) - add rsk format of checksum ### Chore - [#2127](https://github.com/poanetwork/blockscout/pull/2127) - use previouse chromedriver version From 9064b72abecdf2e509b4a118ffc790bc8b8bb972 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 15:53:15 +0300 Subject: [PATCH 10/30] remove pending transaction count --- .../controllers/pending_transaction_controller.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex index 95ffe8aa22..c8a52c3596 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex @@ -52,8 +52,7 @@ defmodule BlockScoutWeb.PendingTransactionController do def index(conn, _params) do render(conn, "index.html", - current_path: current_path(conn), - pending_transaction_count: Chain.pending_transaction_count() + current_path: current_path(conn) ) end From ee0f704c5fe21e41b595b0084e7bc73fe356a843 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 15:57:04 +0300 Subject: [PATCH 11/30] mix format --- .../controllers/pending_transaction_controller.ex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex index c8a52c3596..f0f9626f89 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex @@ -51,9 +51,7 @@ defmodule BlockScoutWeb.PendingTransactionController do end def index(conn, _params) do - render(conn, "index.html", - current_path: current_path(conn) - ) + render(conn, "index.html", current_path: current_path(conn)) end defp get_pending_transactions_and_next_page(options) do From 286fe63b62dc59b70afce145a98002ecab12814b Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 15:59:59 +0300 Subject: [PATCH 12/30] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c4814ac3..3558e227e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - [#2123](https://github.com/poanetwork/blockscout/pull/2123) - fix coins percentage view - [#2119](https://github.com/poanetwork/blockscout/pull/2119) - fix map logging - [#2130](https://github.com/poanetwork/blockscout/pull/2130) - fix navigation +- [#2149](https://github.com/poanetwork/blockscout/pull/2149) - remove pending transaction count ### Chore - [#2127](https://github.com/poanetwork/blockscout/pull/2127) - use previouse chromedriver version From bce04b067b0a73d20c25aa51f8ae0f86ccee9a44 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 12 Jun 2019 16:12:12 +0300 Subject: [PATCH 13/30] remove pending transaction test --- .../controllers/pending_transaction_controller_test.exs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs index d535b309f8..d632154294 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs @@ -37,15 +37,6 @@ defmodule BlockScoutWeb.PendingTransactionControllerTest do refute hd(json_response(conn, 200)["items"]) =~ to_string(dropped_replaced.hash) end - test "returns a count of pending transactions", %{conn: conn} do - insert(:transaction) - - conn = get(conn, pending_transaction_path(BlockScoutWeb.Endpoint, :index)) - - assert html_response(conn, 200) - assert 1 == conn.assigns.pending_transaction_count - end - test "works when there are no transactions", %{conn: conn} do conn = get(conn, pending_transaction_path(conn, :index)) From efb74a5d5a39a7161e1ca6ccb03ac07fc9a141a3 Mon Sep 17 00:00:00 2001 From: saneery Date: Wed, 12 Jun 2019 17:26:43 +0300 Subject: [PATCH 14/30] hide dropdown menu then other networks list is empty --- .../lib/block_scout_web/templates/layout/_topnav.html.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 de88489330..73a92c7cfc 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 @@ -77,7 +77,7 @@