Merge branch 'master' into vb-upgrade-ecto-absinthe

pull/2954/head
Victor Baranov 5 years ago committed by GitHub
commit 4f896ac6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .circleci/config.yml
  2. 14
      CHANGELOG.md
  3. 7
      apps/block_scout_web/assets/js/socket.js
  4. 52
      apps/block_scout_web/assets/package-lock.json
  5. 4
      apps/block_scout_web/assets/package.json
  6. 6
      apps/block_scout_web/assets/webpack.config.js
  7. 1
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  8. 2
      apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex
  9. 17
      apps/block_scout_web/priv/gettext/default.pot
  10. 17
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  11. 2
      apps/explorer/config/config.exs
  12. 16
      apps/explorer/lib/explorer/smart_contract/verifier.ex
  13. 48
      apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex
  14. 204
      apps/explorer/package-lock.json
  15. 6
      apps/explorer/package.json
  16. 70
      apps/explorer/priv/repo/migrations/20191018140054_add_pending_internal_txs_operation.exs
  17. 66
      apps/explorer/priv/repo/migrations/scripts/20181108205650_additional_internal_transaction_constraints.sql
  18. 73
      apps/explorer/priv/repo/migrations/scripts/20191018140054_send_block_hash_block_index_dups_to_carnitine.sql
  19. 1
      apps/explorer/test/explorer/smart_contract/verifier_test.exs
  20. 6
      docker/Dockerfile
  21. 178
      docker/Makefile
  22. 8
      rel/commands/clear_build.sh

@ -345,7 +345,7 @@ jobs:
# PGUSER: postgres # PGUSER: postgres
# ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.HTTPWebSocket" # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.HTTPWebSocket"
# ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Geth" # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Geth"
# - image: circleci/postgres:10.3-alpine # - image: circleci/postgres:10.10-alpine
# environment: # environment:
# # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
# POSTGRES_DB: explorer_test # POSTGRES_DB: explorer_test
@ -399,7 +399,7 @@ jobs:
# PGUSER: postgres # PGUSER: postgres
# ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.Mox" # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Geth.Mox"
# ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
# - image: circleci/postgres:10.3-alpine # - image: circleci/postgres:10.10-alpine
# environment: # environment:
# # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
# POSTGRES_DB: explorer_test # POSTGRES_DB: explorer_test
@ -453,7 +453,7 @@ jobs:
# PGUSER: postgres # PGUSER: postgres
# ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.HTTPWebSocket" # ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.HTTPWebSocket"
# ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Parity" # ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Parity"
# - image: circleci/postgres:10.3-alpine # - image: circleci/postgres:10.10-alpine
# environment: # environment:
# # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database # # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
# POSTGRES_DB: explorer_test # POSTGRES_DB: explorer_test
@ -507,7 +507,7 @@ jobs:
PGUSER: postgres PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
- image: circleci/postgres:10.3-alpine - image: circleci/postgres:10.10-alpine
environment: environment:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test POSTGRES_DB: explorer_test

