Integrate sig provider (#6541)

* Integrate sig provider

* Fix API verification call

* Fix env usage

* Update Elixir & OTP versions in .yml configs

* Fix dialyzer

* Update apps/explorer/lib/explorer/chain/transaction.ex

Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>

* Add sig-provider to docker compose

* integrate sig provider

* Fix env usage

* Update image in Dockerfile

* Update OTP and Elixir versions in github .yml's

* Add pull_policy: always for sig_provider service

* Update Dockerfile

* Avoid append_query function

* Revert changes in Dockerfile, update platform in other docker-compose files

* Update Dockerfile

* Reset GA cache

* Remove unused alias

* Return unused alias

* Remove unused alias

* Update cache

* Fix gettext

---------

Co-authored-by: Viktor Baranov <baranov.viktor.27@gmail.com>
pull/6788/head
nikitosing 2 years ago committed by GitHub
parent 588ed4d363
commit 8464e8254a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .dialyzer-ignore
  2. 4
      .github/workflows/config.yml
  3. 4
      .github/workflows/publish-docker-image-every-push.yml
  4. 4
      .github/workflows/publish-docker-image-release.yml
  5. 1
      CHANGELOG.md
  6. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex
  7. 2
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  8. 142
      apps/block_scout_web/priv/gettext/default.pot
  9. 142
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  10. 4
      apps/explorer/config/config.exs
  11. 6
      apps/explorer/lib/explorer/chain/cache/block_number.ex
  12. 41
      apps/explorer/lib/explorer/chain/log.ex
  13. 119
      apps/explorer/lib/explorer/chain/transaction.ex
  14. 2
      apps/explorer/lib/explorer/smart_contract/rust_verifier_interface.ex
  15. 88
      apps/explorer/lib/explorer/smart_contract/sig_provider_interface.ex
  16. 1
      apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex
  17. 4
      apps/explorer/lib/explorer/third_party_integrations/sourcify.ex
  18. 12
      config/runtime.exs
  19. 11
      docker-compose/docker-compose-no-build-erigon.yml
  20. 11
      docker-compose/docker-compose-no-build-ganache.yml
  21. 11
      docker-compose/docker-compose-no-build-geth.yml
  22. 11
      docker-compose/docker-compose-no-build-hardhat-network.yml
  23. 11
      docker-compose/docker-compose-no-build-nethermind.yml
  24. 11
      docker-compose/docker-compose-no-build-no-db-container.yml
  25. 1
      docker-compose/docker-compose-no-rust-services.yml
  26. 12
      docker-compose/docker-compose.yml
  27. 3
      docker-compose/envs/common-blockscout.env
  28. 10
      docker/Makefile

@ -22,11 +22,11 @@ lib/explorer/smart_contract/reader.ex:435
lib/indexer/fetcher/token_total_supply_on_demand.ex:16
lib/explorer/exchange_rates/source.ex:116
lib/explorer/exchange_rates/source.ex:119
lib/explorer/smart_contract/solidity/verifier.ex:317
lib/explorer/smart_contract/solidity/verifier.ex:318
lib/block_scout_web/templates/address_contract/index.html.eex:158
lib/block_scout_web/templates/address_contract/index.html.eex:195
lib/explorer/third_party_integrations/sourcify.ex:120
lib/explorer/third_party_integrations/sourcify.ex:123
lib/explorer/third_party_integrations/sourcify.ex:121
lib/explorer/third_party_integrations/sourcify.ex:124
lib/block_scout_web/views/transaction_view.ex:137
lib/block_scout_web/views/transaction_view.ex:152
lib/block_scout_web/views/transaction_view.ex:197

@ -10,8 +10,8 @@ on:
env:
MIX_ENV: test
OTP_VERSION: '24.3.4.1'
ELIXIR_VERSION: '1.13.4'
OTP_VERSION: '25.2.1'
ELIXIR_VERSION: '1.14.3'
ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
ACCOUNT_AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout'
ACCOUNT_AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout'

@ -5,8 +5,8 @@ on:
branches:
- master
env:
OTP_VERSION: '24.3.4.1'
ELIXIR_VERSION: '1.13.4'
OTP_VERSION: '25.2.1'
ELIXIR_VERSION: '1.14.3'
NEXT_RELEASE_VERSION: 5.0.1
jobs:

@ -10,8 +10,8 @@ on:
types: [published]
env:
OTP_VERSION: '24.3.4.1'
ELIXIR_VERSION: '1.13.4'
OTP_VERSION: '25.2.1'
ELIXIR_VERSION: '1.14.3'
jobs:
push_to_registry:

@ -6,6 +6,7 @@
- [#6763](https://github.com/blockscout/blockscout/pull/6763) - Permanent UI dark mode
- [#6721](https://github.com/blockscout/blockscout/pull/6721) - Implement fetching internal transactions from callTracer
- [#6541](https://github.com/blockscout/blockscout/pull/6541) - Integrate sig provider
- [#6712](https://github.com/blockscout/blockscout/pull/6712) - API v2 update
### Fixes

@ -15,7 +15,7 @@
<% end %>
</div>
<%= unless Enum.empty?(candidates) do %>
<h3><%= gettext "Potential matches from our contract method database:" %></h3>
<h3><%= gettext "Potential matches from contract method database:" %></h3>
<%= gettext "IMPORTANT: This information is a best guess based on similar functions from other verified contracts." %>
<%= gettext "To have guaranteed accuracy, use the link above to verify the contract's source code." %>

@ -1,7 +1,7 @@
defmodule BlockScoutWeb.LayoutView do
use BlockScoutWeb, :view
alias Explorer.{Chain, CustomContractsHelpers}
alias Explorer.Chain
alias Plug.Conn
alias Poison.Parser

@ -81,11 +81,31 @@ msgstr ""
msgid ") may be added for each contract. Click the Add Library button to add an additional one."
msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:236
#: lib/block_scout_web/templates/layout/app.html.eex:171
#, elixir-autogen, elixir-format
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:8
#, elixir-autogen, elixir-format
msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#, elixir-autogen, elixir-format
msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:10
#, elixir-autogen, elixir-format
msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:11
#, elixir-autogen, elixir-format
msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/block/overview.html.eex:195
#, elixir-autogen, elixir-format
msgid "64-bit hash of value verifying proof-of-work (note: null for POA chains)."
@ -319,6 +339,11 @@ msgstr ""
msgid "Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees."
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again."
msgstr ""
#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15
#, elixir-autogen, elixir-format
msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences."
@ -364,6 +389,14 @@ msgstr ""
msgid "Back to Watch list (Cancel)"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:9
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9
#: lib/block_scout_web/templates/page_not_found/index.html.eex:9
#: lib/block_scout_web/templates/transaction/not_found.html.eex:13
#, elixir-autogen, elixir-format
msgid "Back to home"
msgstr ""
#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24
#: lib/block_scout_web/templates/address/overview.html.eex:150
#: lib/block_scout_web/templates/address_token/overview.html.eex:51
@ -1515,6 +1548,11 @@ msgstr ""
msgid "Internal Transactions"
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Internal server error"
msgstr ""
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19
#: lib/block_scout_web/views/tokens/overview_view.ex:42
@ -2001,6 +2039,10 @@ msgid "Position %{index}"
msgstr ""
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18
#, elixir-autogen, elixir-format
msgid "Potential matches from contract method database:"
msgstr ""
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32
#, elixir-autogen, elixir-format
msgid "Potential matches from our contract method database:"
@ -2136,6 +2178,11 @@ msgstr ""
msgid "Request a public tag/label"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Request cannot be processed"
msgstr ""
#: lib/block_scout_web/templates/account/public_tags_request/index.html.eex:37
#, elixir-autogen, elixir-format
msgid "Request to add public tag"
@ -2275,11 +2322,21 @@ msgstr ""
msgid "Shows total assets held in the address"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:29
#, elixir-autogen, elixir-format
msgid "Sign in"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:20
#, elixir-autogen, elixir-format
msgid "Sign out"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11
#, elixir-autogen, elixir-format
msgid "Signed in as "
msgstr ""
#: lib/block_scout_web/templates/block/overview.html.eex:114
#, elixir-autogen, elixir-format
msgid "Size"
@ -2343,6 +2400,11 @@ msgstr ""
msgid "Something went wrong, click to retry."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:6
#, elixir-autogen, elixir-format
msgid "Sorry, we are unable to locate this transaction hash"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63
#, elixir-autogen, elixir-format
msgid "Sources *.sol files"
@ -2632,6 +2694,11 @@ msgstr ""
msgid "This is useful to allow sending requests to blockscout without having to change anything about the request."
msgstr ""
#: lib/block_scout_web/templates/page_not_found/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for."
msgstr ""
#: lib/block_scout_web/templates/transaction_state/index.html.eex:17
#, elixir-autogen, elixir-format
msgid "This transaction hasn't changed state."
@ -3332,6 +3399,11 @@ msgstr ""
msgid "Your name*"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info."
msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:111
#, elixir-autogen, elixir-format
msgid "at"
@ -3442,71 +3514,3 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "truffle flattener"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:29
#, elixir-autogen, elixir-format
msgid "Sign in"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11
#, elixir-autogen, elixir-format
msgid "Signed in as "
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:8
#, elixir-autogen, elixir-format
msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#, elixir-autogen, elixir-format
msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:10
#, elixir-autogen, elixir-format
msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:11
#, elixir-autogen, elixir-format
msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again."
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:9
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9
#: lib/block_scout_web/templates/page_not_found/index.html.eex:9
#: lib/block_scout_web/templates/transaction/not_found.html.eex:13
#, elixir-autogen, elixir-format
msgid "Back to home"
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Internal server error"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Request cannot be processed"
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:6
#, elixir-autogen, elixir-format
msgid "Sorry, we are unable to locate this transaction hash"
msgstr ""
#: lib/block_scout_web/templates/page_not_found/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for."
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info."
msgstr ""

@ -81,11 +81,31 @@ msgstr ""
msgid ") may be added for each contract. Click the Add Library button to add an additional one."
msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:236
#: lib/block_scout_web/templates/layout/app.html.eex:171
#, elixir-autogen, elixir-format
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:8
#, elixir-autogen, elixir-format
msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#, elixir-autogen, elixir-format
msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:10
#, elixir-autogen, elixir-format
msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:11
#, elixir-autogen, elixir-format
msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/block/overview.html.eex:195
#, elixir-autogen, elixir-format
msgid "64-bit hash of value verifying proof-of-work (note: null for POA chains)."
@ -319,6 +339,11 @@ msgstr ""
msgid "Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees."
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again."
msgstr ""
#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15
#, elixir-autogen, elixir-format
msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences."
@ -364,6 +389,14 @@ msgstr ""
msgid "Back to Watch list (Cancel)"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:9
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9
#: lib/block_scout_web/templates/page_not_found/index.html.eex:9
#: lib/block_scout_web/templates/transaction/not_found.html.eex:13
#, elixir-autogen, elixir-format
msgid "Back to home"
msgstr ""
#: lib/block_scout_web/templates/account/watchlist/show.html.eex:24
#: lib/block_scout_web/templates/address/overview.html.eex:150
#: lib/block_scout_web/templates/address_token/overview.html.eex:51
@ -1515,6 +1548,11 @@ msgstr ""
msgid "Internal Transactions"
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Internal server error"
msgstr ""
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:16
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19
#: lib/block_scout_web/views/tokens/overview_view.ex:42
@ -2001,6 +2039,10 @@ msgid "Position %{index}"
msgstr ""
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:18
#, elixir-autogen, elixir-format
msgid "Potential matches from contract method database:"
msgstr ""
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:32
#, elixir-autogen, elixir-format
msgid "Potential matches from our contract method database:"
@ -2136,6 +2178,11 @@ msgstr ""
msgid "Request a public tag/label"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Request cannot be processed"
msgstr ""
#: lib/block_scout_web/templates/account/public_tags_request/index.html.eex:37
#, elixir-autogen, elixir-format
msgid "Request to add public tag"
@ -2275,11 +2322,21 @@ msgstr ""
msgid "Shows total assets held in the address"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:29
#, elixir-autogen, elixir-format
msgid "Sign in"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:20
#, elixir-autogen, elixir-format
msgid "Sign out"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11
#, elixir-autogen, elixir-format
msgid "Signed in as "
msgstr ""
#: lib/block_scout_web/templates/block/overview.html.eex:114
#, elixir-autogen, elixir-format
msgid "Size"
@ -2343,6 +2400,11 @@ msgstr ""
msgid "Something went wrong, click to retry."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:6
#, elixir-autogen, elixir-format
msgid "Sorry, we are unable to locate this transaction hash"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63
#, elixir-autogen, elixir-format
msgid "Sources *.sol files"
@ -2632,6 +2694,11 @@ msgstr ""
msgid "This is useful to allow sending requests to blockscout without having to change anything about the request."
msgstr ""
#: lib/block_scout_web/templates/page_not_found/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for."
msgstr ""
#: lib/block_scout_web/templates/transaction_state/index.html.eex:17
#, elixir-autogen, elixir-format
msgid "This transaction hasn't changed state."
@ -3332,6 +3399,11 @@ msgstr ""
msgid "Your name*"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info."
msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:111
#, elixir-autogen, elixir-format
msgid "at"
@ -3442,71 +3514,3 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "truffle flattener"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:29
#, elixir-autogen, elixir-format
msgid "Sign in"
msgstr ""
#: lib/block_scout_web/templates/layout/_account_menu_item.html.eex:11
#, elixir-autogen, elixir-format
msgid "Signed in as "
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:8
#, elixir-autogen, elixir-format, fuzzy
msgid "1. If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#, elixir-autogen, elixir-format, fuzzy
msgid "2. It could still be in the TX Pool of a different node, waiting to be broadcasted."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:10
#, elixir-autogen, elixir-format, fuzzy
msgid "3. During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it."
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:11
#, elixir-autogen, elixir-format, fuzzy
msgid "4. If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "An unexpected error has occurred. Try reloading the page, or come back soon and try again."
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:9
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:9
#: lib/block_scout_web/templates/page_not_found/index.html.eex:9
#: lib/block_scout_web/templates/transaction/not_found.html.eex:13
#, elixir-autogen, elixir-format, fuzzy
msgid "Back to home"
msgstr ""
#: lib/block_scout_web/templates/internal_server_error/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Internal server error"
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:7
#, elixir-autogen, elixir-format
msgid "Request cannot be processed"
msgstr ""
#: lib/block_scout_web/templates/transaction/not_found.html.eex:6
#, elixir-autogen, elixir-format, fuzzy
msgid "Sorry, we are unable to locate this transaction hash"
msgstr ""
#: lib/block_scout_web/templates/page_not_found/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "This page is no longer explorable! If you are lost, use the search bar to find what you are looking for."
msgstr ""
#: lib/block_scout_web/templates/error422/index.html.eex:8
#, elixir-autogen, elixir-format
msgid "Your request contained an error, perhaps a mistyped tx/block/address hash. Try again, and check the developer tools console for more info."
msgstr ""

@ -8,7 +8,9 @@ import Config
# General application configuration
config :explorer,
ecto_repos: [Explorer.Repo, Explorer.Repo.Account],
token_functions_reader_max_retries: 3
token_functions_reader_max_retries: 3,
# for not fully indexed blockchains
decode_not_a_contract_calls: System.get_env("DECODE_NOT_A_CONTRACT_CALLS") == "true"
config :explorer, Explorer.Counters.AverageBlockTime,
enabled: true,

@ -13,11 +13,11 @@ defmodule Explorer.Chain.Cache.BlockNumber do
alias Explorer.Chain
defp handle_update(_key, nil, value), do: {:ok, value}
def handle_update(_key, nil, value), do: {:ok, value}
defp handle_update(:min, old_value, new_value), do: {:ok, min(new_value, old_value)}
def handle_update(:min, old_value, new_value), do: {:ok, min(new_value, old_value)}
defp handle_update(:max, old_value, new_value), do: {:ok, max(new_value, old_value)}
def handle_update(:max, old_value, new_value), do: {:ok, max(new_value, old_value)}
defp handle_fallback(key) do
result = fetch_from_db(key)

@ -8,6 +8,7 @@ defmodule Explorer.Chain.Log do
alias ABI.{Event, FunctionSelector}
alias Explorer.{Chain, Repo}
alias Explorer.Chain.{Address, Block, ContractMethod, Data, Hash, Transaction}
alias Explorer.SmartContract.SigProviderInterface
@required_attrs ~w(address_hash data block_hash index transaction_hash)a
@optional_attrs ~w(first_topic second_topic third_topic fourth_topic type block_number)a
@ -139,13 +140,13 @@ defmodule Explorer.Chain.Log do
{:error, :could_not_decode} ->
case find_candidates(log, transaction) do
{:error, :contract_not_verified, []} ->
{:error, :could_not_decode}
decode_event_via_sig_provider(log, transaction)
{:error, :contract_not_verified, candidates} ->
{:error, :contract_verified, candidates}
_ ->
{:error, :could_not_decode}
decode_event_via_sig_provider(log, transaction)
end
output ->
@ -199,7 +200,8 @@ defmodule Explorer.Chain.Log do
end)
|> Enum.take(1)
{:error, :contract_not_verified, candidates}
{:error, :contract_not_verified,
if(candidates == [], do: decode_event_via_sig_provider(log, transaction, true), else: candidates)}
end
defp find_and_decode(abi, log, transaction) do
@ -240,6 +242,39 @@ defmodule Explorer.Chain.Log do
IO.iodata_to_binary([name, "(", text, ")"])
end
defp decode_event_via_sig_provider(log, transaction, only_candidates? \\ false) do
with true <- SigProviderInterface.enabled?(),
{:ok, result} <-
SigProviderInterface.decode_event(
[
log.first_topic,
log.second_topic,
log.third_topic,
log.fourth_topic
],
log.data
),
true <- is_list(result),
false <- Enum.empty?(result),
abi <- [result |> List.first() |> Map.put("type", "event")],
{:ok, selector, mapping} <- find_and_decode(abi, log, transaction),
identifier <- Base.encode16(selector.method_id, case: :lower),
text <- function_call(selector.function, mapping) do
if only_candidates? do
[{:ok, identifier, text, mapping}]
else
{:error, :contract_not_verified, [{:ok, identifier, text, mapping}]}
end
else
_ ->
if only_candidates? do
[]
else
{:error, :could_not_decode}
end
end
end
def decode16!(nil), do: nil
def decode16!(value) do

@ -30,6 +30,7 @@ defmodule Explorer.Chain.Transaction do
}
alias Explorer.Chain.Transaction.{Fork, Status}
alias Explorer.SmartContract.SigProviderInterface
@optional_attrs ~w(max_priority_fee_per_gas max_fee_per_gas block_hash block_number created_contract_address_hash cumulative_gas_used earliest_processing_start
error gas_used index created_contract_code_indexed_at status to_address_hash revert_reason type has_error_in_internal_txs)a
@ -454,7 +455,12 @@ defmodule Explorer.Chain.Transaction do
case Integer.parse(hex_revert_reason, 16) do
{number, ""} ->
binary_revert_reason = :binary.encode_unsigned(number)
decoded_input_data(%Transaction{to_address: smart_contract, hash: hash, input: %{bytes: binary_revert_reason}})
decoded_input_data(%Transaction{
to_address: smart_contract,
hash: hash,
input: %Data{bytes: binary_revert_reason}
})
_ ->
hex_revert_reason
@ -462,40 +468,60 @@ defmodule Explorer.Chain.Transaction do
end
# Because there is no contract association, we know the contract was not verified
def decoded_input_data(%__MODULE__{to_address: nil}), do: {:error, :no_to_address}
def decoded_input_data(%NotLoaded{}), do: {:error, :not_loaded}
def decoded_input_data(%__MODULE__{input: %{bytes: bytes}}) when bytes in [nil, <<>>], do: {:error, :no_input_data}
def decoded_input_data(%__MODULE__{to_address: %{contract_code: nil}}), do: {:error, :not_a_contract_call}
def decoded_input_data(tx, extract_names? \\ false)
def decoded_input_data(%__MODULE__{
to_address: %{smart_contract: %NotLoaded{}},
def decoded_input_data(%__MODULE__{to_address: nil}, _), do: {:error, :no_to_address}
def decoded_input_data(%NotLoaded{}, _), do: {:error, :not_loaded}
def decoded_input_data(%__MODULE__{input: %{bytes: bytes}}, _) when bytes in [nil, <<>>], do: {:error, :no_input_data}
if not Application.compile_env(:explorer, :decode_not_a_contract_calls) do
def decoded_input_data(%__MODULE__{to_address: %{contract_code: nil}}, _), do: {:error, :not_a_contract_call}
end
def decoded_input_data(
%__MODULE__{
to_address: %NotLoaded{},
input: input,
hash: hash
}) do
decoded_input_data(%__MODULE__{
},
extract_names?
) do
decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: nil},
input: input,
hash: hash
})
},
extract_names?
)
end
def decoded_input_data(%__MODULE__{
to_address: %NotLoaded{},
def decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: %NotLoaded{}},
input: input,
hash: hash
}) do
decoded_input_data(%__MODULE__{
},
extract_names?
) do
decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: nil},
input: input,
hash: hash
})
},
extract_names?
)
end
def decoded_input_data(%__MODULE__{
def decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: nil},
input: %{bytes: <<method_id::binary-size(4), _::binary>> = data},
input: %{bytes: <<method_id::binary-size(4), _::binary>> = data} = input,
hash: hash
}) do
},
extract_names?
) do
candidates_query =
from(
contract_method in ContractMethod,
@ -513,28 +539,35 @@ defmodule Explorer.Chain.Transaction do
end
end)
{:error, :contract_not_verified, candidates}
{:error, :contract_not_verified,
if(candidates == [], do: decode_function_call_via_sig_provider(input, hash, extract_names?), else: candidates)}
end
def decoded_input_data(%__MODULE__{to_address: %{smart_contract: nil}}) do
def decoded_input_data(%__MODULE__{to_address: %{smart_contract: nil}}, _) do
{:error, :contract_not_verified, []}
end
def decoded_input_data(%__MODULE__{
input: %{bytes: data},
def decoded_input_data(
%__MODULE__{
input: %{bytes: data} = input,
to_address: %{smart_contract: smart_contract},
hash: hash
}) do
},
extract_names?
) do
case do_decoded_input_data(data, smart_contract, hash) do
# In some cases transactions use methods of some unpredictadle contracts, so we can try to look up for method in a whole DB
# In some cases transactions use methods of some unpredictable contracts, so we can try to look up for method in a whole DB
{:error, :could_not_decode} ->
case decoded_input_data(%__MODULE__{
case decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: nil},
input: %{bytes: data},
hash: hash
}) do
},
extract_names?
) do
{:error, :contract_not_verified, []} ->
{:error, :could_not_decode}
decode_function_call_via_sig_provider_wrapper(input, hash, extract_names?)
{:error, :contract_not_verified, candidates} ->
{:error, :contract_verified, candidates}
@ -548,6 +581,16 @@ defmodule Explorer.Chain.Transaction do
end
end
defp decode_function_call_via_sig_provider_wrapper(input, hash, extract_names?) do
case decode_function_call_via_sig_provider(input, hash, extract_names?) do
[] ->
{:error, :could_not_decode}
result ->
{:error, :contract_verified, result}
end
end
defp do_decoded_input_data(data, smart_contract, hash) do
full_abi = Chain.combine_proxy_implementation_abi(smart_contract)
@ -558,6 +601,21 @@ defmodule Explorer.Chain.Transaction do
do: {:ok, identifier, text, mapping}
end
defp decode_function_call_via_sig_provider(%{bytes: data} = input, hash, extract_names?) do
with true <- SigProviderInterface.enabled?(),
false <- extract_names?,
{:ok, result} <- SigProviderInterface.decode_function_call(input),
true <- is_list(result),
false <- Enum.empty?(result),
abi <- [result |> List.first() |> Map.put("outputs", []) |> Map.put("type", "function")],
{:ok, _, _, _} = candidate <- do_decoded_input_data(data, %SmartContract{abi: abi, address_hash: nil}, hash) do
[candidate]
else
_ ->
[]
end
end
def get_method_name(
%__MODULE__{
input: %{bytes: <<method_id::binary-size(4), _::binary>>}
@ -566,11 +624,14 @@ defmodule Explorer.Chain.Transaction do
if transaction.created_contract_address_hash do
nil
else
case Transaction.decoded_input_data(%__MODULE__{
case Transaction.decoded_input_data(
%__MODULE__{
to_address: %{smart_contract: nil},
input: transaction.input,
hash: transaction.hash
}) do
},
true
) do
{:error, :contract_not_verified, [{:ok, _method_id, decoded_func, _}]} ->
parse_method_name(decoded_func)

@ -6,7 +6,7 @@ defmodule Explorer.SmartContract.RustVerifierInterface do
alias HTTPoison.Response
require Logger
@post_timeout :infinity
@post_timeout :timer.seconds(30)
@request_error_msg "Error while sending request to verification microservice"
def verify_multi_part(

@ -0,0 +1,88 @@
defmodule Explorer.SmartContract.SigProviderInterface do
@moduledoc """
Adapter for decoding events and function calls with https://github.com/blockscout/blockscout-rs/tree/main/sig-provider
"""
alias Explorer.Utility.RustService
alias HTTPoison.Response
require Logger
@request_error_msg "Error while sending request to sig-provider"
def decode_function_call(input) do
base_url = tx_input_decode_url()
url =
base_url
|> URI.parse()
|> Map.put(:query, URI.encode_query(%{"txInput" => to_string(input)}))
|> URI.to_string()
http_get_request(url)
end
def decode_event(topics, data) do
base_url = event_decode_url()
url =
base_url
|> URI.parse()
|> Map.put(
:query,
URI.encode_query(%{"topics" => topics |> Enum.reject(&is_nil/1) |> Enum.join(","), "data" => to_string(data)})
)
|> URI.to_string()
http_get_request(url)
end
def http_get_request(url) do
case HTTPoison.get(url) do
{:ok, %Response{body: body, status_code: 200}} ->
proccess_sig_provider_response(body)
{:ok, %Response{body: body, status_code: _}} ->
{:error, body}
{:error, error} ->
old_truncate = Application.get_env(:logger, :truncate)
Logger.configure(truncate: :infinity)
Logger.error(fn ->
[
"Error while sending request to sig-provider url: #{url}: ",
inspect(error, limit: :infinity, printable_limit: :infinity)
]
end)
Logger.configure(truncate: old_truncate)
{:error, @request_error_msg}
end
end
def proccess_sig_provider_response(body) when is_binary(body) do
case Jason.decode(body) do
{:ok, decoded} ->
proccess_sig_provider_response(decoded)
_ ->
{:error, body}
end
end
def proccess_sig_provider_response(results) when is_list(results), do: {:ok, results}
def proccess_sig_provider_response(other_responses), do: {:error, other_responses}
def tx_input_decode_url, do: "#{base_api_url()}" <> "/function"
def event_decode_url, do: "#{base_api_url()}" <> "/event"
def base_api_url, do: "#{base_url()}" <> "/api/v1/abi"
def base_url do
RustService.base_url(__MODULE__)
end
def enabled?, do: Application.get_env(:explorer, __MODULE__)[:enabled]
end

@ -57,6 +57,7 @@ defmodule Explorer.SmartContract.Solidity.Verifier do
})
|> Map.put("contract_libraries", params["external_libraries"])
|> Map.put("optimization_runs", prepare_optimization_runs(params["optimization"], params["optimization_runs"]))
|> Map.put("evm_version", Map.get(params, "evm_version", "default"))
|> RustVerifierInterface.verify_multi_part()
end

@ -8,6 +8,7 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do
alias HTTPoison.{Error, Response}
alias Tesla.Multipart
@post_timeout :timer.seconds(30)
@no_metadata_message "Sourcify did not return metadata"
@failed_verification_message "Unsuccessful Sourcify verification"
@ -138,7 +139,8 @@ defmodule Explorer.ThirdPartyIntegrations.Sourcify do
end
def http_post_request_rust_microservice(url, body) do
request = HTTPoison.post(url, Jason.encode!(body), [{"Content-Type", "application/json"}], recv_timeout: :infinity)
request =
HTTPoison.post(url, Jason.encode!(body), [{"Content-Type", "application/json"}], recv_timeout: @post_timeout)
case request do
{:ok, %Response{body: body, status_code: 200}} ->

@ -223,10 +223,6 @@ config :explorer,
restricted_list: System.get_env("RESTRICTED_LIST", nil),
restricted_list_key: System.get_env("RESTRICTED_LIST_KEY", nil)
config :explorer, Explorer.Visualize.Sol2uml,
service_url: System.get_env("VISUALIZE_SOL2UML_SERVICE_URL"),
enabled: System.get_env("VISUALIZE_SOL2UML_ENABLED") == "true"
config :explorer, Explorer.Chain.Events.Listener,
enabled:
if(disable_webapp == "true" && disable_indexer == "true",
@ -358,6 +354,14 @@ config :explorer, Explorer.SmartContract.RustVerifierInterface,
service_url: System.get_env("RUST_VERIFICATION_SERVICE_URL"),
enabled: System.get_env("ENABLE_RUST_VERIFICATION_SERVICE") == "true"
config :explorer, Explorer.Visualize.Sol2uml,
service_url: System.get_env("VISUALIZE_SOL2UML_SERVICE_URL"),
enabled: System.get_env("VISUALIZE_SOL2UML_ENABLED") == "true"
config :explorer, Explorer.SmartContract.SigProviderInterface,
service_url: System.get_env("SIG_PROVIDER_SERVICE_URL"),
enabled: System.get_env("SIG_PROVIDER_ENABLED") == "true"
config :explorer, Explorer.ThirdPartyIntegrations.AirTable,
table_url: System.get_env("ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL"),
api_key: System.get_env("ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY")

@ -24,6 +24,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -52,6 +53,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -62,6 +64,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -71,3 +74,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -22,6 +22,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -53,6 +54,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -63,6 +65,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -72,3 +75,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -24,6 +24,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -52,6 +53,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -62,6 +64,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -71,3 +74,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -22,6 +22,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -51,6 +52,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -61,6 +63,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -70,3 +73,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -24,6 +24,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -52,6 +53,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -62,6 +64,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -71,3 +74,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -11,6 +11,7 @@ services:
- ./redis-data:/data
blockscout:
platform: linux/x86_64
depends_on:
- smart-contract-verifier
- redis_db
@ -35,6 +36,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -45,6 +47,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -54,3 +57,11 @@ services:
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -22,6 +22,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- redis_db

@ -22,6 +22,7 @@ services:
- 7432:5432
blockscout:
platform: linux/x86_64
depends_on:
- db
- smart-contract-verifier
@ -57,6 +58,7 @@ services:
- ./logs/:/app/logs/
smart-contract-verifier:
platform: linux/x86_64
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -67,6 +69,7 @@ services:
- 8043:8043
visualizer:
platform: linux/x86_64
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
restart: always
@ -75,3 +78,12 @@ services:
- ./envs/common-visualizer.env
ports:
- 8050:8050
sig-provider:
platform: linux/x86_64
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main}
pull_policy: always
restart: always
container_name: 'sig-provider'
ports:
- 8051:8050

@ -140,6 +140,9 @@ ENABLE_RUST_VERIFICATION_SERVICE=true
RUST_VERIFICATION_SERVICE_URL=http://host.docker.internal:8043/
VISUALIZE_SOL2UML_ENABLED=true
VISUALIZE_SOL2UML_SERVICE_URL=http://host.docker.internal:8050/
SIG_PROVIDER_ENABLED=true
SIG_PROVIDER_SERVICE_URL=http://sig-provider:8050/
DECODE_NOT_A_CONTRACT_CALLS=true
# DATABASE_READ_ONLY_API_URL=
# ACCOUNT_DATABASE_URL=
# ACCOUNT_POOL_SIZE=

@ -571,7 +571,15 @@ endif
ifdef AMPLITUDE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AMPLITUDE_URL=$(AMPLITUDE_URL)'
endif
ifdef SIG_PROVIDER_ENABLED
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SIG_PROVIDER_ENABLED=$(SIG_PROVIDER_ENABLED)'
endif
ifdef SIG_PROVIDER_SERVICE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SIG_PROVIDER_SERVICE_URL=$(SIG_PROVIDER_SERVICE_URL)'
endif
ifdef DECODE_NOT_A_CONTRACT_CALLS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DECODE_NOT_A_CONTRACT_CALLS=$(DECODE_NOT_A_CONTRACT_CALLS)'
endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw "${BS_CONTAINER_IMAGE} ")
build:

Loading…
Cancel
Save