diff --git a/.dialyzer-ignore b/.dialyzer-ignore index 1535f582c8..79833b82e3 100644 --- a/.dialyzer-ignore +++ b/.dialyzer-ignore @@ -12,4 +12,6 @@ apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'fa apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true' lib/block_scout_web/router.ex:1 lib/phoenix/router.ex:324 -lib/block_scout_web/views/layout_view.ex:143 \ No newline at end of file +lib/block_scout_web/views/layout_view.ex:143 +lib/block_scout_web/controllers/api/rpc/transaction_controller.ex:21 +lib/block_scout_web/controllers/api/rpc/transaction_controller.ex:22 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9b9b2283..a527f79bad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,20 @@ ### Chore +## 3.2.0-beta + +### Features +- [#3154](https://github.com/poanetwork/blockscout/pull/3154) - Support of Hyperledger Besu client +- [#3153](https://github.com/poanetwork/blockscout/pull/3153) - Proxy contracts: logs decoding using implementation ABI +- [#3153](https://github.com/poanetwork/blockscout/pull/3153) - Proxy contracts: methods decoding using implementation ABI +- [#3149](https://github.com/poanetwork/blockscout/pull/3149) - Display and store revert reason of tx on demand at transaction details page and at gettxinfo API endpoint. + +### Fixes + +### Chore +- [#3152](https://github.com/poanetwork/blockscout/pull/3152) - Fix contract compilation tests for old versions of compiler + + ## 3.1.3-beta ### Features diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex index 565ea4b6a5..4c7abad3fe 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/transaction_controller.ex @@ -5,16 +5,30 @@ defmodule BlockScoutWeb.API.RPC.TransactionController do alias Explorer.Chain + alias Explorer.Chain.Transaction + def gettxinfo(conn, params) do with {:txhash_param, {:ok, txhash_param}} <- fetch_txhash(params), {:format, {:ok, transaction_hash}} <- to_transaction_hash(txhash_param), - {:transaction, {:ok, transaction}} <- transaction_from_hash(transaction_hash), + {:transaction, {:ok, %Transaction{revert_reason: revert_reason, error: error} = transaction}} <- + transaction_from_hash(transaction_hash), paging_options <- paging_options(params) do logs = Chain.transaction_to_logs(transaction_hash, paging_options) {logs, next_page} = split_list_by_page(logs) + transaction_updated = + if error == "Reverted" do + if revert_reason == nil do + %Transaction{transaction | revert_reason: Chain.fetch_tx_revert_reason(transaction)} + else + transaction + end + else + transaction + end + render(conn, :gettxinfo, %{ - transaction: transaction, + transaction: transaction_updated, block_height: Chain.block_height(), logs: logs, next_page_params: next_page_params(next_page, logs, params) 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 330b493d8c..ee831c26e0 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -491,7 +491,8 @@ defmodule BlockScoutWeb.Etherscan do "success" => true, "timeStamp" => "1541018182", "to" => "0x000000000000000000000000000000000000000d", - "value" => "67612" + "value" => "67612", + revertReason: "No credit of that type" } } @@ -630,6 +631,12 @@ defmodule BlockScoutWeb.Etherscan do example: ~s("18") } + @revert_reason_type %{ + type: "revert_reason", + definition: "Revert reason of transaction.", + example: ~s("No credit of that type") + } + @logs_details %{ name: "Log Detail", fields: %{ @@ -1031,7 +1038,8 @@ defmodule BlockScoutWeb.Etherscan do logs: %{ type: "array", array_type: @logs_details - } + }, + revertReason: @revert_reason_type } } 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 ce01098d43..d54f71fb41 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 @@ -55,12 +55,16 @@ class: "dropdown-item #{tab_status("txs", @conn.request_path)}", to: transaction_path(@conn, :index) ) %> - <%= link( - gettext("Pending"), - class: "dropdown-item #{tab_status("pending_transactions", @conn.request_path)}", - "data-test": "pending_transactions_link", - to: pending_transaction_path(@conn, :index) - ) %> + <% json_rpc_named_arguments = Application.fetch_env!(:indexer, :json_rpc_named_arguments)%> + <% variant = Keyword.fetch!(json_rpc_named_arguments, :variant) %> + <%= if variant !== EthereumJSONRPC.Besu do %> + <%= link( + gettext("Pending"), + class: "dropdown-item #{tab_status("pending_transactions", @conn.request_path)}", + "data-test": "pending_transactions_link", + to: pending_transaction_path(@conn, :index) + ) %> + <% end %>