From 17816e1fb0905fb88e955f0896ebe7ec15d7a5d3 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 12 Aug 2019 17:16:32 +0300 Subject: [PATCH 01/59] 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/59] 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/59] 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/59] 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 6c206b88d8bea41704720e84881c04a9a88ee08d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 15 Aug 2019 16:40:05 +0300 Subject: [PATCH 05/59] Need recompile column in the env vars table --- CHANGELOG.md | 1 + docs/env-variables.md | 98 ++++++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f006769dbf..c9614afa96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - [#2538](https://github.com/poanetwork/blockscout/pull/2538) - fetch the last not empty coin balance records ### Chore +- [#2577](https://github.com/poanetwork/blockscout/pull/2577) - Need recompile column in the env vars table - [#2566](https://github.com/poanetwork/blockscout/pull/2566) - upgrade absinthe phoenix diff --git a/docs/env-variables.md b/docs/env-variables.md index 60c9eee442..a0fae07bc3 100644 --- a/docs/env-variables.md +++ b/docs/env-variables.md @@ -14,52 +14,54 @@ $ export NETWORK=POA ``` -| Variable | Required | Description | Default | Version | -| --- | --- | --- | ---| --- | -| `NETWORK`| :white_check_mark: | Environment variable for the main EVM network such as Ethereum Network or POA Network | POA Network | all | -| `SUBNETWORK` | :white_check_mark: | Environment variable for the subnetwork such as Core or Sokol Network | Sokol Testnet | all | -| `NETWORK_ICON` | :white_check_mark: | Environment variable for the main network icon or testnet icon. Two options are `_test_network_icon.html` and `_network_icon.html` | `_test_network_icon.html` | all | -| `LOGO` | :white_check_mark: | Environment variable for the logo image location. The logo files names for different chains can be found [here](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/static/images) | /images/blockscout_logo.svg | all | -| `ETHEREUM_JSONRPC_VARIANT` | :white_check_mark: | This environment variable is used to tell the application which RPC Client the node is using (i.e. Geth, Parity, or Ganache) | parity | all | -| `ETHEREUM_JSONRPC_HTTP_URL` | :white_check_mark: | The RPC endpoint used to fetch blocks, transactions, receipts, tokens. | localhost:8545 | all | -| `ETHEREUM_JSONRPC_TRACE_URL` | | The RPC endpoint specifically for the Geth/Parity client used by trace_block and trace_replayTransaction. This can be used to designate a tracing node. | localhost:8545 | all | -| `ETHEREUM_JSONRPC_WS_URL` | :white_check_mark: | The WebSockets RPC endpoint used to subscribe to the `newHeads` subscription alerting the indexer to fetch new blocks. | ws://localhost:8546 | all | -| `NETWORK_PATH` | | Used to set a network path other than what is displayed in the root directory. An example would be to add /eth/mainnet/ to the root directory. | (empty) | all | -| `SECRET_KEY_BASE` | :white_check_mark: | Use mix phx.gen.secret to generate a new Secret Key Base string to protect production assets. | (empty) | all | -| `CHECK_ORIGIN` | | Used to check the origin of requests when the origin header is present. It defaults to false. In case of true, it will check against the host value. | false | all | -| `PORT` | :white_check_mark: | Default port the application runs on is 4000 | 4000 | all | -| `COIN` | :white_check_mark: | The coin here is checked via the Coinmarketcap API to obtain USD prices on graphs and other areas of the UI | POA | all | -| `METADATA_CONTRACT` | | This environment variable is specifically used by POA Network to obtain Validators information to display in the UI. | (empty) | all | -| `VALIDATORS_CONTRACT` | | This environment variable is specifically used by POA Network to obtain the Emission Fund contract. | (empty) | all | -| `SUPPLY_MODULE` | | This environment variable is used by the xDai Chain in order to tell the application how to calculate the total supply of the chain. | false | all | -| `SOURCE_MODULE` | | This environment variable is used to calculate the exchange rate and is specifically used by the xDai Chain. | false | all | -| `DATABASE_URL` | | Production environment variable to define the Database endpoint. | (empty) | all | -| `POOL_SIZE` | | Production environment variable to define the number of database connections allowed. | 20 | all | -| `ECTO_USE_SSL` | | Production environment variable to use SSL on Ecto queries. | true | all | -| `DATADOG_HOST` | | Host configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/) | (empty) | all | -| `DATADOG_PORT` | | Port configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/). | (empty} | all | +| Variable | Required | Description | Default | Version | Need recompile | +| --- | --- | --- | ---| --- | --- | +| `NETWORK`| :white_check_mark: | Environment variable for the main EVM network such as Ethereum Network or POA Network | POA Network | all | | +| `SUBNETWORK` | :white_check_mark: | Environment variable for the subnetwork such as Core or Sokol Network | Sokol Testnet | all | | +| `NETWORK_ICON` | :white_check_mark: | Environment variable for the main network icon or testnet icon. Two options are `_test_network_icon.html` and `_network_icon.html` | `_test_network_icon.html` | all | | +| `LOGO` | :white_check_mark: | Environment variable for the logo image location. The logo files names for different chains can be found [here](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/static/images) | /images/blockscout_logo.svg | all | | +| `ETHEREUM_JSONRPC_VARIANT` | :white_check_mark: | This environment variable is used to tell the application which RPC Client the node is using (i.e. Geth, Parity, or Ganache) | parity | all | | +| `ETHEREUM_JSONRPC_HTTP_URL` | :white_check_mark: | The RPC endpoint used to fetch blocks, transactions, receipts, tokens. | localhost:8545 | all | | +| `ETHEREUM_JSONRPC_TRACE_URL` | | The RPC endpoint specifically for the Geth/Parity client used by trace_block and trace_replayTransaction. This can be used to designate a tracing node. | localhost:8545 | all | | +| `ETHEREUM_JSONRPC_WS_URL` | :white_check_mark: | The WebSockets RPC endpoint used to subscribe to the `newHeads` subscription alerting the indexer to fetch new blocks. | ws://localhost:8546 | all | | +| `NETWORK_PATH` | | Used to set a network path other than what is displayed in the root directory. An example would be to add /eth/mainnet/ to the root directory. | (empty) | all | | +| `SECRET_KEY_BASE` | :white_check_mark: | Use mix phx.gen.secret to generate a new Secret Key Base string to protect production assets. | (empty) | all | | +| `CHECK_ORIGIN` | | Used to check the origin of requests when the origin header is present. It defaults to false. In case of true, it will check against the host value. | false | all | | +| `PORT` | :white_check_mark: | Default port the application runs on is 4000 | 4000 | all | | +| `COIN` | :white_check_mark: | The coin here is checked via the Coinmarketcap API to obtain USD prices on graphs and other areas of the UI | POA | all | | +| `METADATA_CONTRACT` | | This environment variable is specifically used by POA Network to obtain Validators information to display in the UI. | (empty) | all | | +| `VALIDATORS_CONTRACT` | | This environment variable is specifically used by POA Network to obtain the Emission Fund contract. | (empty) | all | | +| `SUPPLY_MODULE` | | This environment variable is used by the xDai Chain in order to tell the application how to calculate the total supply of the chain. | false | all | | +| `SOURCE_MODULE` | | This environment variable is used to calculate the exchange rate and is specifically used by the xDai Chain. | false | all | | +| `DATABASE_URL` | | Production environment variable to define the Database endpoint. | (empty) | all | | +| `POOL_SIZE` | | Production environment variable to define the number of database connections allowed. | 20 | all | | +| `ECTO_USE_SSL` | | Production environment variable to use SSL on Ecto queries. | true | all | | +| `DATADOG_HOST` | | Host configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/) | (empty) | all | | +| `DATADOG_PORT` | | Port configuration setting for [Datadog integration](https://docs.datadoghq.com/integrations/). | (empty} | all | | | `SPANDEX_BATCH_SIZE` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | -| `SPANDEX_SYNC_THRESHOLD` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | -| `HEART_BEAT_TIMEOUT` | | Production environment variable to restart the application in the event of a crash. | 30 | all | -| `HEART_COMMAND` | | Production environment variable to restart the application in the event of a crash. | systemctl restart explorer.service | all | -| `BLOCKSCOUT_VERSION` | | Added to the footer to signify the current BlockScout version. | (empty) | v1.3.4+ | -| `RELEASE_LINK` | | The link to Blockscout release notes in the footer. | https: //github.com/poanetwork/
blockscout/releases/
tag/${BLOCKSCOUT_VERSION} | v1.3.5+ | -| `ELIXIR_VERSION` | | Elixir version to install on the node before Blockscout deploy. | (empty) | all | -| `BLOCK_TRANSFORMER` | | Transformer for blocks: base or clique. | base | v1.3.4+ | -| `GRAPHIQL _TRANSACTION` | | Default transaction in query to GraphiQL. | (empty) | v1.3.4+ | -| `FIRST_BLOCK` | | The block number, where indexing begins from. | 0 | v1.3.8+ | -| `LAST_BLOCK` | | The block number, where indexing stops. | (empty) | v2.0.3+ | -| `TXS_COUNT_CACHE_PERIOD` | | Interval in seconds to restart the task, which calculates the total txs count. | 60 * 60 * 2 | v1.3.9+ | -| `ADDRESS_WITH_BALANCES`
`_UPDATE_INTERVAL`| | Interval in seconds to restart the task, which calculates addresses with balances. | 30 * 60 | v1.3.9+ | -| `LINK_TO_OTHER_EXPLORERS` | | true/false. If true, links to other explorers are added in the footer | (empty) | v1.3.0+ | -| `COINMARKETCAP_PAGES` | | the number of pages on coinmarketcap to list in order to find token's price | 10 | v1.3.10+ | -| `CHAIN_SPEC_PATH` | | Chain specification path (absolute file system path or url) to import block emission reward ranges and genesis account balances from | (empty) | master | -| `SUPPORTED_CHAINS` | | Array of supported chains that displays in the footer and in the chains dropdown. This var was introduced in this PR [#1900](https://github.com/poanetwork/blockscout/pull/1900) and looks like an array of JSON objects. | (empty) | v2.0.0+ | -| `BLOCK_COUNT_CACHE_PERIOD ` | | time to live of cache in seconds. This var was introduced in [#1876](https://github.com/poanetwork/blockscout/pull/1876) | 600 | v2.0.0+ | -| `ALLOWED_EVM_VERSIONS ` | | the comma-separated list of allowed EVM versions for contracts verification. This var was introduced in [#1964](https://github.com/poanetwork/blockscout/pull/1964) | "homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg" | v2.0.0+ | -| `DISABLE_WEBAPP` | | If `true`, endpoints to webapp are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_READ_API` | | If `true`, read-only endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_WRITE_API` | | If `true`, write endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | -| `DISABLE_INDEXER` | | If `true`, indexer application doesn't run | `false` | v2.0.3+ | -| `WEBAPP_URL` | | Link to web application instance, e.g. `http://host/path` | (empty) | v2.0.3+ | -| `API_URL` | | Link to API instance, e.g. `http://host/path` | (empty) | v2.0.3+ | +| `SPANDEX_SYNC_THRESHOLD` | | [Spandex](https://github.com/spandex-project/spandex) and Datadog configuration setting. | (empty) | all | | +| `HEART_BEAT_TIMEOUT` | | Production environment variable to restart the application in the event of a crash. | 30 | all | | +| `HEART_COMMAND` | | Production environment variable to restart the application in the event of a crash. | systemctl restart explorer.service | all | | +| `BLOCKSCOUT_VERSION` | | Added to the footer to signify the current BlockScout version. | (empty) | v1.3.4+ | | +| `RELEASE_LINK` | | The link to Blockscout release notes in the footer. | https: //github.com/poanetwork/
blockscout/releases/
tag/${BLOCKSCOUT_VERSION} | v1.3.5+ | | +| `ELIXIR_VERSION` | | Elixir version to install on the node before Blockscout deploy. | (empty) | all | | +| `BLOCK_TRANSFORMER` | | Transformer for blocks: base or clique. | base | v1.3.4+ | | +| `GRAPHIQL_TRANSACTION` | | Default transaction in query to GraphiQL. | (empty) | v1.2.0+ | :white_check_mark: | +| `FIRST_BLOCK` | | The block number, where indexing begins from. | 0 | v1.3.8+ | | +| `LAST_BLOCK` | | The block number, where indexing stops. | (empty) | v2.0.3+ | | +| `TXS_COUNT_CACHE_PERIOD` | | Interval in seconds to restart the task, which calculates the total txs count. | 60 * 60 * 2 | v1.3.9+ | | +| `ADDRESS_WITH_BALANCES`
`_UPDATE_INTERVAL`| | Interval in seconds to restart the task, which calculates addresses with balances. | 30 * 60 | v1.3.9+ | | +| `LINK_TO_OTHER_EXPLORERS` | | true/false. If true, links to other explorers are added in the footer | (empty) | v1.3.0+ | | +| `COINMARKETCAP_PAGES` | | the number of pages on coinmarketcap to list in order to find token's price | 10 | v1.3.10+ | | +| `SUPPORTED_CHAINS` | | Array of supported chains that displays in the footer and in the chains dropdown. This var was introduced in this PR [#1900](https://github.com/poanetwork/blockscout/pull/1900) and looks like an array of JSON objects. | (empty) | v2.0.0+ | | +| `BLOCK_COUNT_CACHE_PERIOD ` | | time to live of cache in seconds. This var was introduced in [#1876](https://github.com/poanetwork/blockscout/pull/1876) | 600 | v2.0.0+ | | +| `ALLOWED_EVM_VERSIONS ` | | the comma-separated list of allowed EVM versions for contracts verification. This var was introduced in [#1964](https://github.com/poanetwork/blockscout/pull/1964) | "homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg" | v2.0.0+ | | +| `AVERAGE_BLOCK_CACHE_PERIOD` | | Update of average block cache, in seconds | 30 minutes | v2.0.2+ | +| `MARKET_HISTORY_CACHE_PERIOD` | | Update of market history cache, in seconds | 6 hours | v2.0.2+ | +| `DISABLE_WEBAPP` | | If `true`, endpoints to webapp are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_READ_API` | | If `true`, read-only endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_WRITE_API` | | If `true`, write endpoints to API are hidden (compile-time) | `false` | v2.0.3+ | :white_check_mark: | +| `DISABLE_INDEXER` | | If `true`, indexer application doesn't run | `false` | v2.0.3+ | :white_check_mark: | +| `WEBAPP_URL` | | Link to web application instance, e.g. `http://host/path` | (empty) | v2.0.3+ | | +| `API_URL` | | Link to API instance, e.g. `http://host/path` | (empty) | v2.0.3+ | | +| `CHAIN_SPEC_PATH` | | Chain specification path (absolute file system path or url) to import block emission reward ranges and genesis account balances from | (empty) | master | | From 7c036ccf4f822ad3ac236527e34f7a6b9e6cc221 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 16 Aug 2019 10:43:48 +0300 Subject: [PATCH 06/59] 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 07/59] 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 08/59] 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 09/59] 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 10/59] 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 642cfd01cd1bfcb157fb4a3646208c4fbf2e0a45 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 19 Aug 2019 14:10:13 +0300 Subject: [PATCH 11/59] process new metadata format for whisper Solidity >= 0.5.11 has new whisper metadata format Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw:// https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 --- .../lib/explorer/smart_contract/verifier.ex | 8 ++++++ .../verifier/constructor_arguments.ex | 10 +++++++ .../explorer/smart_contract/verifier_test.exs | 27 +++++++++++++++++++ .../solidity_5.11_new_whisper_metadata.json | 7 +++++ 4 files changed, 52 insertions(+) create mode 100644 apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json diff --git a/apps/explorer/lib/explorer/smart_contract/verifier.ex b/apps/explorer/lib/explorer/smart_contract/verifier.ex index 7aa9957bab..4c2daa680c 100644 --- a/apps/explorer/lib/explorer/smart_contract/verifier.ex +++ b/apps/explorer/lib/explorer/smart_contract/verifier.ex @@ -115,6 +115,14 @@ defmodule Explorer.SmartContract.Verifier do |> Enum.reverse() |> :binary.list_to_bin() + # Solidity >= 0.5.11 https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 + # Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw:// + "a265627a7a72315820" <> + <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> _constructor_arguments -> + extracted + |> Enum.reverse() + |> :binary.list_to_bin() + <> <> rest -> do_extract_bytecode([next | extracted], rest) end diff --git a/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex b/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex index 61167a4559..6e25b3cc52 100644 --- a/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex +++ b/apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex @@ -48,6 +48,16 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do extract_constructor_arguments(constructor_arguments, passed_constructor_arguments) end + # Solidity >= 0.5.11 https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 + # Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw:// + "a265627a7a72315820" <> + <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments -> + if passed_constructor_arguments == constructor_arguments do + true + else + extract_constructor_arguments(constructor_arguments, passed_constructor_arguments) + end + <<>> -> passed_constructor_arguments == "" diff --git a/apps/explorer/test/explorer/smart_contract/verifier_test.exs b/apps/explorer/test/explorer/smart_contract/verifier_test.exs index 9633804c60..fba0622964 100644 --- a/apps/explorer/test/explorer/smart_contract/verifier_test.exs +++ b/apps/explorer/test/explorer/smart_contract/verifier_test.exs @@ -56,6 +56,33 @@ defmodule Explorer.SmartContract.VerifierTest do assert abi != nil end + test "verifies smart contract with new `whisper` metadata (bzz0 => bzz1) in solidity 0.5.11" do + contract_data = + "#{File.cwd!()}/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json" + |> File.read!() + |> Jason.decode!() + + compiler_version = contract_data["compiler_version"] + name = contract_data["name"] + optimize = false + contract = contract_data["contract"] + expected_bytecode = contract_data["bytecode"] + evm_version = contract_data["evm_version"] + + contract_address = insert(:contract_address, contract_code: "0x" <> expected_bytecode) + + params = %{ + "contract_source_code" => contract, + "compiler_version" => compiler_version, + "evm_version" => evm_version, + "name" => name, + "optimization" => optimize + } + + assert {:ok, %{abi: abi}} = Verifier.evaluate_authenticity(contract_address.hash, params) + assert abi != nil + end + test "verifies smart contract with constructor arguments", %{ contract_code_info: contract_code_info } do diff --git a/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json b/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json new file mode 100644 index 0000000000..bd0301ef78 --- /dev/null +++ b/apps/explorer/test/support/fixture/smart_contract/solidity_5.11_new_whisper_metadata.json @@ -0,0 +1,7 @@ +{ + "bytecode": "608060405260043610610105576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100a7578063d4ee1d9011610076578063d4ee1d90146105dc578063dc39d06d14610633578063dd62ed3e146106a6578063f2fde38b1461072b57610105565b80638da5cb5b1461037857806395d89b41146103cf578063a9059cbb1461045f578063cae9ca51146104d257610105565b806323b872dd116100e357806323b872dd14610238578063313ce567146102cb57806370a08231146102fc57806379ba50971461036157610105565b806306fdde031461010a578063095ea7b31461019a57806318160ddd1461020d575b600080fd5b34801561011657600080fd5b5061011f61077c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015f578082015181840152602081019050610144565b50505050905090810190601f16801561018c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a657600080fd5b506101f3600480360360408110156101bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081a565b604051808215151515815260200191505060405180910390f35b34801561021957600080fd5b5061022261090c565b6040518082815260200191505060405180910390f35b34801561024457600080fd5b506102b16004803603606081101561025b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610967565b604051808215151515815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610c12565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030857600080fd5b5061034b6004803603602081101561031f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c25565b6040518082815260200191505060405180910390f35b34801561036d57600080fd5b50610376610c6e565b005b34801561038457600080fd5b5061038d610e0b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103db57600080fd5b506103e4610e30565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610424578082015181840152602081019050610409565b50505050905090810190601f1680156104515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561046b57600080fd5b506104b86004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ece565b604051808215151515815260200191505060405180910390f35b3480156104de57600080fd5b506105c2600480360360608110156104f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561053c57600080fd5b82018360208201111561054e57600080fd5b8035906020019184600183028401116401000000008311171561057057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611069565b604051808215151515815260200191505060405180910390f35b3480156105e857600080fd5b506105f16112b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063f57600080fd5b5061068c6004803603604081101561065657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112de565b604051808215151515815260200191505060405180910390f35b3480156106b257600080fd5b50610715600480360360408110156106c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b6040518082815260200191505060405180910390f35b34801561073757600080fd5b5061077a6004803603602081101561074e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114c7565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108125780601f106107e757610100808354040283529160200191610812565b820191906000526020600020905b8154815290600101906020018083116107f557829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610962600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461156490919063ffffffff16565b905090565b60006109bb82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8d82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b5f82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cc857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ec65780601f10610e9b57610100808354040283529160200191610ec6565b820191906000526020600020905b815481529060010190602001808311610ea957829003601f168201915b505050505081565b6000610f2282600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156490919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb782600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157e90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561124657808201518184015260208101905061122b565b50505050905090810190601f1680156112735780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561129557600080fd5b505af11580156112a9573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461133957600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113fd57600080fd5b505af1158015611411573d6000803e3d6000fd5b505050506040513d602081101561142757600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461152057600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561157357600080fd5b818303905092915050565b600081830190508281101561159257600080fd5b9291505056fea265627a7a7231582073fbadbc806cc1f3349b3f98d58b62f7fa417e82d98f41bafd3dd9f9be4e4fa764736f6c634300050b0032", + "compiler_version": "v0.5.11+commit.c082d0b4", + "contract": "/**\r\n *Submitted for verification at Etherscan.io on 2019-08-16\r\n*/\r\n\r\npragma solidity ^0.5.0;\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// 'FIXED' 'Example Fixed Supply Token' token contract\r\n\r\n//\r\n\r\n// Symbol : FIXED\r\n\r\n// Name : Example Fixed Supply Token\r\n\r\n// Total supply: 1,000,000.000000000000000000\r\n\r\n// Decimals : 18\r\n\r\n//\r\n\r\n// Enjoy.\r\n\r\n//\r\n\r\n// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Safe maths\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\nlibrary SafeMath {\r\n\r\n function add(uint a, uint b) internal pure returns (uint c) {\r\n\r\n c = a + b;\r\n\r\n require(c >= a);\r\n\r\n }\r\n\r\n function sub(uint a, uint b) internal pure returns (uint c) {\r\n\r\n require(b <= a);\r\n\r\n c = a - b;\r\n\r\n }\r\n\r\n function mul(uint a, uint b) internal pure returns (uint c) {\r\n\r\n c = a * b;\r\n\r\n require(a == 0 || c / a == b);\r\n\r\n }\r\n\r\n function div(uint a, uint b) internal pure returns (uint c) {\r\n\r\n require(b > 0);\r\n\r\n c = a / b;\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// ERC Token Standard #20 Interface\r\n\r\n// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract ERC20Interface {\r\n\r\n function totalSupply() public view returns (uint);\r\n\r\n function balanceOf(address tokenOwner) public view returns (uint balance);\r\n\r\n function allowance(address tokenOwner, address spender) public view returns (uint remaining);\r\n\r\n function transfer(address to, uint tokens) public returns (bool success);\r\n\r\n function approve(address spender, uint tokens) public returns (bool success);\r\n\r\n function transferFrom(address from, address to, uint tokens) public returns (bool success);\r\n\r\n\r\n event Transfer(address indexed from, address indexed to, uint tokens);\r\n\r\n event Approval(address indexed tokenOwner, address indexed spender, uint tokens);\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Contract function to receive approval and execute function in one call\r\n\r\n//\r\n\r\n// Borrowed from MiniMeToken\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract ApproveAndCallFallBack {\r\n\r\n function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// Owned contract\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract Owned {\r\n\r\n address public owner;\r\n\r\n address public newOwner;\r\n\r\n\r\n event OwnershipTransferred(address indexed _from, address indexed _to);\r\n\r\n\r\n constructor() public {\r\n\r\n owner = msg.sender;\r\n\r\n }\r\n\r\n\r\n modifier onlyOwner {\r\n\r\n require(msg.sender == owner);\r\n\r\n _;\r\n\r\n }\r\n\r\n\r\n function transferOwnership(address _newOwner) public onlyOwner {\r\n\r\n newOwner = _newOwner;\r\n\r\n }\r\n\r\n function acceptOwnership() public {\r\n\r\n require(msg.sender == newOwner);\r\n\r\n emit OwnershipTransferred(owner, newOwner);\r\n\r\n owner = newOwner;\r\n\r\n newOwner = address(0);\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\n// ERC20 Token, with the addition of symbol, name and decimals and a\r\n\r\n// fixed supply\r\n\r\n// ----------------------------------------------------------------------------\r\n\r\ncontract FixedSupplyToken is ERC20Interface, Owned {\r\n\r\n using SafeMath for uint;\r\n\r\n\r\n string public symbol;\r\n\r\n string public name;\r\n\r\n uint8 public decimals;\r\n\r\n uint _totalSupply;\r\n\r\n\r\n mapping(address => uint) balances;\r\n\r\n mapping(address => mapping(address => uint)) allowed;\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Constructor\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n constructor() public {\r\n\r\n symbol = \"TEST\";\r\n\r\n name = \"Test Token\";\r\n\r\n decimals = 18;\r\n\r\n _totalSupply = 1000000 * 10**uint(decimals);\r\n\r\n balances[owner] = _totalSupply;\r\n\r\n emit Transfer(address(0), owner, _totalSupply);\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Total supply\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function totalSupply() public view returns (uint) {\r\n\r\n return _totalSupply.sub(balances[address(0)]);\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Get the token balance for account `tokenOwner`\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function balanceOf(address tokenOwner) public view returns (uint balance) {\r\n\r\n return balances[tokenOwner];\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Transfer the balance from token owner's account to `to` account\r\n\r\n // - Owner's account must have sufficient balance to transfer\r\n\r\n // - 0 value transfers are allowed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transfer(address to, uint tokens) public returns (bool success) {\r\n\r\n balances[msg.sender] = balances[msg.sender].sub(tokens);\r\n\r\n balances[to] = balances[to].add(tokens);\r\n\r\n emit Transfer(msg.sender, to, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Token owner can approve for `spender` to transferFrom(...) `tokens`\r\n\r\n // from the token owner's account\r\n\r\n //\r\n\r\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md\r\n\r\n // recommends that there are no checks for the approval double-spend attack\r\n\r\n // as this should be implemented in user interfaces\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function approve(address spender, uint tokens) public returns (bool success) {\r\n\r\n allowed[msg.sender][spender] = tokens;\r\n\r\n emit Approval(msg.sender, spender, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Transfer `tokens` from the `from` account to the `to` account\r\n\r\n //\r\n\r\n // The calling account must already have sufficient tokens approve(...)-d\r\n\r\n // for spending from the `from` account and\r\n\r\n // - From account must have sufficient balance to transfer\r\n\r\n // - Spender must have sufficient allowance to transfer\r\n\r\n // - 0 value transfers are allowed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transferFrom(address from, address to, uint tokens) public returns (bool success) {\r\n\r\n balances[from] = balances[from].sub(tokens);\r\n\r\n allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);\r\n\r\n balances[to] = balances[to].add(tokens);\r\n\r\n emit Transfer(from, to, tokens);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Returns the amount of tokens approved by the owner that can be\r\n\r\n // transferred to the spender's account\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function allowance(address tokenOwner, address spender) public view returns (uint remaining) {\r\n\r\n return allowed[tokenOwner][spender];\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Token owner can approve for `spender` to transferFrom(...) `tokens`\r\n\r\n // from the token owner's account. The `spender` contract function\r\n\r\n // `receiveApproval(...)` is then executed\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {\r\n\r\n allowed[msg.sender][spender] = tokens;\r\n\r\n emit Approval(msg.sender, spender, tokens);\r\n\r\n ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Don't accept ETH\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function () external payable {\r\n\r\n revert();\r\n\r\n }\r\n\r\n\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n // Owner can transfer out any accidentally sent ERC20 tokens\r\n\r\n // ------------------------------------------------------------------------\r\n\r\n function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {\r\n\r\n return ERC20Interface(tokenAddress).transfer(owner, tokens);\r\n\r\n }\r\n\r\n}", + "name": "FixedSupplyToken", + "evm_version": "byzantium" +} From 6f24e25fc80f2fbcd16feccfd37d5e189cb89a1e Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 19 Aug 2019 14:14:39 +0300 Subject: [PATCH 12/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f006769dbf..ff2fbeddb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation ### Fixes +- [#2592](https://github.com/poanetwork/blockscout/pull/2592) - process new metadata format for whisper - [#2572](https://github.com/poanetwork/blockscout/pull/2572) - Ease non-critical css - [#2570](https://github.com/poanetwork/blockscout/pull/2570) - Network icons preload - [#2569](https://github.com/poanetwork/blockscout/pull/2569) - do not fetch emission rewards for transactions csv exporter From 0c1963770c6b8012d34fb09ff53d76712cbb38d2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 10:45:09 +0300 Subject: [PATCH 13/59] 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 2b6f7eff784c2520731b1cf451fc044e3ffb862e Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 11:06:40 +0300 Subject: [PATCH 14/59] do not start genesis data fetching periodically From this point genesis data fetching will start and will be retried on a task failure. Also, this PR disables genesis data fetcher process by default because most our users won't know that they should set chain spec for it. --- apps/explorer/config/config.exs | 2 +- apps/explorer/lib/explorer/chain_spec/genesis_data.ex | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index 95c80ba445..93298073e0 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -27,7 +27,7 @@ config :explorer, Explorer.Counters.AverageBlockTime, enabled: true, period: average_block_period -config :explorer, Explorer.ChainSpec.GenesisData, enabled: true, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") +config :explorer, Explorer.ChainSpec.GenesisData, enabled: false, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: true diff --git a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex index a156aae6d7..690be2eb19 100644 --- a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex +++ b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex @@ -18,7 +18,6 @@ defmodule Explorer.ChainSpec.GenesisData do @impl GenServer def init(_) do - :timer.send_interval(@interval, :import) Process.send_after(self(), :import, @interval) {:ok, %{}} From 80186d3ce8443c1655c7b6bf76c048a257f66dc2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 11:10:52 +0300 Subject: [PATCH 15/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a49616a0a5..a8b6d16ed3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - [#2538](https://github.com/poanetwork/blockscout/pull/2538) - fetch the last not empty coin balance records ### Chore +- [#2594](https://github.com/poanetwork/blockscout/pull/2594) - do not start genesis data fetching periodically - [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases - [#2574](https://github.com/poanetwork/blockscout/pull/2574) - limit request body in json rpc error - [#2566](https://github.com/poanetwork/blockscout/pull/2566) - upgrade absinthe phoenix From 18848fe472c5f999e544dd79f9a9de3e1fed7894 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 12:40:30 +0300 Subject: [PATCH 16/59] use older version of phoenix framework In the PR (https://github.com/poanetwork/blockscout/pull/2566) phoenix was updated to `1.4.9`. But apparently new changes cause web socket connection to disconnect and connect again which shows `Connection Closed` message. We should investigate this issue and update phoenix framework after that - https://github.com/poanetwork/blockscout/issues/2595 --- apps/block_scout_web/mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index e54907177f..de55cb0eb7 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -99,7 +99,7 @@ defmodule BlockScoutWeb.Mixfile do {:logger_file_backend, "~> 0.0.10"}, {:math, "~> 0.3.0"}, {:mock, "~> 0.3.0", only: [:test], runtime: false}, - {:phoenix, "~> 1.4"}, + {:phoenix, "== 1.4.0"}, {:phoenix_ecto, "~> 4.0"}, {:phoenix_html, "~> 2.10"}, {:phoenix_live_reload, "~> 1.2", only: [:dev]}, diff --git a/mix.lock b/mix.lock index d589137148..e0d75af01a 100644 --- a/mix.lock +++ b/mix.lock @@ -81,7 +81,7 @@ "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm"}, "parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], [], "hexpm"}, "parse_trans": {:hex, :parse_trans, "3.2.0", "2adfa4daf80c14dc36f522cf190eb5c4ee3e28008fc6394397c16f62a26258c2", [:rebar3], [], "hexpm"}, - "phoenix": {:hex, :phoenix, "1.4.9", "746d098e10741c334d88143d3c94cab1756435f94387a63441792e66ec0ee974", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_form_awesomplete": {:hex, :phoenix_form_awesomplete, "0.1.5", "d09aade160b584e3428e1e095645482396f17bddda4f566f1118f12d2598d11c", [:mix], [{:phoenix_html, "~> 2.10", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, From d1a8e7f5130a2b014a2556e998db6b23cbc55273 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 13:45:11 +0300 Subject: [PATCH 17/59] add AuRa's empty step reward type Instead of producing empty blocks nodes in Aura consensus protocol broadcast an EmptyStep(step, parent_hash) message. https://github.com/paritytech/wiki/blob/master/Aura.md#empty-steps --- .../lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex index fea1a4c8aa..b2a90d53bc 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex @@ -182,4 +182,5 @@ defmodule EthereumJSONRPC.Parity.FetchedBeneficiaries do defp get_address_type(reward_type, index) when reward_type == "external" and index == 10, do: :validator defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle + defp get_address_type(reward_type, _index) when reward_type == "emptyStep", do: :validator end From de564dea01a940b31a528e80053ab1f6ab42cf97 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 13:49:43 +0300 Subject: [PATCH 18/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a49616a0a5..c691326fb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#2596](https://github.com/poanetwork/blockscout/pull/2596) - support AuRa's empty step reward type - [#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 6b2f2717fe1b494c70e71968c9c0296598d00595 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:21 +0000 Subject: [PATCH 19/59] Bump tar from 2.2.1 to 2.2.2 in /apps/block_scout_web/assets Bumps [tar](https://github.com/npm/node-tar) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/npm/node-tar/releases) - [Commits](https://github.com/npm/node-tar/compare/v2.2.1...v2.2.2) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 129 +++++++++++++----- 1 file changed, 95 insertions(+), 34 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index a03732e4e0..8f53f370d1 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -4293,6 +4293,16 @@ "readable-stream": "^2.0.0" } }, + "fs-minipass": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", + "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -4375,9 +4385,7 @@ "chownr": { "version": "1.0.1", "resolved": false, - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", - "dev": true, - "optional": true + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=" }, "code-point-at": { "version": "1.1.0", @@ -4442,8 +4450,6 @@ "version": "1.2.5", "resolved": false, "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "dev": true, - "optional": true, "requires": { "minipass": "^2.2.1" } @@ -4577,7 +4583,6 @@ "version": "2.2.4", "resolved": false, "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "dev": true, "optional": true, "requires": { "safe-buffer": "^5.1.1", @@ -4588,8 +4593,6 @@ "version": "1.1.0", "resolved": false, "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", - "dev": true, - "optional": true, "requires": { "minipass": "^2.2.1" } @@ -4799,7 +4802,6 @@ "version": "5.1.1", "resolved": false, "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true, "optional": true }, "safer-buffer": { @@ -4876,22 +4878,6 @@ "dev": true, "optional": true }, - "tar": { - "version": "4.4.1", - "resolved": false, - "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": false, @@ -4920,7 +4906,6 @@ "version": "3.0.2", "resolved": false, "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "dev": true, "optional": true } } @@ -6024,7 +6009,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 }, @@ -6226,7 +6211,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 }, @@ -7422,6 +7407,36 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "minipass": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dependencies": { + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "dev": true, + "optional": true + } + } + }, + "minizlib": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, "mississippi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", @@ -7608,6 +7623,31 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true + }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + }, + "dependencies": { + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + } + } } } }, @@ -10720,14 +10760,35 @@ "dev": true }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", + "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", "dev": true, + "optional": true, "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "dependencies": { + "chownr": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", + "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==", + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "dev": true, + "optional": true + } } }, "terser": { From a849118d70b21acc757e19b0cec7e7cc63e532f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:21 +0000 Subject: [PATCH 20/59] Bump fstream from 1.0.11 to 1.0.12 in /apps/block_scout_web/assets Bumps [fstream](https://github.com/npm/fstream) from 1.0.11 to 1.0.12. - [Release notes](https://github.com/npm/fstream/releases) - [Commits](https://github.com/npm/fstream/compare/v1.0.11...v1.0.12) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 8f53f370d1..1359939cdc 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -4911,9 +4911,9 @@ } }, "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, "requires": { "graceful-fs": "^4.1.2", From 918b22ae49b5094832b511275cb461f71cb33269 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:21 +0000 Subject: [PATCH 21/59] Bump lodash.mergewith in /apps/block_scout_web/assets Bumps [lodash.mergewith](https://github.com/lodash/lodash) from 4.6.1 to 4.6.2. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/commits) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 1359939cdc..88ba9eedbc 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -7002,9 +7002,9 @@ "dev": true }, "lodash.mergewith": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", - "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", "dev": true }, "lodash.sortby": { From 5d1254c567ed90ce518b729ed97f9e173093f21a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:20 +0000 Subject: [PATCH 22/59] Bump js-yaml from 3.7.0 to 3.13.1 in /apps/block_scout_web/assets Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.7.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.7.0...3.13.1) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 61 +++++-------------- 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 88ba9eedbc..c396e33c4b 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -2678,8 +2678,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "is-svg": { "version": "3.0.0", @@ -2690,16 +2689,6 @@ "html-comment-regex": "^1.1.0" } }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "mdn-data": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz", @@ -3638,8 +3627,7 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, "globals": { "version": "11.7.0", @@ -3647,16 +3635,6 @@ "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", "dev": true }, - "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -3812,12 +3790,6 @@ "acorn-jsx": "^3.0.0" } }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, "esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", @@ -6759,13 +6731,21 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "js-yaml": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz", - "integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", - "esprima": "^2.6.0" + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } } }, "jsbn": { @@ -8066,18 +8046,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "parse-json": { "version": "4.0.0", From 57487470cd146674048edb1d96e4ab0ecfac7d0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:16 +0000 Subject: [PATCH 23/59] Bump extend from 3.0.1 to 3.0.2 in /apps/block_scout_web/assets Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/justmoon/node-extend/releases) - [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md) - [Commits](https://github.com/justmoon/node-extend/compare/v3.0.1...v3.0.2) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index c396e33c4b..bcf7afd17b 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -3952,9 +3952,9 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extend-shallow": { From 57d234558e702d88fa3f7ecf3cdd9029a04b5536 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:15 +0000 Subject: [PATCH 24/59] Bump handlebars from 4.0.12 to 4.1.2 in /apps/block_scout_web/assets Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.12 to 4.1.2. - [Release notes](https://github.com/wycats/handlebars.js/releases) - [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md) - [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.12...v4.1.2) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index bcf7afd17b..11ef37482c 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -5115,15 +5115,23 @@ "dev": true }, "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", + "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", "dev": true, "requires": { - "async": "^2.5.0", + "neo-async": "^2.6.0", "optimist": "^0.6.1", "source-map": "^0.6.1", "uglify-js": "^3.1.4" + }, + "dependencies": { + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "dev": true + } } }, "har-schema": { From c26ec1c19072cce8614157117359a0e9dc468d84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:33:15 +0000 Subject: [PATCH 25/59] Bump lodash from 4.17.11 to 4.17.13 in /apps/block_scout_web/assets Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.13) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 6 +++--- apps/block_scout_web/assets/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 11ef37482c..2c78f45f55 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -6961,9 +6961,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.13.tgz", + "integrity": "sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==" }, "lodash.assign": { "version": "4.2.0", diff --git a/apps/block_scout_web/assets/package.json b/apps/block_scout_web/assets/package.json index 5c92b7b1f9..98fbc501d6 100644 --- a/apps/block_scout_web/assets/package.json +++ b/apps/block_scout_web/assets/package.json @@ -30,7 +30,7 @@ "highlightjs-solidity": "^1.0.6", "humps": "^2.0.1", "jquery": "^3.3.1", - "lodash": "^4.17.11", + "lodash": "^4.17.13", "moment": "^2.22.1", "nanomorph": "^5.1.3", "numeral": "^2.0.6", From e3fac4f2b190c63010381322954c264df280089e Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 21 Aug 2019 15:32:04 +0300 Subject: [PATCH 26/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b6d16ed3..a90e6e26b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - [#2538](https://github.com/poanetwork/blockscout/pull/2538) - fetch the last not empty coin balance records ### Chore +- [#2611](https://github.com/poanetwork/blockscout/pull/2611) - fix js dependency vulnerabilities - [#2594](https://github.com/poanetwork/blockscout/pull/2594) - do not start genesis data fetching periodically - [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases - [#2574](https://github.com/poanetwork/blockscout/pull/2574) - limit request body in json rpc error From 48e9005f5b1553bbd495e21e4d6129b44b43c37c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 22 Aug 2019 13:36:55 +0300 Subject: [PATCH 27/59] remove reward from getminedblocks rpc response Reward calculation is a heavy operation since it joins `rewards` and `transactions` tables with `blocks`. `transactions` is one of the largest tables in the DB. So that was a reason for a request timeout. Removing rewards fixed the issue. From this point rewards should be fetched with `getblockreward` rpc. --- .../block_scout_web/views/api/rpc/address_view.ex | 3 +-- apps/explorer/lib/explorer/etherscan.ex | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex index 2ec350da71..8063b1db40 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex @@ -157,8 +157,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do defp prepare_block(block) do %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(block.reward.value) + "timeStamp" => to_string(block.timestamp) } end diff --git a/apps/explorer/lib/explorer/etherscan.ex b/apps/explorer/lib/explorer/etherscan.ex index ca31cc5c3c..848f5ae620 100644 --- a/apps/explorer/lib/explorer/etherscan.ex +++ b/apps/explorer/lib/explorer/etherscan.ex @@ -8,8 +8,7 @@ defmodule Explorer.Etherscan do alias Explorer.Etherscan.Logs alias Explorer.{Chain, Repo} alias Explorer.Chain.Address.TokenBalance - alias Explorer.Chain.{Block, Hash, InternalTransaction, Transaction, Wei} - alias Explorer.Chain.Block.EmissionReward + alias Explorer.Chain.{Block, Hash, InternalTransaction, Transaction} @default_options %{ order_by_direction: :asc, @@ -187,22 +186,15 @@ defmodule Explorer.Etherscan do query = from( b in Block, - left_join: t in assoc(b, :transactions), - inner_join: r in EmissionReward, - on: fragment("? <@ ?", b.number, r.block_range), where: b.miner_hash == ^address_hash, order_by: [desc: b.number], group_by: b.number, group_by: b.timestamp, - group_by: r.reward, limit: ^merged_options.page_size, offset: ^offset(merged_options), select: %{ number: b.number, - timestamp: b.timestamp, - reward: %Wei{ - value: fragment("coalesce(sum(? * ?), 0) + ?", t.gas_used, t.gas_price, r.reward) - } + timestamp: b.timestamp } ) From b5999c45fe026ad897ac9527f4f60d4da2cf0ee9 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 22 Aug 2019 13:54:19 +0300 Subject: [PATCH 28/59] update docs --- apps/block_scout_web/lib/block_scout_web/etherscan.ex | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/etherscan.ex b/apps/block_scout_web/lib/block_scout_web/etherscan.ex index 867b56e746..021a0b3aa1 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -713,11 +713,6 @@ defmodule BlockScoutWeb.Etherscan do type: "timestamp", definition: "When the block was collated.", example: ~s("1480072029") - }, - blockReward: %{ - type: "block reward", - definition: "The reward given to the miner of a block.", - example: ~s("5003251945421042780") } } } From 8b91527965aa5aaeb5cfa8fdb0d3ca9609744cf5 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 22 Aug 2019 13:55:47 +0300 Subject: [PATCH 29/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 683dbac49f..08c0f4bd21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation ### Fixes +- [#2613](https://github.com/poanetwork/blockscout/pull/2613) - fix getminedblocks rpc endpoint - [#2592](https://github.com/poanetwork/blockscout/pull/2592) - process new metadata format for whisper - [#2572](https://github.com/poanetwork/blockscout/pull/2572) - Ease non-critical css - [#2570](https://github.com/poanetwork/blockscout/pull/2570) - Network icons preload From c5e4485d3d658b5fc53c2e254e93338ae4348c13 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 12:54:27 +0300 Subject: [PATCH 30/59] deduplicate coin history records by delta On coin history page we show records that are found in the db. Since we may fetch a lot of duplicated balances for the same address if its balance is not changes for multiple blocks. This PR adds deduplication by delta value to remove duplication. --- apps/explorer/lib/explorer/chain.ex | 3 +++ apps/explorer/test/explorer/chain_test.exs | 26 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 58253c0f27..a6200a81f9 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -2967,6 +2967,9 @@ defmodule Explorer.Chain do |> CoinBalance.fetch_coin_balances(paging_options) |> page_coin_balances(paging_options) |> Repo.all() + |> Enum.dedup_by(fn record -> + record.delta == Decimal.new(0) + end) end def get_coin_balance(address_hash, block_number) do diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index f49be6da4e..10788b60ba 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -4159,4 +4159,30 @@ defmodule Explorer.ChainTest do assert Chain.staking_pools_count(:inactive) == 1 end end + + describe "address_to_coin_balances/2" do + test "deduplicates records by zero delta" do + address = insert(:address) + + 1..5 + |> Enum.each(fn block_number -> + insert(:block, number: block_number) + insert(:fetched_balance, value: 1, block_number: block_number, address_hash: address.hash) + end) + + insert(:block, number: 6) + insert(:fetched_balance, value: 2, block_number: 6, address_hash: address.hash) + + assert [first, second, third] = Chain.address_to_coin_balances(address.hash, []) + + assert first.block_number == 6 + assert first.delta == Decimal.new(1) + + assert second.block_number == 5 + assert second.delta == Decimal.new(0) + + assert third.block_number == 1 + assert third.delta == Decimal.new(1) + end + end end From e8ba3b22785931c890ebc856096b99482c99a399 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 12:59:07 +0300 Subject: [PATCH 31/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c26c016be..d6cfce7118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation ### Fixes +- [#2616](https://github.com/poanetwork/blockscout/pull/2616) - deduplicate coin history records by delta - [#2592](https://github.com/poanetwork/blockscout/pull/2592) - process new metadata format for whisper - [#2572](https://github.com/poanetwork/blockscout/pull/2572) - Ease non-critical css - [#2570](https://github.com/poanetwork/blockscout/pull/2570) - Network icons preload From 045652a505a93120d28a1db92fc20241a6a8dd40 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 14:00:16 +0300 Subject: [PATCH 32/59] fix tests --- apps/explorer/lib/explorer/chain.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index a6200a81f9..c781a3463e 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -2968,7 +2968,11 @@ defmodule Explorer.Chain do |> page_coin_balances(paging_options) |> Repo.all() |> Enum.dedup_by(fn record -> - record.delta == Decimal.new(0) + if record.delta == Decimal.new(0) do + :dup + else + System.unique_integer + end end) end From cd979c02c2f257fa06eb79d05684cd14333e6406 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 14:02:46 +0300 Subject: [PATCH 33/59] mix format --- apps/explorer/lib/explorer/chain.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index c781a3463e..b2c18e8a50 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -2971,7 +2971,7 @@ defmodule Explorer.Chain do if record.delta == Decimal.new(0) do :dup else - System.unique_integer + System.unique_integer() end end) end From 0e736637a7a12484752ff65653227688d1d5518f Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 15:31:02 +0300 Subject: [PATCH 34/59] skip cache update if there are no blocks inserted Sometimes due to some error (mostly network) if may not fetch any data when indexing block. If block cache update is triggered it fails. This PR check if list is passed to cache update function. --- apps/indexer/lib/indexer/block/fetcher.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/indexer/lib/indexer/block/fetcher.ex b/apps/indexer/lib/indexer/block/fetcher.ex index 6a4eb3661b..a8b28d1391 100644 --- a/apps/indexer/lib/indexer/block/fetcher.ex +++ b/apps/indexer/lib/indexer/block/fetcher.ex @@ -183,7 +183,7 @@ defmodule Indexer.Block.Fetcher do end end - defp update_block_cache(blocks) do + defp update_block_cache(blocks) when is_list(blocks) do max_block = Enum.max_by(blocks, fn block -> block.number end) min_block = Enum.min_by(blocks, fn block -> block.number end) @@ -192,6 +192,8 @@ defmodule Indexer.Block.Fetcher do BlocksCache.update(blocks) end + defp update_block_cache(_), do: :ok + defp update_transactions_cache(transactions) do Transactions.update(transactions) end From dc4ad23953db4edbdd676b08b284e095917b02af Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 23 Aug 2019 15:34:33 +0300 Subject: [PATCH 35/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c26c016be..6c8c5cbf3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - [#2538](https://github.com/poanetwork/blockscout/pull/2538) - fetch the last not empty coin balance records ### Chore +- [#2617](https://github.com/poanetwork/blockscout/pull/2617) - skip cache update if there are no blocks inserted - [#2594](https://github.com/poanetwork/blockscout/pull/2594) - do not start genesis data fetching periodically - [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases - [#2574](https://github.com/poanetwork/blockscout/pull/2574) - limit request body in json rpc error From b38c6d1e65b02ba053237046d577acdfbb8473dc Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 11:57:22 +0300 Subject: [PATCH 36/59] 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 37/59] 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 b007451f0671567f5eda9326550b1725380fbe15 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 12:10:04 +0300 Subject: [PATCH 38/59] fix a blinking test The test was failing because `RollingWindow` process is already initialized in `setup` hook --- .../test/ethereum_jsonrpc/rolling_window_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs index 43f400434a..d053a66493 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs @@ -29,7 +29,7 @@ defmodule EthereumJSONRPC.RollingWindowTest do describe "init/1" do test "raises when duration isn't evenly divisble by window_count" do assert_raise ArgumentError, ~r"evenly divisible", fn -> - RollingWindow.init(table: @table, duration: :timer.seconds(2), window_count: 3) + RollingWindow.init(table: :init_test_table, duration: :timer.seconds(2), window_count: 3) end end From dfbc6fa7fe2c19c06c2c241bcb2293e22dd0a214 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 12:21:01 +0300 Subject: [PATCH 39/59] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c26c016be..2ee0459051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation ### Fixes +- [#2623](https://github.com/poanetwork/blockscout/pull/2623) - fix a blinking test - [#2592](https://github.com/poanetwork/blockscout/pull/2592) - process new metadata format for whisper - [#2572](https://github.com/poanetwork/blockscout/pull/2572) - Ease non-critical css - [#2570](https://github.com/poanetwork/blockscout/pull/2570) - Network icons preload From e6a65b82a3b221738a3b0e2885355b19685d2dbb Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 13:46:58 +0300 Subject: [PATCH 40/59] fix tests --- .../ethereum_jsonrpc/rolling_window_test.exs | 114 ++++++++++-------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs index d053a66493..5f8db2a821 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/rolling_window_test.exs @@ -1,27 +1,8 @@ defmodule EthereumJSONRPC.RollingWindowTest do - use ExUnit.Case, - # The same named process is used for all tests and they use the same key in the table, so they would interfere - async: false + use ExUnit.Case, async: true alias EthereumJSONRPC.RollingWindow - @table :table - - setup do - # We set `window_length` to a large time frame so that we can sweep manually to simulate - # time passing - {:ok, pid} = - RollingWindow.start_link([table: @table, duration: :timer.minutes(120), window_count: 3], name: RollingWindow) - - on_exit(fn -> Process.exit(pid, :normal) end) - - :ok - end - - defp sweep do - GenServer.call(RollingWindow, :sweep) - end - test "start_link/2" do assert {:ok, _} = RollingWindow.start_link(table: :test_table, duration: 5, window_count: 1) end @@ -40,61 +21,85 @@ defmodule EthereumJSONRPC.RollingWindowTest do end test "when no increments have happened, inspect returns an empty list" do - assert RollingWindow.inspect(@table, :foobar) == [] + table = :no_increments_have_happened + start_rolling_window(table) + + assert RollingWindow.inspect(table, :foobar) == [] end test "when no increments have happened, count returns 0" do - assert RollingWindow.count(@table, :foobar) == 0 + table = :no_increments_have_happened_empty_list + start_rolling_window(table) + + assert RollingWindow.count(table, :foobar) == 0 end test "when an increment has happened, inspect returns the count for that window" do - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_count + start_rolling_window(table) - assert RollingWindow.inspect(@table, :foobar) == [1] + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1] end test "when an increment has happened, count returns the count for that window" do - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_count1 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) - assert RollingWindow.count(@table, :foobar) == 1 + assert RollingWindow.count(table, :foobar) == 1 end test "when an increment has happened in multiple windows, inspect returns the count for both windows" do - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_multiple_windows + start_rolling_window(table) - assert RollingWindow.inspect(@table, :foobar) == [1, 1] + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1, 1] end test "when an increment has happened in multiple windows, count returns the sum of both windows" do - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) + table = :no_increments_have_happened_multiple_windows1 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) - assert RollingWindow.count(@table, :foobar) == 2 + assert RollingWindow.count(table, :foobar) == 2 end test "when an increment has happened, but has been swept times, it no longer appears in inspect" do - RollingWindow.inc(@table, :foobar) - sweep() - sweep() - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) - - assert RollingWindow.inspect(@table, :foobar) == [1, 1, 0] + table = :no_increments_have_happened_multiple_windows3 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + sweep(table) + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.inspect(table, :foobar) == [1, 1, 0] end test "when an increment has happened, but has been swept times, it no longer is included in count" do - RollingWindow.inc(@table, :foobar) - sweep() - sweep() - RollingWindow.inc(@table, :foobar) - sweep() - RollingWindow.inc(@table, :foobar) - - assert RollingWindow.count(@table, :foobar) == 2 + table = :no_increments_have_happened_multiple_windows4 + start_rolling_window(table) + + RollingWindow.inc(table, :foobar) + sweep(table) + sweep(table) + RollingWindow.inc(table, :foobar) + sweep(table) + RollingWindow.inc(table, :foobar) + + assert RollingWindow.count(table, :foobar) == 2 end test "sweeping schedules another sweep" do @@ -102,4 +107,13 @@ defmodule EthereumJSONRPC.RollingWindowTest do RollingWindow.handle_info(:sweep, state) assert_receive(:sweep) end + + defp start_rolling_window(table_name) do + {:ok, _pid} = + RollingWindow.start_link([table: table_name, duration: :timer.minutes(120), window_count: 3], name: table_name) + end + + defp sweep(name) do + GenServer.call(name, :sweep) + end end From 3d732bd4b40129297b59b585f79631fde24500dd Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 14:13:14 +0300 Subject: [PATCH 41/59] fix rpc/address_controller test --- .../api/rpc/address_controller_test.exs | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs index 7e88d4717f..96716f0935 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs @@ -2266,7 +2266,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "returns all the required fields", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -2274,17 +2274,10 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - expected_result = [ %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block.timestamp) } ] @@ -2306,7 +2299,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "with a block with one transaction", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -2314,12 +2307,6 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - params = %{ "module" => "account", "action" => "getminedblocks", @@ -2329,8 +2316,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do expected_result = [ %{ "blockNumber" => to_string(block.number), - "timeStamp" => to_string(block.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block.timestamp) } ] @@ -2346,7 +2332,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do end test "with pagination options", %{conn: conn} do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -2361,12 +2347,6 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do |> insert(gas_price: 2) |> with_block(block2, gas_used: 2) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(4)) - |> Wei.from(:wei) - params = %{ "module" => "account", "action" => "getminedblocks", @@ -2380,8 +2360,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do expected_result = [ %{ "blockNumber" => to_string(block2.number), - "timeStamp" => to_string(block2.timestamp), - "blockReward" => to_string(expected_reward.value) + "timeStamp" => to_string(block2.timestamp) } ] @@ -2683,7 +2662,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do }) end - defp resolve_schema(result \\ %{}) do + defp resolve_schema(result) do %{ "type" => "object", "properties" => %{ From 4b19c5557459ab0d40407469a47b2be2cf75010f Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 26 Aug 2019 14:20:40 +0300 Subject: [PATCH 42/59] fix explorer/etherscan tests --- .../explorer/test/explorer/etherscan_test.exs | 97 +++---------------- 1 file changed, 13 insertions(+), 84 deletions(-) diff --git a/apps/explorer/test/explorer/etherscan_test.exs b/apps/explorer/test/explorer/etherscan_test.exs index 420dd3e7d2..ded7f2cc30 100644 --- a/apps/explorer/test/explorer/etherscan_test.exs +++ b/apps/explorer/test/explorer/etherscan_test.exs @@ -4,7 +4,7 @@ defmodule Explorer.EtherscanTest do import Explorer.Factory alias Explorer.{Etherscan, Chain} - alias Explorer.Chain.{Transaction, Wei} + alias Explorer.Chain.Transaction describe "list_transactions/2" do test "with empty db" do @@ -1170,7 +1170,7 @@ defmodule Explorer.EtherscanTest do describe "list_blocks/1" do test "it returns all required fields" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -1181,17 +1181,10 @@ defmodule Explorer.EtherscanTest do |> insert(gas_price: 1) |> with_block(block, gas_used: 1) - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(1)) - |> Wei.from(:wei) - expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: expected_reward + timestamp: block.timestamp } ] @@ -1199,32 +1192,14 @@ defmodule Explorer.EtherscanTest do end test "with block containing multiple transactions" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) - # irrelevant transaction - insert(:transaction) - - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 1) - - :transaction - |> insert(gas_price: 1) - |> with_block(block, gas_used: 2) - - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(3)) - |> Wei.from(:wei) - expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: expected_reward + timestamp: block.timestamp } ] @@ -1232,7 +1207,7 @@ defmodule Explorer.EtherscanTest do end test "with block without transactions" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block = insert(:block, number: Enum.random(Range.new(range.from, range.to))) @@ -1242,8 +1217,7 @@ defmodule Explorer.EtherscanTest do expected = [ %{ number: block.number, - timestamp: block.timestamp, - reward: emission_reward.reward + timestamp: block.timestamp } ] @@ -1251,7 +1225,7 @@ defmodule Explorer.EtherscanTest do end test "with multiple blocks" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -1262,47 +1236,14 @@ defmodule Explorer.EtherscanTest do block1 = insert(:block, number: block_number1, miner: address) block2 = insert(:block, number: block_number2, miner: address) - # irrelevant transaction - insert(:transaction) - - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - :transaction - |> insert(gas_price: 3) - |> with_block(block2, gas_used: 3) - - :transaction - |> insert(gas_price: 3) - |> with_block(block2, gas_used: 3) - - expected_reward_block1 = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(8)) - |> Wei.from(:wei) - - expected_reward_block2 = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(18)) - |> Wei.from(:wei) - expected = [ %{ number: block2.number, - timestamp: block2.timestamp, - reward: expected_reward_block2 + timestamp: block2.timestamp }, %{ number: block1.number, - timestamp: block1.timestamp, - reward: expected_reward_block1 + timestamp: block1.timestamp } ] @@ -1310,7 +1251,7 @@ defmodule Explorer.EtherscanTest do end test "with pagination options" do - %{block_range: range} = emission_reward = insert(:emission_reward) + %{block_range: range} = insert(:emission_reward) block_numbers = Range.new(range.from, range.to) @@ -1321,29 +1262,17 @@ defmodule Explorer.EtherscanTest do block1 = insert(:block, number: block_number1, miner: address) block2 = insert(:block, number: block_number2, miner: address) - :transaction - |> insert(gas_price: 2) - |> with_block(block1, gas_used: 2) - - expected_reward = - emission_reward.reward - |> Wei.to(:wei) - |> Decimal.add(Decimal.new(4)) - |> Wei.from(:wei) - expected1 = [ %{ number: block2.number, - timestamp: block2.timestamp, - reward: emission_reward.reward + timestamp: block2.timestamp } ] expected2 = [ %{ number: block1.number, - timestamp: block1.timestamp, - reward: expected_reward + timestamp: block1.timestamp } ] From 66dec0c4591f9b6491bcc44615edb5d88d5d11ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2019 11:49:24 +0000 Subject: [PATCH 43/59] Bump jquery from 3.3.1 to 3.4.0 in /apps/block_scout_web/assets Bumps [jquery](https://github.com/jquery/jquery) from 3.3.1 to 3.4.0. - [Release notes](https://github.com/jquery/jquery/releases) - [Commits](https://github.com/jquery/jquery/compare/3.3.1...3.4.0) Signed-off-by: dependabot[bot] --- apps/block_scout_web/assets/package-lock.json | 6 +++--- apps/block_scout_web/assets/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/assets/package-lock.json b/apps/block_scout_web/assets/package-lock.json index 2c78f45f55..1545e3b759 100644 --- a/apps/block_scout_web/assets/package-lock.json +++ b/apps/block_scout_web/assets/package-lock.json @@ -6723,9 +6723,9 @@ } }, "jquery": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", - "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.0.tgz", + "integrity": "sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ==" }, "js-base64": { "version": "2.4.5", diff --git a/apps/block_scout_web/assets/package.json b/apps/block_scout_web/assets/package.json index 98fbc501d6..1169e22859 100644 --- a/apps/block_scout_web/assets/package.json +++ b/apps/block_scout_web/assets/package.json @@ -29,7 +29,7 @@ "highlight.js": "^9.13.1", "highlightjs-solidity": "^1.0.6", "humps": "^2.0.1", - "jquery": "^3.3.1", + "jquery": "^3.4.0", "lodash": "^4.17.13", "moment": "^2.22.1", "nanomorph": "^5.1.3", From b9f9bbfac7979efdff1f34f475f2bce78adecc04 Mon Sep 17 00:00:00 2001 From: Ethan van Ballegooyen Date: Mon, 26 Aug 2019 20:39:29 +0200 Subject: [PATCH 44/59] Removed "nav-item-networks" Having "nav-item-networks" causes the networks menu button on mobile to be pushed to the right, by removing it, it corrects this and moves the menu inline with the rest. --- .../lib/block_scout_web/templates/layout/_topnav.html.eex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 970206636c..a990e73000 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 @@ -99,7 +99,7 @@

<% end %> -