From 17816e1fb0905fb88e955f0896ebe7ec15d7a5d3 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 12 Aug 2019 17:16:32 +0300 Subject: [PATCH 01/15] find decoding candidates for logs --- apps/explorer/lib/explorer/chain/log.ex | 37 ++++++++++++++-- .../explorer/test/explorer/chain/log_test.exs | 42 ++++++++++++++++++- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index b6c5c00a2d..027f3ce1ed 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -5,8 +5,9 @@ defmodule Explorer.Chain.Log do require Logger - alias ABI.{Event, FunctionSelector} - alias Explorer.Chain.{Address, Data, Hash, Transaction} + alias ABI.{Event, FunctionSelector, Util} + alias Explorer.Chain.{Address, ContractMethod, Data, Hash, Transaction} + alias Explorer.Repo @required_attrs ~w(address_hash data index transaction_hash)a @optional_attrs ~w(first_topic second_topic third_topic fourth_topic type)a @@ -114,7 +115,37 @@ defmodule Explorer.Chain.Log do do: {:ok, identifier, text, mapping} end - def decode(_log, _transaction), do: {:error, :contract_not_verified} + def decode(log, transaction) do + IO.inspect(" case Util.split_method_id(log.first_topic) do") + case Util.split_method_id(log.first_topic) |> IO.inspect do + {:ok, method_id, _rest} -> + find_candidates(method_id, log, transaction) |> IO.inspect + _ -> + {:error, :could_not_decode} + end + end + + defp find_candidates(_method_id, log, transaction) do + candidates_query = + from( + contract_method in ContractMethod, + # where: contract_method.identifier == ^method_id, + limit: 3 + ) + + candidates = + candidates_query + |> Repo.all() + |> IO.inspect + |> Enum.flat_map(fn contract_method -> + case find_and_decode(contract_method.abi, log, transaction) do + {:ok, _, _} = result -> [result] + _ -> [] + end + end) + + {:error, :contract_not_verified, candidates} + end defp find_and_decode(abi, log, transaction) do with {%FunctionSelector{} = selector, mapping} <- diff --git a/apps/explorer/test/explorer/chain/log_test.exs b/apps/explorer/test/explorer/chain/log_test.exs index 28be44a1af..d77922b06b 100644 --- a/apps/explorer/test/explorer/chain/log_test.exs +++ b/apps/explorer/test/explorer/chain/log_test.exs @@ -2,7 +2,8 @@ defmodule Explorer.Chain.LogTest do use Explorer.DataCase alias Ecto.Changeset - alias Explorer.Chain.Log + alias Explorer.Chain.{ContractMethod, Log, SmartContract} + alias Explorer.Repo doctest Log @@ -100,5 +101,44 @@ defmodule Explorer.Chain.LogTest do {"_belly", "bool", true, true} ]} end + + test "finds decoding candidates" do + params = params_for(:smart_contract, %{abi: [ + %{ + "anonymous" => false, + "inputs" => [ + %{"indexed" => true, "name" => "_from_human", "type" => "string"}, + %{"indexed" => false, "name" => "_number", "type" => "uint256"}, + %{"indexed" => true, "name" => "_belly", "type" => "bool"} + ], + "name" => "WantsPets", + "type" => "event" + } + ]}) + + # changeset has a callback to insert contract methods + %SmartContract{} + |> SmartContract.changeset(params) + |> Repo.insert!() + + topic1 = "0x" <> Base.encode16(:keccakf1600.hash(:sha3_256, "WantsPets(string,uint256,bool)"), case: :lower) + topic2 = "0x" <> Base.encode16(:keccakf1600.hash(:sha3_256, "bob"), case: :lower) + topic3 = "0x0000000000000000000000000000000000000000000000000000000000000001" + data = "0x0000000000000000000000000000000000000000000000000000000000000000" + + transaction = insert(:transaction) + + log = + insert(:log, + transaction: transaction, + first_topic: topic1 <> "00", + second_topic: topic2, + third_topic: topic3, + fourth_topic: nil, + data: data + ) + + assert Log.decode(log, transaction) + end end end From c9aafb03e88be98892bbccb67c33b055b30845bc Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 15 Aug 2019 15:12:35 +0300 Subject: [PATCH 02/15] correctly parse mathod_id --- apps/explorer/lib/explorer/chain/log.ex | 13 ++++--- .../explorer/test/explorer/chain/log_test.exs | 34 ++++++++++++++++--- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index 027f3ce1ed..717044d66b 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -5,7 +5,7 @@ defmodule Explorer.Chain.Log do require Logger - alias ABI.{Event, FunctionSelector, Util} + alias ABI.{Event, FunctionSelector} alias Explorer.Chain.{Address, ContractMethod, Data, Hash, Transaction} alias Explorer.Repo @@ -116,10 +116,10 @@ defmodule Explorer.Chain.Log do end def decode(log, transaction) do - IO.inspect(" case Util.split_method_id(log.first_topic) do") - case Util.split_method_id(log.first_topic) |> IO.inspect do - {:ok, method_id, _rest} -> - find_candidates(method_id, log, transaction) |> IO.inspect + case log.first_topic do + "0x" <> <> -> + find_candidates(method_id, log, transaction) + _ -> {:error, :could_not_decode} end @@ -136,9 +136,8 @@ defmodule Explorer.Chain.Log do candidates = candidates_query |> Repo.all() - |> IO.inspect |> Enum.flat_map(fn contract_method -> - case find_and_decode(contract_method.abi, log, transaction) do + case find_and_decode([contract_method.abi], log, transaction) do {:ok, _, _} = result -> [result] _ -> [] end diff --git a/apps/explorer/test/explorer/chain/log_test.exs b/apps/explorer/test/explorer/chain/log_test.exs index d77922b06b..f27cdc4e04 100644 --- a/apps/explorer/test/explorer/chain/log_test.exs +++ b/apps/explorer/test/explorer/chain/log_test.exs @@ -2,7 +2,7 @@ defmodule Explorer.Chain.LogTest do use Explorer.DataCase alias Ecto.Changeset - alias Explorer.Chain.{ContractMethod, Log, SmartContract} + alias Explorer.Chain.{Log, SmartContract} alias Explorer.Repo doctest Log @@ -103,7 +103,9 @@ defmodule Explorer.Chain.LogTest do end test "finds decoding candidates" do - params = params_for(:smart_contract, %{abi: [ + params = + params_for(:smart_contract, %{ + abi: [ %{ "anonymous" => false, "inputs" => [ @@ -114,7 +116,8 @@ defmodule Explorer.Chain.LogTest do "name" => "WantsPets", "type" => "event" } - ]}) + ] + }) # changeset has a callback to insert contract methods %SmartContract{} @@ -131,14 +134,35 @@ defmodule Explorer.Chain.LogTest do log = insert(:log, transaction: transaction, - first_topic: topic1 <> "00", + first_topic: topic1, second_topic: topic2, third_topic: topic3, fourth_topic: nil, data: data ) - assert Log.decode(log, transaction) + assert Log.decode(log, transaction) == + {:error, :contract_not_verified, + [ + {:ok, + %ABI.FunctionSelector{ + function: "WantsPets", + input_names: ["_from_human", "_number", "_belly"], + inputs_indexed: [true, false, true], + method_id: <<235, 155, 60, 76>>, + returns: [], + type: :event, + types: [:string, {:uint, 256}, :bool] + }, + [ + {"_from_human", "string", true, + {:dynamic, + <<56, 228, 122, 123, 113, 157, 206, 99, 102, 42, 234, 244, 52, 64, 50, 111, 85, 27, 138, 126, + 225, 152, 206, 227, 92, 181, 213, 23, 242, 210, 150, 162>>}}, + {"_number", "uint256", false, 0}, + {"_belly", "bool", true, true} + ]} + ]} end end end From dfbdb442b31db4a2aa516a5451402945867171eb Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 15 Aug 2019 15:16:26 +0300 Subject: [PATCH 03/15] use method_id in query --- apps/explorer/lib/explorer/chain/log.ex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index 717044d66b..3e996e2d37 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -117,7 +117,9 @@ defmodule Explorer.Chain.Log do def decode(log, transaction) do case log.first_topic do - "0x" <> <> -> + "0x" <> hex_part -> + {number, ""} = Integer.parse(hex_part, 16) + <> = :binary.encode_unsigned(number) find_candidates(method_id, log, transaction) _ -> @@ -125,11 +127,11 @@ defmodule Explorer.Chain.Log do end end - defp find_candidates(_method_id, log, transaction) do + defp find_candidates(method_id, log, transaction) do candidates_query = from( contract_method in ContractMethod, - # where: contract_method.identifier == ^method_id, + where: contract_method.identifier == ^method_id, limit: 3 ) From 80f1b6665d7394e0740eadd52c1108047f5d50b2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 15 Aug 2019 15:58:01 +0300 Subject: [PATCH 04/15] add log decoding candidates to frontend --- .../templates/transaction_log/_logs.html.eex | 56 ++++++++++++++++++- .../views/transaction_log_view.ex | 2 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index c63502669b..f55d52b6aa 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -83,7 +83,61 @@ <% end %> - + + <% {:error, :contract_not_verified, results} when is_list(results) and not results == [] -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+
+ " class="table thead-light table-bordered"> + + + + + + + + <%= for {name, type, indexed?, value} <- mapping do %> + + + + + + + + <% end %> +
<%= gettext "Name" %><%= gettext "Type" %><%= gettext "Indexed?" %><%= gettext "Data" %>
+ <%= case BlockScoutWeb.ABIEncodedValueView.copy_text(type, value) do %> + <% :error -> %> + <%= nil %> + <% copy_text -> %> + + + + + + <% end %> + <%= name %><%= type %><%= indexed? %> +
<%= BlockScoutWeb.ABIEncodedValueView.value_html(type, value) %>
+
+
+ <% end %> <% _ -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex index 50d406433c..16378418fb 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex @@ -5,6 +5,6 @@ defmodule BlockScoutWeb.TransactionLogView do alias Explorer.Chain.Log def decode(log, transaction) do - Log.decode(log, transaction) + Log.decode(log, transaction) |> IO.inspect end end From 7c036ccf4f822ad3ac236527e34f7a6b9e6cc221 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 10:43:48 +0300 Subject: [PATCH 05/15] fix gettext and credo --- .../lib/block_scout_web/views/transaction_log_view.ex | 2 +- apps/block_scout_web/priv/gettext/default.pot | 11 +++++++++-- .../priv/gettext/en/LC_MESSAGES/default.po | 11 +++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex index 16378418fb..0cca6151f1 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex @@ -5,6 +5,6 @@ defmodule BlockScoutWeb.TransactionLogView do alias Explorer.Chain.Log def decode(log, transaction) do - Log.decode(log, transaction) |> IO.inspect + Log.decode(log, transaction) |> IO.inspect() end end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 886a88e4c0..93e2111b51 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -563,6 +563,7 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 msgid "Name" msgstr "" @@ -1134,6 +1135,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89 msgid "Decoded" msgstr "" @@ -1780,6 +1782,7 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 msgid "Copy Value" msgstr "" @@ -1793,7 +1796,8 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175 msgid "Data" msgstr "" @@ -1806,12 +1810,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107 msgid "Indexed?" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102 msgid "Log Data" msgstr "" @@ -1824,7 +1830,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145 msgid "Topics" msgstr "" @@ -1832,5 +1838,6 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Type" 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 8fd1e1ff2e..4ea99bcf8d 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 @@ -563,6 +563,7 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 msgid "Name" msgstr "" @@ -1134,6 +1135,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89 msgid "Decoded" msgstr "" @@ -1781,6 +1783,7 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 msgid "Copy Value" msgstr "" @@ -1794,7 +1797,8 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175 msgid "Data" msgstr "" @@ -1807,12 +1811,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107 msgid "Indexed?" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102 msgid "Log Data" msgstr "" @@ -1825,7 +1831,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:91 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145 msgid "Topics" msgstr "" @@ -1833,5 +1839,6 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Type" msgstr "" From 23835d7dae2a3ff7cff31ea5343fae731a3debaf Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 11:23:02 +0300 Subject: [PATCH 06/15] fix transaction logs view --- .../templates/transaction_log/_logs.html.eex | 18 ++++++- .../views/transaction_log_view.ex | 2 +- apps/block_scout_web/priv/gettext/default.pot | 49 ++++++++++--------- .../priv/gettext/en/LC_MESSAGES/default.po | 49 ++++++++++--------- apps/explorer/lib/explorer/chain/log.ex | 10 +++- 5 files changed, 78 insertions(+), 50 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index f55d52b6aa..b0afe771c1 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -1,4 +1,20 @@
+ <% decoded_result = decode(@log, @transaction) %> + <%= case decoded_result do %> + <%= {:error, :contract_not_verified, _cadidates} -> %> +
+ <%= gettext "To see accurate decoded input data, the contract must be verified." %> + <%= case @transaction do %> + <% %{to_address: %{hash: hash}} -> %> + <%= gettext "Verify the contract " %><%= gettext "here" %> + <% _ -> %> + <%= nil %> + <% end %> +
+ <% _ -> %> + <%= nil %> + <% end %> +
<%= gettext "Address" %>
@@ -84,7 +100,7 @@ <% end %>
- <% {:error, :contract_not_verified, results} when is_list(results) and not results == [] -> %> + <% {:error, :contract_not_verified, results} -> %> <%= for {:ok, method_id, text, mapping} <- results do %>
<%= gettext "Decoded" %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex index 0cca6151f1..50d406433c 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex @@ -5,6 +5,6 @@ defmodule BlockScoutWeb.TransactionLogView do alias Explorer.Chain.Log def decode(log, transaction) do - Log.decode(log, transaction) |> IO.inspect() + Log.decode(log, transaction) end end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 93e2111b51..d9998f00fe 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -98,7 +98,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 #: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -562,8 +562,8 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 msgid "Name" msgstr "" @@ -1132,10 +1132,10 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 msgid "Decoded" msgstr "" @@ -1146,7 +1146,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "To see decoded input data, the contract must be verified." msgstr "" @@ -1159,14 +1159,16 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "Verify the contract " msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "here" msgstr "" @@ -1321,6 +1323,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." msgstr "" @@ -1781,8 +1784,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134 msgid "Copy Value" msgstr "" @@ -1795,29 +1798,29 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191 msgid "Data" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47 msgid "Failed to decode log data." msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123 msgid "Indexed?" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 msgid "Log Data" msgstr "" @@ -1830,14 +1833,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161 msgid "Topics" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Type" 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 4ea99bcf8d..585b389bc0 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 @@ -98,7 +98,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 #: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -562,8 +562,8 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 msgid "Name" msgstr "" @@ -1132,10 +1132,10 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 msgid "Decoded" msgstr "" @@ -1146,7 +1146,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "To see decoded input data, the contract must be verified." msgstr "" @@ -1159,14 +1159,16 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "Verify the contract " msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "here" msgstr "" @@ -1322,6 +1324,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." msgstr "" @@ -1782,8 +1785,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134 msgid "Copy Value" msgstr "" @@ -1796,29 +1799,29 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191 msgid "Data" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47 msgid "Failed to decode log data." msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123 msgid "Indexed?" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 msgid "Log Data" msgstr "" @@ -1831,14 +1834,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161 msgid "Topics" msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Type" msgstr "" diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index 3e996e2d37..f84c59c38d 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -140,8 +140,14 @@ defmodule Explorer.Chain.Log do |> Repo.all() |> Enum.flat_map(fn contract_method -> case find_and_decode([contract_method.abi], log, transaction) do - {:ok, _, _} = result -> [result] - _ -> [] + {:ok, selector, mapping} -> + identifier = Base.encode16(selector.method_id, case: :lower) + text = function_call(selector.function, mapping) + + [{:ok, identifier, text, mapping}] + + _ -> + [] end end) From 0937312366730be86a2950ec14627e1cd78e643e Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 11:38:37 +0300 Subject: [PATCH 07/15] add decoding candidates to address logs --- .../templates/address_logs/_logs.html.eex | 85 ++++++++++++++++--- .../templates/transaction_log/_logs.html.eex | 14 +-- apps/block_scout_web/priv/gettext/default.pot | 80 +++++++++-------- .../priv/gettext/en/LC_MESSAGES/default.po | 80 +++++++++-------- 4 files changed, 150 insertions(+), 109 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index e49adf8801..cf19ea6420 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -1,5 +1,20 @@
">
+ <% decoded_result = decode(@log, @log.transaction) %> + <%= case decoded_result do %> + <%= {:error, :contract_not_verified, _cadidates} -> %> +
+ <%= gettext "To see accurate decoded input data, the contract must be verified." %> + <%= case @transaction do %> + <% %{to_address: %{hash: hash}} -> %> + <%= gettext "Verify the contract " %><%= gettext "here" %> + <% _ -> %> + <%= nil %> + <% end %> +
+ <% _ -> %> + <%= nil %> + <% end %>
<%= gettext "Transaction" %>

@@ -11,19 +26,7 @@ ) %>