@ -1,11 +1,16 @@
## Current ## Current
### Features ### Features
- [#2835](https://github.com/poanetwork/blockscout/pull/2835), [#2871](https://github.com/poanetwork/blockscout/pull/2871), [#2872](https://github.com/poanetwork/blockscout/pull/2872), [#2886](https://github.com/poanetwork/blockscout/pull/2886), [#2925](https://github.com/poanetwork/blockscout/pull/2925), [#2936](https://github.com/poanetwork/blockscout/pull/2936), [#2949](https://github.com/poanetwork/blockscout/pull/2949) - Add "block_hash" to logs, token_transfers and internal transactions and "pending blocks operations" approach - [#2835](https://github.com/poanetwork/blockscout/pull/2835), [#2871](https://github.com/poanetwork/blockscout/pull/2871), [#2872](https://github.com/poanetwork/blockscout/pull/2872), [#2886](https://github.com/poanetwork/blockscout/pull/2886), [#2925](https://github.com/poanetwork/blockscout/pull/2925), [#2936](https://github.com/poanetwork/blockscout/pull/2936), [#2949](https://github.com/poanetwork/blockscout/pull/2949), [#2940](https://github.com/poanetwork/blockscout/pull/2940), [#2958](https://github.com/poanetwork/blockscout/pull/2958) - Add "block_hash" to logs, token_transfers and internal transactions and "pending blocks operations" approach
- [#2926](https://github.com/poanetwork/blockscout/pull/2926) - API endpoint: sum balances except burnt address - [#2926](https://github.com/poanetwork/blockscout/pull/2926) - API endpoint: sum balances except burnt address
- [#2918](https://github.com/poanetwork/blockscout/pull/2918) - Add tokenID for tokentx API action explicitly - [#2918](https://github.com/poanetwork/blockscout/pull/2918) - Add tokenID for tokentx API action explicitly
### Fixes ### Fixes
- [#2961](https://github.com/poanetwork/blockscout/pull/2961) - Add a guard that addresses is enum in `values` function in `read contract` page
- [#2960](https://github.com/poanetwork/blockscout/pull/2960) - Add BLOCKSCOUT_HOST to docker setup
- [#2956](https://github.com/poanetwork/blockscout/pull/2956) - Add support of 0.6.x version of compiler
- [#2955](https://github.com/poanetwork/blockscout/pull/2955) - Move socket path to env
- [#2938](https://github.com/poanetwork/blockscout/pull/2938) - utf8 copy tx input tooltip
- [#2934](https://github.com/poanetwork/blockscout/pull/2934) - RSK release 1.2.0 breaking changes support - [#2934](https://github.com/poanetwork/blockscout/pull/2934) - RSK release 1.2.0 breaking changes support
- [#2933](https://github.com/poanetwork/blockscout/pull/2933) - Get rid of deadlock in the query to address_current_token_balance table - [#2933](https://github.com/poanetwork/blockscout/pull/2933) - Get rid of deadlock in the query to address_current_token_balance table
- [#2932](https://github.com/poanetwork/blockscout/pull/2932) - fix duplicate websocket connection - [#2932](https://github.com/poanetwork/blockscout/pull/2932) - fix duplicate websocket connection
@ -13,6 +18,7 @@
- [#2924](https://github.com/poanetwork/blockscout/pull/2924) - Speedup address to logs query - [#2924](https://github.com/poanetwork/blockscout/pull/2924) - Speedup address to logs query
- [#2915](https://github.com/poanetwork/blockscout/pull/2915) - Speedup of blocks_without_reward_query - [#2915](https://github.com/poanetwork/blockscout/pull/2915) - Speedup of blocks_without_reward_query
- [#2914](https://github.com/poanetwork/blockscout/pull/2914) - Reduce execution time of stream_unfetched_token_instances query - [#2914](https://github.com/poanetwork/blockscout/pull/2914) - Reduce execution time of stream_unfetched_token_instances query
- [2910](https://github.com/poanetwork/blockscout/pull/2910) - Reorganize queries and indexes for internal_transactions table
- [#2908](https://github.com/poanetwork/blockscout/pull/2908) - Fix performance of address page - [#2908](https://github.com/poanetwork/blockscout/pull/2908) - Fix performance of address page
- [#2906](https://github.com/poanetwork/blockscout/pull/2906) - fix address sum cache - [#2906](https://github.com/poanetwork/blockscout/pull/2906) - fix address sum cache
- [#2902](https://github.com/poanetwork/blockscout/pull/2902) - Offset in blocks retrieval for average block time - [#2902](https://github.com/poanetwork/blockscout/pull/2902) - Offset in blocks retrieval for average block time
@ -20,10 +26,12 @@
- [#2899](https://github.com/poanetwork/blockscout/pull/2899) - fix empty buffered task - [#2899](https://github.com/poanetwork/blockscout/pull/2899) - fix empty buffered task
- [#2887](https://github.com/poanetwork/blockscout/pull/2887) - increase chart loading speed - [#2887](https://github.com/poanetwork/blockscout/pull/2887) - increase chart loading speed
- [2910](https://github.com/poanetwork/blockscout/pull/2910) - Reorganize queries and indexes for internal_transactions table
### Chore ### Chore
- [#2959](https://github.com/poanetwork/blockscout/pull/2959) - Remove logs from test folder too in the cleaning script
- [#2954](https://github.com/poanetwork/blockscout/pull/2954) - Upgrade absinthe and ecto deps - [#2954](https://github.com/poanetwork/blockscout/pull/2954) - Upgrade absinthe and ecto deps
- [#2947](https://github.com/poanetwork/blockscout/pull/2947) - Upgrade Circle CI postgres Docker image
- [#2946](https://github.com/poanetwork/blockscout/pull/2946) - Fix vulnerable NPM deps
- [#2942](https://github.com/poanetwork/blockscout/pull/2942) - Actualize Docker setup
- [#2896](https://github.com/poanetwork/blockscout/pull/2896) - Disable Parity websockets tests - [#2896](https://github.com/poanetwork/blockscout/pull/2896) - Disable Parity websockets tests

@ -1,7 +1,12 @@
import { Socket } from 'phoenix' import { Socket } from 'phoenix'
import { locale } from './locale' import { locale } from './locale'
const socket = new Socket('/socket', { params: { locale: locale } }) let websocketRootUrl = process.env.SOCKET_ROOT
if (!websocketRootUrl || websocketRootUrl === '/') {
websocketRootUrl = ''
}
const socket = new Socket(websocketRootUrl + '/socket', { params: { locale: locale } })
socket.connect() socket.connect()
export default socket export default socket

@ -5883,9 +5883,9 @@
"dev": true "dev": true
}, },
"handlebars": { "handlebars": {
"version": "4.5.1", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.6.0.tgz",
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==", "integrity": "sha512-i1ZUP7Qp2JdkMaFon2a+b0m5geE8Z4ZTLaGkgrObkEd+OkUKyRbRWw4KxuFCoHfdETSY1yf9/574eVoNSiK7pw==",
"dev": true, "dev": true,
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
@ -11466,9 +11466,9 @@
"dev": true "dev": true
}, },
"serialize-javascript": { "serialize-javascript": {
"version": "2.1.0", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.0.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ==", "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true "dev": true
}, },
"set-blocking": { "set-blocking": {
@ -12672,9 +12672,9 @@
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {
"version": "3.6.9", "version": "3.7.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.9.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.4.tgz",
"integrity": "sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw==", "integrity": "sha512-tinYWE8X1QfCHxS1lBS8yiDekyhSXOO6R66yNOCdUJeojxxw+PX2BHAz/BWyW7PQ7pkiWVxJfIEbiDxyLWvUGg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
@ -13312,12 +13312,6 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true "dev": true
}, },
"serialize-javascript": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
"integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==",
"dev": true
},
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -13325,20 +13319,31 @@
"dev": true "dev": true
}, },
"terser-webpack-plugin": { "terser-webpack-plugin": {
"version": "1.4.1", "version": "1.4.3",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==", "integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
"dev": true, "dev": true,
"requires": { "requires": {
"cacache": "^12.0.2", "cacache": "^12.0.2",
"find-cache-dir": "^2.1.0", "find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0", "is-wsl": "^1.1.0",
"schema-utils": "^1.0.0", "schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0", "serialize-javascript": "^2.1.2",
"source-map": "^0.6.1", "source-map": "^0.6.1",
"terser": "^4.1.2", "terser": "^4.1.2",
"webpack-sources": "^1.4.0", "webpack-sources": "^1.4.0",
"worker-farm": "^1.7.0" "worker-farm": "^1.7.0"
},
"dependencies": {
"worker-farm": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
"integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
"dev": true,
"requires": {
"errno": "~0.1.7"
}
}
} }
} }
} }
@ -13586,15 +13591,6 @@
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
"dev": true "dev": true
}, },
"worker-farm": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
"integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
"dev": true,
"requires": {
"errno": "~0.1.7"
}
},
"wrap-ansi": { "wrap-ansi": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",

@ -8,8 +8,8 @@
"author": "POA Network", "author": "POA Network",
"license": "GPL-3.0", "license": "GPL-3.0",
"engines": { "engines": {
"node": "9.x", "node": "12.x",
"npm": "5.x" "npm": "6.x"
}, },
"scripts": { "scripts": {
"deploy": "webpack --mode production", "deploy": "webpack --mode production",

@ -5,6 +5,7 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const { ContextReplacementPlugin } = require('webpack') const { ContextReplacementPlugin } = require('webpack')
const glob = require('glob') const glob = require('glob')
const webpack = require('webpack')
function transpileViewScript(file) { function transpileViewScript(file) {
return { return {
@ -136,7 +137,10 @@ const appJs =
filename: '../css/[name].css' filename: '../css/[name].css'
}), }),
new CopyWebpackPlugin([{ from: 'static/', to: '../' }]), new CopyWebpackPlugin([{ from: 'static/', to: '../' }]),
new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/) new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.DefinePlugin({
'process.env.SOCKET_ROOT': JSON.stringify(process.env.SOCKET_ROOT)
})
] ]
} }

@ -144,6 +144,7 @@
data-clipboard-text="<%= @transaction.input %>" data-clipboard-text="<%= @transaction.input %>"
data-placement="top" data-placement="top"
data-toggle="tooltip" data-toggle="tooltip"
title='<%= gettext("Copy Txn Input") %>'
style="display: none;" style="display: none;"
> >
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.5 32.5" width="32" height="32"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.5 32.5" width="32" height="32">

@ -10,7 +10,7 @@ defmodule BlockScoutWeb.SmartContractView do
def named_argument?(%{"name" => _}), do: true def named_argument?(%{"name" => _}), do: true
def named_argument?(_), do: false def named_argument?(_), do: false
def values(addresses, type) when type == "address[]" do def values(addresses, type) when is_list(addresses) and type == "address[]" do
addresses addresses
|> Enum.map(&values(&1, "address")) |> Enum.map(&values(&1, "address"))
|> Enum.join(", ") |> Enum.join(", ")

@ -13,7 +13,7 @@ msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:193 #: lib/block_scout_web/templates/transaction/overview.html.eex:194
msgid " Token Transfer" msgid " Token Transfer"
msgstr "" msgstr ""
@ -646,8 +646,8 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:32 #: lib/block_scout_web/templates/layout/app.html.eex:32
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #: lib/block_scout_web/templates/transaction/overview.html.eex:181
#: lib/block_scout_web/templates/transaction/overview.html.eex:215 #: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/views/wei_helpers.ex:78 #: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether" msgid "Ether"
msgstr "" msgstr ""
@ -999,7 +999,7 @@ msgid "License ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:243 #: lib/block_scout_web/templates/transaction/overview.html.eex:244
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -1538,7 +1538,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:237 #: lib/block_scout_web/templates/transaction/overview.html.eex:238
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1568,8 +1568,8 @@ msgid "Validator Info"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #: lib/block_scout_web/templates/transaction/overview.html.eex:181
#: lib/block_scout_web/templates/transaction/overview.html.eex:215 #: lib/block_scout_web/templates/transaction/overview.html.eex:216
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1745,7 +1745,7 @@ msgid "Decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:233 #: lib/block_scout_web/templates/transaction/overview.html.eex:234
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -1793,6 +1793,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:134 #: lib/block_scout_web/templates/transaction/overview.html.eex:134
#: lib/block_scout_web/templates/transaction/overview.html.eex:147
msgid "Copy Txn Input" msgid "Copy Txn Input"
msgstr "" msgstr ""

@ -13,7 +13,7 @@ msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:193 #: lib/block_scout_web/templates/transaction/overview.html.eex:194
msgid " Token Transfer" msgid " Token Transfer"
msgstr "" msgstr ""
@ -646,8 +646,8 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:32 #: lib/block_scout_web/templates/layout/app.html.eex:32
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #: lib/block_scout_web/templates/transaction/overview.html.eex:181
#: lib/block_scout_web/templates/transaction/overview.html.eex:215 #: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/views/wei_helpers.ex:78 #: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether" msgid "Ether"
msgstr "" msgstr ""
@ -999,7 +999,7 @@ msgid "License ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:243 #: lib/block_scout_web/templates/transaction/overview.html.eex:244
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -1538,7 +1538,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:237 #: lib/block_scout_web/templates/transaction/overview.html.eex:238
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1568,8 +1568,8 @@ msgid "Validator Info"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:180 #: lib/block_scout_web/templates/transaction/overview.html.eex:181
#: lib/block_scout_web/templates/transaction/overview.html.eex:215 #: lib/block_scout_web/templates/transaction/overview.html.eex:216
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1745,7 +1745,7 @@ msgid "Decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:233 #: lib/block_scout_web/templates/transaction/overview.html.eex:234
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -1793,6 +1793,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:134 #: lib/block_scout_web/templates/transaction/overview.html.eex:134
#: lib/block_scout_web/templates/transaction/overview.html.eex:147
msgid "Copy Txn Input" msgid "Copy Txn Input"
msgstr "" msgstr ""

@ -12,7 +12,7 @@ config :explorer,
token_functions_reader_max_retries: 3, token_functions_reader_max_retries: 3,
allowed_evm_versions: allowed_evm_versions:
System.get_env("ALLOWED_EVM_VERSIONS") || System.get_env("ALLOWED_EVM_VERSIONS") ||
"homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,default", "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,default",
include_uncles_in_average_block_time: include_uncles_in_average_block_time:
if(System.get_env("UNCLES_IN_AVERAGE_BLOCK_TIME") == "true", do: true, else: false), if(System.get_env("UNCLES_IN_AVERAGE_BLOCK_TIME") == "true", do: true, else: false),
healthy_blocks_period: System.get_env("HEALTHY_BLOCKS_PERIOD") || :timer.minutes(5), healthy_blocks_period: System.get_env("HEALTHY_BLOCKS_PERIOD") || :timer.minutes(5),

@ -151,6 +151,22 @@ defmodule Explorer.SmartContract.Verifier do
|> Enum.reverse() |> Enum.reverse()
|> :binary.list_to_bin() |> :binary.list_to_bin()
# Solidity >= 0.6.0 https://github.com/ethereum/solidity/blob/develop/Changelog.md#060-2019-12-17
# https://github.com/ethereum/solidity/blob/26b700771e9cc9c956f0503a05de69a1be427963/docs/metadata.rst#encoding-of-the-metadata-hash-in-the-bytecode
# IPFS is used instead of Swarm
# The current version of the Solidity compiler usually adds the following to the end of the deployed bytecode:
# 0xa2
# 0x64 'i' 'p' 'f' 's' 0x58 0x22 <34 bytes IPFS hash>
# 0x64 's' 'o' 'l' 'c' 0x43 <3 byte version encoding>
# 0x00 0x32
# Note: there is a bug in the docs. Instead of 0x32, 0x33 should be used.
# Fixing PR has been created https://github.com/ethereum/solidity/pull/8174
"a264697066735822" <>
<<_::binary-size(68)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0033" <> _constructor_arguments ->
extracted
|> Enum.reverse()
|> :binary.list_to_bin()
<<next::binary-size(2)>> <> rest -> <<next::binary-size(2)>> <> rest ->
do_extract_bytecode([next | extracted], rest) do_extract_bytecode([next | extracted], rest)
end end

@ -35,36 +35,32 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do
case code do case code do
# Solidity ~ 4.23 # https://solidity.readthedocs.io/en/v0.4.23/metadata.html # Solidity ~ 4.23 # https://solidity.readthedocs.io/en/v0.4.23/metadata.html
"a165627a7a72305820" <> <<_::binary-size(64)>> <> "0029" <> constructor_arguments -> "a165627a7a72305820" <> <<_::binary-size(64)>> <> "0029" <> constructor_arguments ->
check_func_result = check_func.(constructor_arguments) extract_constructor_arguments_check_func(constructor_arguments, check_func)
if check_func_result do
check_func_result
else
extract_constructor_arguments(constructor_arguments, check_func)
end
# Solidity >= 0.5.10 https://solidity.readthedocs.io/en/v0.5.10/metadata.html # Solidity >= 0.5.10 https://solidity.readthedocs.io/en/v0.5.10/metadata.html
"a265627a7a72305820" <> "a265627a7a72305820" <>
<<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments -> <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments ->
check_func_result = check_func.(constructor_arguments) extract_constructor_arguments_check_func(constructor_arguments, check_func)
if check_func_result do
check_func_result
else
extract_constructor_arguments(constructor_arguments, check_func)
end
# Solidity >= 0.5.11 https://github.com/ethereum/solidity/blob/develop/Changelog.md#0511-2019-08-12 # 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:// # Metadata: Update the swarm hash to the current specification, changes bzzr0 to bzzr1 and urls to use bzz-raw://
"a265627a7a72315820" <> "a265627a7a72315820" <>
<<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments -> <<_::binary-size(64)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0032" <> constructor_arguments ->
check_func_result = check_func.(constructor_arguments) extract_constructor_arguments_check_func(constructor_arguments, check_func)
if check_func_result do # Solidity >= 0.6.0 https://github.com/ethereum/solidity/blob/develop/Changelog.md#060-2019-12-17
check_func_result # https://github.com/ethereum/solidity/blob/26b700771e9cc9c956f0503a05de69a1be427963/docs/metadata.rst#encoding-of-the-metadata-hash-in-the-bytecode
else # IPFS is used instead of Swarm
extract_constructor_arguments(constructor_arguments, check_func) # The current version of the Solidity compiler usually adds the following to the end of the deployed bytecode:
end # 0xa2
# 0x64 'i' 'p' 'f' 's' 0x58 0x22 <34 bytes IPFS hash>
# 0x64 's' 'o' 'l' 'c' 0x43 <3 byte version encoding>
# 0x00 0x32
# Note: there is a bug in the docs. Instead of 0x32, 0x33 should be used.
# Fixing PR has been created https://github.com/ethereum/solidity/pull/8174
"a264697066735822" <>
<<_::binary-size(68)>> <> "64736f6c6343" <> <<_::binary-size(6)>> <> "0033" <> constructor_arguments ->
extract_constructor_arguments_check_func(constructor_arguments, check_func)
<<>> -> <<>> ->
check_func.("") check_func.("")
@ -74,6 +70,16 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do
end end
end end
defp extract_constructor_arguments_check_func(constructor_arguments, check_func) do
check_func_result = check_func.(constructor_arguments)
if check_func_result do
check_func_result
else
extract_constructor_arguments(constructor_arguments, check_func)
end
end
def find_constructor_arguments(address_hash, abi) do def find_constructor_arguments(address_hash, abi) do
creation_code = creation_code =
address_hash address_hash

@ -3,19 +3,6 @@
"requires": true, "requires": true,
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"requires": {
"color-convert": "^1.9.0"
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -38,67 +25,26 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
"requires": {
"string-width": "^3.1.0",
"strip-ansi": "^5.2.0",
"wrap-ansi": "^5.1.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"command-exists": { "command-exists": {
"version": "1.2.8", "version": "1.2.8",
"resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.8.tgz", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.8.tgz",
"integrity": "sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==" "integrity": "sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw=="
}, },
"commander": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz",
"integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow=="
},
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
}, },
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
},
"file-uri-to-path": { "file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
}, },
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"requires": {
"locate-path": "^3.0.0"
}
},
"fs-extra": { "fs-extra": {
"version": "0.30.0", "version": "0.30.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
@ -116,15 +62,10 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
}, },
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
},
"glob": { "glob": {
"version": "7.1.5", "version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
"inflight": "^1.0.4", "inflight": "^1.0.4",
@ -153,11 +94,6 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
}, },
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
},
"js-sha3": { "js-sha3": {
"version": "0.8.0", "version": "0.8.0",
"resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz",
@ -190,15 +126,6 @@
"graceful-fs": "^4.1.9" "graceful-fs": "^4.1.9"
} }
}, },
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"memorystream": { "memorystream": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
@ -230,52 +157,16 @@
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
}, },
"p-limit": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
"integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
},
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
}, },
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
},
"require-from-string": { "require-from-string": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="
}, },
"require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
},
"rimraf": { "rimraf": {
"version": "2.7.1", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@ -294,42 +185,19 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
}, },
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"solc": { "solc": {
"version": "0.5.12", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/solc/-/solc-0.5.12.tgz", "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.1.tgz",
"integrity": "sha512-OX/AGZT04tuUsagoVXSZBiBZYJReA02hdwZOfRkB03/eeYP9Dl3pr+M+au+1MhssgiuWBlFPN7sRXFiqwkAW2g==", "integrity": "sha512-iKqNYps2p++x8L9sBg7JeAJb7EmW8VJ/2asAzwlLYcUhj86AzuWLe94UTSQHv1SSCCj/x6lya8twvXkZtlTbIQ==",
"requires": { "requires": {
"command-exists": "^1.2.8", "command-exists": "^1.2.8",
"commander": "3.0.2",
"fs-extra": "^0.30.0", "fs-extra": "^0.30.0",
"js-sha3": "0.8.0", "js-sha3": "0.8.0",
"memorystream": "^0.3.1", "memorystream": "^0.3.1",
"require-from-string": "^2.0.0", "require-from-string": "^2.0.0",
"semver": "^5.5.0", "semver": "^5.5.0",
"tmp": "0.0.33", "tmp": "0.0.33"
"yargs": "^13.2.0"
}
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"requires": {
"ansi-regex": "^4.1.0"
} }
}, },
"tmp": { "tmp": {
@ -340,56 +208,10 @@
"os-tmpdir": "~1.0.2" "os-tmpdir": "~1.0.2"
} }
}, },
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
},
"wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
"requires": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
}
},
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
},
"yargs": {
"version": "13.3.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
"integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
"requires": {
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.1"
}
},
"yargs-parser": {
"version": "13.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
} }
} }
} }