- <%= case decode(@log, @log.transaction) do %> - <% {:error, :contract_not_verified} -> %> -
<%= gettext "Decoded" %>
-
-
- <%= gettext "To see decoded input data, the contract must be verified." %> - <%= case @log.transaction do %> - <% %{to_address: %{hash: hash}} -> %> - <%= gettext "Verify the contract " %><%= gettext "here" %> - <% _ -> %> - <%= nil %> - <% end %> -
+ <%= case decoded_result do %> <% {:error, :could_not_decode} -> %>
<%= gettext "Decoded" %>
@@ -81,7 +84,61 @@ <% end %> -
+ + <% {:error, :contract_not_verified, results} -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+
+ " class="table thead-light table-bordered"> + + + + + + + + <%= for {name, type, indexed?, value} <- mapping do %> + + + + + + + + <% end %> +
<%= gettext "Name" %><%= gettext "Type" %><%= gettext "Indexed?" %><%= gettext "Data" %>
+ <%= case BlockScoutWeb.ABIEncodedValueView.copy_text(type, value) do %> + <% :error -> %> + <%= nil %> + <% copy_text -> %> + + + + + + <% end %> + <%= name %><%= type %><%= indexed? %> +
<%= BlockScoutWeb.ABIEncodedValueView.value_html(type, value) %>
+
+
+ <% end %> <% _ -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index b0afe771c1..a0922454a9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -27,19 +27,7 @@ ) %>
- <%= case decode(@log, @transaction) do %> - <% {:error, :contract_not_verified} -> %> -
<%= gettext "Decoded" %>
-
-
- <%= gettext "To see decoded input data, the contract must be verified." %> - <%= case @transaction do %> - <% %{to_address: %{hash: hash}} -> %> - <%= gettext "Verify the contract " %><%= gettext "here" %> - <% _ -> %> - <%= nil %> - <% end %> -
+ <%= case decoded_result do %> <% {:error, :could_not_decode} -> %>
<%= gettext "Decoded" %>
diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index d9998f00fe..520dc1d1ed 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -558,12 +558,13 @@ msgid "Must be set to:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:106 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:56 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:109 msgid "Name" msgstr "" @@ -852,7 +853,7 @@ msgid "Total transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 #: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1129,13 +1130,12 @@ msgid "Static Call" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:90 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:40 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:93 msgid "Decoded" msgstr "" @@ -1144,12 +1144,6 @@ msgstr "" msgid "Method Id" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 -msgid "To see decoded input data, the contract must be verified." -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:16 @@ -1157,18 +1151,16 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "here" msgstr "" @@ -1322,6 +1314,7 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:7 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." @@ -1782,10 +1775,11 @@ msgid "Constructor Arguments" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:66 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:119 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Copy Value" msgstr "" @@ -1795,32 +1789,35 @@ msgid "Create2" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:56 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:109 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:175 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:59 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:112 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:179 msgid "Data" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "Failed to decode log data." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:58 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:111 msgid "Indexed?" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:103 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Log Data" msgstr "" @@ -1832,15 +1829,16 @@ msgid "Reward" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:149 msgid "Topics" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:107 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:110 msgid "Type" 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 585b389bc0..1626e8b6a7 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 @@ -558,12 +558,13 @@ msgid "Must be set to:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:106 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:56 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:109 msgid "Name" msgstr "" @@ -852,7 +853,7 @@ msgid "Total transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 #: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1129,13 +1130,12 @@ msgid "Static Call" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:37 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:90 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:40 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:93 msgid "Decoded" msgstr "" @@ -1144,12 +1144,6 @@ msgstr "" msgid "Method Id" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 -msgid "To see decoded input data, the contract must be verified." -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:2 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:16 @@ -1157,18 +1151,16 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38 msgid "here" msgstr "" @@ -1323,6 +1315,7 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:7 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." @@ -1783,10 +1776,11 @@ msgid "Constructor Arguments" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:66 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:119 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 msgid "Copy Value" msgstr "" @@ -1796,32 +1790,35 @@ msgid "Create2" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53 -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:56 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:109 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:175 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:59 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:112 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:179 msgid "Data" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35 msgid "Failed to decode log data." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:58 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:111 msgid "Indexed?" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:50 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:103 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106 msgid "Log Data" msgstr "" @@ -1833,15 +1830,16 @@ msgid "Reward" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:145 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:149 msgid "Topics" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:54 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:107 #: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69 -#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:57 +#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:110 msgid "Type" msgstr "" From 1aa9c39305862ce58a5c5da7112094fe0705b6fb Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 11:48:05 +0300 Subject: [PATCH 08/15] fix tests --- apps/explorer/test/explorer/chain/log_test.exs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/explorer/test/explorer/chain/log_test.exs b/apps/explorer/test/explorer/chain/log_test.exs index f27cdc4e04..e4ce0695bc 100644 --- a/apps/explorer/test/explorer/chain/log_test.exs +++ b/apps/explorer/test/explorer/chain/log_test.exs @@ -48,7 +48,7 @@ defmodule Explorer.Chain.LogTest do log = insert(:log, transaction: transaction) - assert Log.decode(log, transaction) == {:error, :contract_not_verified} + assert Log.decode(log, transaction) == {:error, :could_not_decode} end test "that a contract call transaction that has a verified contract returns the decoded input data" do @@ -144,16 +144,7 @@ defmodule Explorer.Chain.LogTest do assert Log.decode(log, transaction) == {:error, :contract_not_verified, [ - {:ok, - %ABI.FunctionSelector{ - function: "WantsPets", - input_names: ["_from_human", "_number", "_belly"], - inputs_indexed: [true, false, true], - method_id: <<235, 155, 60, 76>>, - returns: [], - type: :event, - types: [:string, {:uint, 256}, :bool] - }, + {:ok, "eb9b3c4c", "WantsPets(string indexed _from_human, uint256 _number, bool indexed _belly)", [ {"_from_human", "string", true, {:dynamic, From 5c333fa6549cf6a4e946ea9985e86dc90d02fb0d Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 11:48:57 +0300 Subject: [PATCH 09/15] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f006769dbf..9e256eb6f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#2555](https://github.com/poanetwork/blockscout/pull/2555) - find and show decoding candidates for logs - [#2561](https://github.com/poanetwork/blockscout/pull/2561) - Add token's type to the response of tokenlist method - [#2499](https://github.com/poanetwork/blockscout/pull/2499) - import emission reward ranges - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation From 0c1963770c6b8012d34fb09ff53d76712cbb38d2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 10:45:09 +0300 Subject: [PATCH 10/15] add CR issues --- .../templates/address_logs/_logs.html.eex | 2 +- .../templates/transaction_log/_logs.html.eex | 2 +- apps/explorer/lib/explorer/chain/log.ex | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index cf19ea6420..527a63feab 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -10,7 +10,7 @@ <%= gettext "Verify the contract " %><%= gettext "here" %> <% _ -> %> <%= nil %> - <% end %> + <% end %> <% _ -> %> <%= nil %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index a0922454a9..49a18bf84d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -9,7 +9,7 @@ <%= gettext "Verify the contract " %><%= gettext "here" %> <% _ -> %> <%= nil %> - <% end %> + <% end %> <% _ -> %> <%= nil %> diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index f84c59c38d..0c9b2087ce 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -118,9 +118,14 @@ defmodule Explorer.Chain.Log do def decode(log, transaction) do case log.first_topic do "0x" <> hex_part -> - {number, ""} = Integer.parse(hex_part, 16) - <> = :binary.encode_unsigned(number) - find_candidates(method_id, log, transaction) + case Integer.parse(hex_part, 16) do + {number, ""} -> + <> = :binary.encode_unsigned(number) + find_candidates(method_id, log, transaction) + + _ -> + {:error, :could_not_decode} + end _ -> {:error, :could_not_decode} From b38c6d1e65b02ba053237046d577acdfbb8473dc Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 11:57:22 +0300 Subject: [PATCH 11/15] fix transaction assign in view --- .../lib/block_scout_web/templates/address_logs/_logs.html.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index 527a63feab..790e463981 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -5,7 +5,7 @@ <%= {:error, :contract_not_verified, _cadidates} -> %>
<%= gettext "To see accurate decoded input data, the contract must be verified." %> - <%= case @transaction do %> + <%= case @log.transaction do %> <% %{to_address: %{hash: hash}} -> %> <%= gettext "Verify the contract " %><%= gettext "here" %> <% _ -> %> From d108e541a19b8801d36008b3657344b89e97bfe4 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 12:05:23 +0300 Subject: [PATCH 12/15] fix html for address logs view --- .../lib/block_scout_web/templates/address_logs/_logs.html.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex index 790e463981..92a8ebc6cc 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_logs/_logs.html.eex @@ -1,5 +1,4 @@
"> -
<% decoded_result = decode(@log, @log.transaction) %> <%= case decoded_result do %> <%= {:error, :contract_not_verified, _cadidates} -> %> @@ -15,6 +14,7 @@ <% _ -> %> <%= nil %> <% end %> +
<%= gettext "Transaction" %>