@ -8,12 +8,12 @@
"author": "POA Network", "author": "POA Network",
"license": "GPL-3.0", "license": "GPL-3.0",
"engines": { "engines": {
"node": "9.x", "node": "12.x",
"npm": "5.x" "npm": "6.x"
}, },
"scripts": {}, "scripts": {},
"dependencies": { "dependencies": {
"keccak": "^2.0.0", "keccak": "^2.0.0",
"solc": "^0.5.12" "solc": "^0.6.1"
} }
} }

@ -55,76 +55,6 @@ defmodule Explorer.Repo.Migrations.AddPendingInternalTxsOperation do
DELETE FROM internal_transactions WHERE block_hash IS NULL; DELETE FROM internal_transactions WHERE block_hash IS NULL;
""") """)
execute("""
DO $$
DECLARE
duplicates_count INTEGER := 0;
blocks_scanned INTEGER := 0;
int_txs_count INTEGER := 0;
temprow RECORD;
BEGIN
SELECT COUNT(*) INTO int_txs_count FROM internal_transactions;
IF int_txs_count < 10000000 THEN
FOR temprow IN
SELECT block_hash FROM internal_transactions
GROUP BY block_hash, block_index HAVING COUNT(*) > 1
LOOP
duplicates_count := duplicates_count + 1;
RAISE NOTICE '% duplicates, blocks scanned %, block #%, block hash is %', duplicates_count, blocks_scanned, temprow.number , temprow.hash;
IF NOT EXISTS (
SELECT 1 FROM pending_block_operations
WHERE block_hash = temprow.block_hash
) THEN
INSERT INTO pending_block_operations
(block_hash, inserted_at, updated_at, fetch_internal_transactions)
SELECT b.hash, now(), now(), TRUE FROM blocks b
WHERE b.hash = temprow.block_hash;
END IF;
DELETE FROM internal_transactions
WHERE block_hash = temprow.block_hash;
RAISE NOTICE 'DELETED';
END LOOP;
ELSE
FOR temprow IN SELECT number, hash FROM blocks LOOP
blocks_scanned := blocks_scanned + 1;
IF EXISTS (
SELECT 1 FROM transactions WHERE block_hash = temprow.hash
) THEN
IF EXISTS (
SELECT block_hash, block_index FROM internal_transactions
WHERE block_hash = temprow.hash
GROUP BY block_hash, block_index HAVING COUNT(*) > 1
) THEN
duplicates_count := duplicates_count + 1;
RAISE NOTICE '% duplicates, blocks scanned %, block #%, block hash is %', duplicates_count, blocks_scanned, temprow.number , temprow.hash;
IF NOT EXISTS (
SELECT 1 FROM pending_block_operations
WHERE block_hash = temprow.hash
) THEN
INSERT INTO pending_block_operations
(block_hash, inserted_at, updated_at, fetch_internal_transactions)
SELECT b.hash, now(), now(), TRUE FROM blocks b
WHERE b.hash = temprow.hash;
END IF;
DELETE FROM internal_transactions
WHERE block_hash = temprow.hash;
RAISE NOTICE 'DELETED';
END IF;
END IF;
END LOOP;
END IF;
RAISE NOTICE 'SCRIPT FINISHED';
END $$;
""")
execute(""" execute("""
ALTER table internal_transactions ALTER table internal_transactions
DROP CONSTRAINT internal_transactions_pkey, DROP CONSTRAINT internal_transactions_pkey,

@ -1,69 +1,77 @@
-- UPDATE (2020-08-01): use pending_block_operations table
DO $$ DO $$
DECLARE DECLARE
row_count integer := 1; row_count integer := 1;
batch_size integer := 50000; -- HOW MANY ITEMS WILL BE UPDATED AT TIME batch_size integer := 500; -- HOW MANY ITEMS WILL BE UPDATED AT TIME
iterator integer := batch_size; iterator integer := batch_size;
max_row_number integer; max_row_number integer;
next_iterator integer; next_iterator integer;
updated_transaction_count integer; updated_blocks_count integer;
deleted_internal_transaction_count integer; deleted_internal_transaction_count integer;
deleted_row_count integer; deleted_row_count integer;
BEGIN BEGIN
DROP TABLE IF EXISTS transactions_with_deprecated_internal_transactions; DROP TABLE IF EXISTS blocks_with_deprecated_internal_transactions;
-- CREATES TEMP TABLE TO STORE DATA TO BE UPDATED -- CREATES TEMP TABLE TO STORE DATA TO BE UPDATED
CREATE TEMP TABLE transactions_with_deprecated_internal_transactions( CREATE TEMP TABLE blocks_with_deprecated_internal_transactions(
hash bytea NOT NULL, block_number integer NOT NULL,
row_number integer row_number integer
); );
INSERT INTO transactions_with_deprecated_internal_transactions INSERT INTO blocks_with_deprecated_internal_transactions
SELECT DISTINCT ON (transaction_hash) SELECT DISTINCT ON (a.block_number)
transaction_hash, a.block_number,
ROW_NUMBER () OVER () ROW_NUMBER () OVER ()
FROM internal_transactions FROM (
SELECT DISTINCT i.block_number, i.transaction_index
FROM internal_transactions i
WHERE WHERE
i.block_number IS NOT NULL
AND
-- call_has_call_type CONSTRAINT -- call_has_call_type CONSTRAINT
(type = 'call' AND call_type IS NULL) OR ((i.type = 'call' AND i.call_type IS NULL) OR
-- call_has_input CONSTRAINT -- call_has_input CONSTRAINT
(type = 'call' AND input IS NULL) OR (i.type = 'call' AND i.input IS NULL) OR
-- create_has_init CONSTRAINT -- create_has_init CONSTRAINT
(type = 'create' AND init is NULL) (i.type = 'create' AND i.init is NULL))
ORDER BY transaction_hash DESC; ORDER BY i.block_number DESC, i.transaction_index
) a;
max_row_number := (SELECT MAX(row_number) FROM transactions_with_deprecated_internal_transactions); max_row_number := (SELECT MAX(row_number) FROM blocks_with_deprecated_internal_transactions);
RAISE NOTICE '% transactions to be updated', max_row_number + 1; RAISE NOTICE '% blocks to be updated', max_row_number + 1;
-- ITERATES THROUGH THE ITEMS UNTIL THE TEMP TABLE IS EMPTY -- ITERATES THROUGH THE ITEMS UNTIL THE TEMP TABLE IS EMPTY
WHILE iterator <= max_row_number LOOP WHILE iterator <= max_row_number LOOP
next_iterator := iterator + batch_size; next_iterator := iterator + batch_size;
RAISE NOTICE '-> transactions with deprecated internal transactions % to % to be updated', iterator, next_iterator - 1; RAISE NOTICE '-> blocks with deprecated internal transactions % to % to be updated', iterator, next_iterator - 1;
UPDATE transactions INSERT INTO pending_block_operations (block_hash, inserted_at, updated_at, fetch_internal_transactions)
SET internal_transactions_indexed_at = NULL, SELECT b.hash, NOW(), NOW(), true
error = NULL FROM blocks_with_deprecated_internal_transactions bd, blocks b
FROM transactions_with_deprecated_internal_transactions WHERE bd.block_number = b.number
WHERE transactions.hash = transactions_with_deprecated_internal_transactions.hash AND AND bd.row_number < next_iterator
transactions_with_deprecated_internal_transactions.row_number < next_iterator; AND b.consensus = true
ON CONFLICT (block_hash)
DO NOTHING;
GET DIAGNOSTICS updated_transaction_count = ROW_COUNT; GET DIAGNOSTICS updated_blocks_count = ROW_COUNT;
RAISE NOTICE '-> % transactions updated to refetch internal transactions', updated_transaction_count; RAISE NOTICE '-> % blocks updated to refetch internal transactions', updated_blocks_count;
DELETE FROM internal_transactions DELETE FROM internal_transactions
USING transactions_with_deprecated_internal_transactions USING blocks_with_deprecated_internal_transactions
WHERE internal_transactions.transaction_hash = transactions_with_deprecated_internal_transactions.hash AND WHERE internal_transactions.block_number = blocks_with_deprecated_internal_transactions.block_number AND
transactions_with_deprecated_internal_transactions.row_number < next_iterator; blocks_with_deprecated_internal_transactions.row_number < next_iterator;
GET DIAGNOSTICS deleted_internal_transaction_count = ROW_COUNT; GET DIAGNOSTICS deleted_internal_transaction_count = ROW_COUNT;
RAISE NOTICE '-> % internal transactions deleted', deleted_internal_transaction_count; RAISE NOTICE '-> % internal transactions deleted', deleted_internal_transaction_count;
DELETE FROM transactions_with_deprecated_internal_transactions DELETE FROM blocks_with_deprecated_internal_transactions
WHERE row_number < next_iterator; WHERE row_number < next_iterator;
GET DIAGNOSTICS deleted_row_count = ROW_COUNT; GET DIAGNOSTICS deleted_row_count = ROW_COUNT;
ASSERT updated_transaction_count = deleted_row_count; ASSERT updated_blocks_count = deleted_row_count;
-- COMMITS THE BATCH UPDATES -- COMMITS THE BATCH UPDATES
CHECKPOINT; CHECKPOINT;

@ -0,0 +1,73 @@
-- This script should be a part of migration to "pennding_block_operations" internal transactions indexing approach
-- if 20191018140054_add_pending_internal_txs_operation.exs migration failed due to occasional duplicates of
-- {block_hash, block_index} pair in the DB, that could exist due to bugs in previous versions of the application
--, before setting a primary key on those columns. If so, this script should be inserted at line 57 of that migration
-- just before changing of a primary key.
DO $$
DECLARE
duplicates_count INTEGER := 0;
blocks_scanned INTEGER := 0;
int_txs_count INTEGER := 0;
temprow RECORD;
BEGIN
SELECT COUNT(*) INTO int_txs_count FROM internal_transactions;
IF int_txs_count < 10000000 THEN
FOR temprow IN
SELECT block_hash FROM internal_transactions
GROUP BY block_hash, block_index HAVING COUNT(*) > 1
LOOP
duplicates_count := duplicates_count + 1;
RAISE NOTICE '% duplicates, blocks scanned %, block #%, block hash is %', duplicates_count, blocks_scanned, temprow.number , temprow.hash;
IF NOT EXISTS (
SELECT 1 FROM pending_block_operations
WHERE block_hash = temprow.block_hash
) THEN
INSERT INTO pending_block_operations
(block_hash, inserted_at, updated_at, fetch_internal_transactions)
SELECT b.hash, now(), now(), TRUE FROM blocks b
WHERE b.hash = temprow.block_hash;
END IF;
DELETE FROM internal_transactions
WHERE block_hash = temprow.block_hash;
RAISE NOTICE 'DELETED';
END LOOP;
ELSE
FOR temprow IN SELECT number, hash FROM blocks LOOP
blocks_scanned := blocks_scanned + 1;
IF EXISTS (
SELECT 1 FROM transactions WHERE block_hash = temprow.hash
) THEN
IF EXISTS (
SELECT block_hash, block_index FROM internal_transactions
WHERE block_hash = temprow.hash
GROUP BY block_hash, block_index HAVING COUNT(*) > 1
) THEN
duplicates_count := duplicates_count + 1;
RAISE NOTICE '% duplicates, blocks scanned %, block #%, block hash is %', duplicates_count, blocks_scanned, temprow.number , temprow.hash;
IF NOT EXISTS (
SELECT 1 FROM pending_block_operations
WHERE block_hash = temprow.hash
) THEN
INSERT INTO pending_block_operations
(block_hash, inserted_at, updated_at, fetch_internal_transactions)
SELECT b.hash, now(), now(), TRUE FROM blocks b
WHERE b.hash = temprow.hash;
END IF;
DELETE FROM internal_transactions
WHERE block_hash = temprow.hash;
RAISE NOTICE 'DELETED';
END IF;
END IF;
END LOOP;
END IF;
RAISE NOTICE 'SCRIPT FINISHED';
END $$;

@ -212,6 +212,7 @@ defmodule Explorer.SmartContract.VerifierTest do
params = %{ params = %{
"contract_source_code" => different_code, "contract_source_code" => different_code,
"compiler_version" => contract_code_info.version, "compiler_version" => contract_code_info.version,
"evm_version" => "istanbul",
"name" => contract_code_info.name, "name" => contract_code_info.name,
"optimization" => contract_code_info.optimized "optimization" => contract_code_info.optimized
} }

@ -1,4 +1,4 @@
FROM bitwalker/alpine-elixir-phoenix:1.9.0 FROM bitwalker/alpine-elixir-phoenix:1.9.1
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python
@ -15,7 +15,7 @@ ADD apps/explorer/mix.exs ./apps/explorer/
ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/ ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
ADD apps/indexer/mix.exs ./apps/indexer/ ADD apps/indexer/mix.exs ./apps/indexer/
RUN mix do deps.get, deps.compile RUN mix do deps.get, local.rebar --force, deps.compile
ADD . . ADD . .
@ -37,6 +37,8 @@ RUN cd apps/explorer/ && \
# RUN mix do ecto.drop --force, ecto.create, ecto.migrate # RUN mix do ecto.drop --force, ecto.create, ecto.migrate
RUN mix phx.digest
# USER default # USER default
# CMD ["mix", "phx.server"] # CMD ["mix", "phx.server"]

@ -3,7 +3,7 @@ HOST = host.docker.internal
DOCKER_IMAGE = blockscout_prod DOCKER_IMAGE = blockscout_prod
BS_CONTAINER_NAME = blockscout BS_CONTAINER_NAME = blockscout
PG_CONTAINER_NAME = postgres PG_CONTAINER_NAME = postgres
PG_CONTAINER_IMAGE = postgres:10.6 PG_CONTAINER_IMAGE = postgres:10.10
THIS_FILE = $(lastword $(MAKEFILE_LIST)) THIS_FILE = $(lastword $(MAKEFILE_LIST))
ifeq ($(SYSTEM), Linux) ifeq ($(SYSTEM), Linux)
@ -16,35 +16,185 @@ BLOCKSCOUT_CONTAINNER_PARAMS = -e 'MIX_ENV=prod' \
ifeq ($(SYSTEM), Linux) ifeq ($(SYSTEM), Linux)
BLOCKSCOUT_CONTAINNER_PARAMS += --network=host BLOCKSCOUT_CONTAINNER_PARAMS += --network=host
endif endif
ifdef NETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK=$(NETWORK)'
endif
ifdef SUBNETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)'
endif
ifdef NETWORK_ICON
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)'
endif
ifdef LOGO
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO=$(LOGO)'
endif
ifdef LOGO_FOOTER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO_FOOTER=$(LOGO_FOOTER)'
endif
ifdef ETHEREUM_JSONRPC_VARIANT ifdef ETHEREUM_JSONRPC_VARIANT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_VARIANT=$(ETHEREUM_JSONRPC_VARIANT)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_VARIANT=$(ETHEREUM_JSONRPC_VARIANT)'
endif endif
ifdef ETHEREUM_JSONRPC_HTTP_URL ifdef ETHEREUM_JSONRPC_HTTP_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_HTTP_URL=$(ETHEREUM_JSONRPC_HTTP_URL)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_HTTP_URL=$(ETHEREUM_JSONRPC_HTTP_URL)'
endif endif
ifdef ETHEREUM_JSONRPC_TRACE_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)'
endif
ifdef ETHEREUM_JSONRPC_WS_URL ifdef ETHEREUM_JSONRPC_WS_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_WS_URL=$(ETHEREUM_JSONRPC_WS_URL)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_WS_URL=$(ETHEREUM_JSONRPC_WS_URL)'
endif endif
ifdef ETHEREUM_JSONRPC_TRACE_URL ifdef ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT=$(ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT)'
endif
ifdef IPC_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'IPC_PATH=$(IPC_PATH)'
endif
ifdef NETWORK_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)'
endif
ifdef CHECK_ORIGIN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'CHECK_ORIGIN=$(CHECK_ORIGIN)'
endif endif
ifdef COIN ifdef COIN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COIN=$(COIN)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COIN=$(COIN)'
endif endif
ifdef LOGO ifdef METADATA_CONTRACT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO=$(LOGO)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'METADATA_CONTRACT=$(METADATA_CONTRACT)'
endif endif
ifdef NETWORK ifdef VALIDATORS_CONTRACT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK=$(NETWORK)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'VALIDATORS_CONTRACT=$(VALIDATORS_CONTRACT)'
endif endif
ifdef SUBNETWORK ifdef SUPPLY_MODULE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUPPLY_MODULE=$(SUPPLY_MODULE)'
endif endif
ifdef NETWORK_ICON ifdef SOURCE_MODULE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SOURCE_MODULE=$(SOURCE_MODULE)'
endif endif
ifdef NETWORK_PATH ifdef POOL_SIZE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)' BLOCKSCOUT_CONTAINNER_PARAMS += -e 'POOL_SIZE=$(POOL_SIZE)'
endif
ifdef ECTO_USE_SSL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ECTO_USE_SSL=$(ECTO_USE_SSL)'
endif
ifdef DATADOG_HOST
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DATADOG_HOST=$(DATADOG_HOST)'
endif
ifdef DATADOG_PORT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DATADOG_PORT=$(DATADOG_PORT)'
endif
ifdef SPANDEX_BATCH_SIZE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SPANDEX_BATCH_SIZE=$(SPANDEX_BATCH_SIZE)'
endif
ifdef SPANDEX_SYNC_THRESHOLD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SPANDEX_SYNC_THRESHOLD=$(SPANDEX_SYNC_THRESHOLD)'
endif
ifdef HEART_BEAT_TIMEOUT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'HEART_BEAT_TIMEOUT=$(HEART_BEAT_TIMEOUT)'
endif
ifdef HEART_COMMAND
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'HEART_COMMAND=$(HEART_COMMAND)'
endif
ifdef BLOCKSCOUT_VERSION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCKSCOUT_VERSION=$(BLOCKSCOUT_VERSION)'
endif
ifdef RELEASE_LINK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'RELEASE_LINK=$(RELEASE_LINK)'
endif
ifdef ELIXIR_VERSION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ELIXIR_VERSION=$(ELIXIR_VERSION)'
endif
ifdef BLOCK_TRANSFORMER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCK_TRANSFORMER=$(BLOCK_TRANSFORMER)'
endif
ifdef GRAPHIQL_TRANSACTION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'GRAPHIQL_TRANSACTION=$(GRAPHIQL_TRANSACTION)'
endif
ifdef FIRST_BLOCK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'FIRST_BLOCK=$(FIRST_BLOCK)'
endif
ifdef LAST_BLOCK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LAST_BLOCK=$(LAST_BLOCK)'
endif
ifdef TXS_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'TXS_COUNT_CACHE_PERIOD=$(TXS_COUNT_CACHE_PERIOD)'
endif
ifdef ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=$(ADDRESS_WITH_BALANCES_UPDATE_INTERVAL)'
endif
ifdef LINK_TO_OTHER_EXPLORERS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LINK_TO_OTHER_EXPLORERS=$(LINK_TO_OTHER_EXPLORERS)'
endif
ifdef COINMARKETCAP_PAGES
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COINMARKETCAP_PAGES=$(COINMARKETCAP_PAGES)'
endif
ifdef SUPPORTED_CHAINS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUPPORTED_CHAINS=$(SUPPORTED_CHAINS)'
endif
ifdef BLOCK_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCK_COUNT_CACHE_PERIOD=$(BLOCK_COUNT_CACHE_PERIOD)'
endif
ifdef ADDRESS_SUM_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_SUM_CACHE_PERIOD=$(ADDRESS_SUM_CACHE_PERIOD)'
endif
ifdef ADDRESS_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_COUNT_CACHE_PERIOD=$(ADDRESS_COUNT_CACHE_PERIOD)'
endif
ifdef ALLOWED_EVM_VERSIONS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ALLOWED_EVM_VERSIONS=$(ALLOWED_EVM_VERSIONS)'
endif
ifdef UNCLES_IN_AVERAGE_BLOCK_TIME
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'UNCLES_IN_AVERAGE_BLOCK_TIME=$(UNCLES_IN_AVERAGE_BLOCK_TIME)'
endif
ifdef AVERAGE_BLOCK_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'AVERAGE_BLOCK_CACHE_PERIOD=$(AVERAGE_BLOCK_CACHE_PERIOD)'
endif
ifdef MARKET_HISTORY_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'MARKET_HISTORY_CACHE_PERIOD=$(MARKET_HISTORY_CACHE_PERIOD)'
endif
ifdef DISABLE_WEBAPP
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_WEBAPP=$(DISABLE_WEBAPP)'
endif
ifdef DISABLE_READ_API
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_READ_API=$(DISABLE_READ_API)'
endif
ifdef DISABLE_WRITE_API
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_WRITE_API=$(DISABLE_WRITE_API)'
endif
ifdef DISABLE_INDEXER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)'
endif
ifdef WEBAPP_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)'
endif
ifdef API_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'API_URL=$(API_URL)'
endif
ifdef CHAIN_SPEC_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'CHAIN_SPEC_PATH=$(CHAIN_SPEC_PATH)'
endif
ifdef COIN_GECKO_ID
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COIN_GECKO_ID=$(COIN_GECKO_ID)'
endif
ifdef EMISSION_FORMAT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'EMISSION_FORMAT=$(EMISSION_FORMAT)'
endif
ifdef REWARDS_CONTRACT_ADDRESS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'REWARDS_CONTRACT_ADDRESS=$(REWARDS_CONTRACT_ADDRESS)'
endif
ifdef SHOW_ADDRESS_MARKETCAP_PERCENTAGE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SHOW_ADDRESS_MARKETCAP_PERCENTAGE=$(SHOW_ADDRESS_MARKETCAP_PERCENTAGE)'
endif
ifdef BLOCKSCOUT_PROTOCOL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCKSCOUT_PROTOCOL=$(BLOCKSCOUT_PROTOCOL)'
endif
ifdef BLOCKSCOUT_HOST
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCKSCOUT_HOST=$(BLOCKSCOUT_HOST)'
endif
ifdef DECOMPILED_SMART_CONTRACT_TOKEN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)'
endif
ifdef SOCKET_ROOT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SOCKET_ROOT=$(SOCKET_ROOT)'
endif endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep ${DOCKER_IMAGE}) HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep ${DOCKER_IMAGE})
@ -61,7 +211,7 @@ migrate: build postgres
@echo "==> Running migrations" @echo "==> Running migrations"
@docker run --rm \ @docker run --rm \
$(BLOCKSCOUT_CONTAINNER_PARAMS) \ $(BLOCKSCOUT_CONTAINNER_PARAMS) \
$(DOCKER_IMAGE) /bin/sh -c "echo $$MIX_ENV && mix do ecto.drop --force, ecto.create, ecto.migrate" $(DOCKER_IMAGE) /bin/sh -c "echo $$MIX_ENV && mix do ecto.create, ecto.migrate"
PG_EXIST := $(shell docker ps -a --filter name=${PG_CONTAINER_NAME} | grep ${PG_CONTAINER_NAME}) PG_EXIST := $(shell docker ps -a --filter name=${PG_CONTAINER_NAME} | grep ${PG_CONTAINER_NAME})

@ -4,8 +4,12 @@ rm -rf ./_build
rm -rf ./deps rm -rf ./deps
logs=$(find . -not -path '*/\.*' -name "logs" -type d) logs=$(find . -not -path '*/\.*' -name "logs" -type d)
dev=$(find ${logs} -name "dev") dev=$(find ${logs} -name "dev")
files_and_dirs_in_logs=$(ls -d ${dev}/*) files_and_dirs_in_logs_dev=$(ls -d ${dev}/*)
rm -rf $files_and_dirs_in_logs rm -rf $files_and_dirs_in_logs_dev
test=$(find ${logs} -name "test")
files_and_dirs_in_logs_test=$(ls -d ${test}/*)
rm -rf $files_and_dirs_in_logs_test
find . -name "node_modules" -type d -exec rm -rf '{}' + find . -name "node_modules" -type d -exec rm -rf '{}' +

Loading…
Cancel
Save