From 69ed2d63bf106a06010e08e4e16b69d79fb69b23 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 27 Aug 2019 17:11:15 +0300 Subject: [PATCH 13/15] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 6 +++--- apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 520dc1d1ed..607d83da8a 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1151,14 +1151,14 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "here" @@ -1314,7 +1314,7 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:7 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." 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 1626e8b6a7..a4ae226813 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 @@ -1151,14 +1151,14 @@ msgid "Transaction Inputs" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "Verify the contract " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:10 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:9 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9 msgid "here" @@ -1315,7 +1315,7 @@ msgid "To have guaranteed accuracy, use the link above to verify the contract's msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_logs/_logs.html.eex:7 +#: lib/block_scout_web/templates/address_logs/_logs.html.eex:6 #: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8 #: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6 msgid "To see accurate decoded input data, the contract must be verified." From ec2a3dbdbdd1b85b9d72dae196bf35f5181530a7 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 28 Aug 2019 10:09:51 +0300 Subject: [PATCH 14/15] limit to one candidate --- apps/block_scout_web/assets/package-lock.json | 11 ++++------- apps/explorer/lib/explorer/chain/log.ex | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 2c78f45f55..1565a96a74 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -4555,7 +4555,6 @@ "version": "2.2.4", "resolved": false, "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4773,8 +4772,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": false, - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "optional": true + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "safer-buffer": { "version": "2.1.2", @@ -4877,8 +4875,7 @@ "yallist": { "version": "3.0.2", "resolved": false, - "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "optional": true + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, @@ -5989,7 +5986,7 @@ }, "callsites": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "dev": true }, @@ -6191,7 +6188,7 @@ }, "jest-get-type": { "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, diff --git a/apps/explorer/lib/explorer/chain/log.ex b/apps/explorer/lib/explorer/chain/log.ex index 0c9b2087ce..7916b56fb3 100644 --- a/apps/explorer/lib/explorer/chain/log.ex +++ b/apps/explorer/lib/explorer/chain/log.ex @@ -155,6 +155,7 @@ defmodule Explorer.Chain.Log do [] end end) + |> Enum.take(1) {:error, :contract_not_verified, candidates} end From 3c0540102c0c09fd645d0c2e5365b6e204bb1287 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 28 Aug 2019 15:50:58 +0300 Subject: [PATCH 15/15] checkout package-lock.json from origin/master --- apps/block_scout_web/assets/package-lock.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 1565a96a74..2c78f45f55 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -4555,6 +4555,7 @@ "version": "2.2.4", "resolved": false, "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4772,7 +4773,8 @@ "safe-buffer": { "version": "5.1.1", "resolved": false, - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4875,7 +4877,8 @@ "yallist": { "version": "3.0.2", "resolved": false, - "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", + "optional": true } } }, @@ -5986,7 +5989,7 @@ }, "callsites": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "dev": true }, @@ -6188,7 +6191,7 @@ }, "jest-get-type": { "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true },