Merge branch 'master' into fix-docker

pull/1531/head
Victor Baranov 6 years ago committed by GitHub
commit fb58d40d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 13
      apps/block_scout_web/assets/css/components/_navbar.scss
  3. 5
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  4. 11
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  5. 18
      apps/block_scout_web/priv/gettext/default.pot
  6. 18
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  7. 2
      apps/explorer/lib/explorer/smart_contract/verifier.ex
  8. 10
      apps/explorer/lib/explorer/smart_contract/verifier/constructor_arguments.ex
  9. 21
      apps/explorer/test/explorer/smart_contract/verifier/constructor_arguments_test.exs

@ -19,6 +19,8 @@
- [#1769](https://github.com/poanetwork/blockscout/pull/1769) - add timestamp to block overview
- [#1768](https://github.com/poanetwork/blockscout/pull/1768) - fix first block parameter
- [#1778](https://github.com/poanetwork/blockscout/pull/1778) - Make websocket optional for realtime fetcher
- [#1790](https://github.com/poanetwork/blockscout/pull/1790) - fix constructor arguments verification
- [#1793](https://github.com/poanetwork/blockscout/pull/1793) - fix top nav autocomplete
- [#1795](https://github.com/poanetwork/blockscout/pull/1795) - fix line numbers for decompiled contracts
### Chore

@ -20,6 +20,7 @@
form {
flex-grow: 1;
}
}
.input-group {
@ -79,9 +80,8 @@
background: transparent;
width: auto;
font-size: 12px;
border-right: none;
border: none;
color: $white;
border-color: transparentize($white, 0.30);
padding-right: 0px;
@ -109,12 +109,11 @@
.navbar .input-group-text {
background: none;
border-left: none;
border-color: transparentize($white, 0.30);
border: none;
}
.input-group-append {
margin-left: 0px;
margin-left: -0.5px;
path {
fill: $secondary;
@ -160,3 +159,7 @@
color: $white;
}
}
.add-border {
border: 1px solid transparentize($white, 0.30);
}

@ -78,7 +78,7 @@
</li>
</ul>
<div class="search-form d-lg-flex d-inline-block">
<%= form_for @conn, chain_path(@conn, :search), [class: "form-inline my-2 my-lg-0", method: :get, enforce_utf8: false], fn f -> %>
<%= form_for @conn, chain_path(@conn, :search), [class: "form-inline my-2 my-lg-0 add-border", method: :get, enforce_utf8: false], fn f -> %>
<div class="input-group">
<%= awesomplete(f, :q,
@ -93,8 +93,9 @@
prepop: true,
minChars: 3,
maxItems: 8,
value: "symbol",
value: "contract_address_hash",
label: "contract_address_hash",
descrSearch: true,
descr: "symbol"
]) %>
<div class="input-group-append">

@ -19,17 +19,6 @@
<link rel="stylesheet" href="https://nico-amsterdam.github.io/awesomplete-util/css/awesomplete.css">
<script src="https://nico-amsterdam.github.io/awesomplete-util/js/awesomplete.min.js"></script>
<script src="https://nico-amsterdam.github.io/awesomplete-util/js/awesomplete-util.min.js"></script>
<style>
div.awesomplete {display: block}
div.awesomplete ul li p {display: block; font-size: small; margin-left: 1em}
div.awesomplete .awe-found {border: 2px solid green}
.hide-not-found div.awesomplete .awe-not-found {border-color: lightblue}
div.awesomplete .awe-not-found {border: 2px solid red}
</style>
<%= render_existing(@view_module, "_metatags.html", assigns) || render("_default_title.html") %>
</head>

@ -62,7 +62,7 @@ msgid "(query)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:46
#: lib/block_scout_web/templates/layout/app.html.eex:35
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
@ -155,7 +155,7 @@ msgid "Block Height: %{height}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:61
#: lib/block_scout_web/templates/layout/app.html.eex:50
msgid "Block Mined, awaiting import..."
msgstr ""
@ -182,7 +182,7 @@ msgid "Blocks"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/templates/layout/app.html.eex:49
msgid "Blocks Indexed"
msgstr ""
@ -389,7 +389,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:13
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16
#: lib/block_scout_web/templates/layout/app.html.eex:66
#: lib/block_scout_web/templates/layout/app.html.eex:55
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:181
@ -472,7 +472,7 @@ msgid "IN"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:62
#: lib/block_scout_web/templates/layout/app.html.eex:51
msgid "Indexing Tokens"
msgstr ""
@ -508,7 +508,7 @@ msgid "Inventory"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:63
#: lib/block_scout_web/templates/layout/app.html.eex:52
msgid "Less than"
msgstr ""
@ -527,7 +527,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:28
#: lib/block_scout_web/templates/layout/app.html.eex:64
#: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
@ -679,7 +679,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:21
#: lib/block_scout_web/templates/layout/app.html.eex:65
#: lib/block_scout_web/templates/layout/app.html.eex:54
msgid "Price"
msgstr ""
@ -729,7 +729,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:89
#: lib/block_scout_web/templates/layout/_topnav.html.eex:106
#: lib/block_scout_web/templates/layout/_topnav.html.eex:107
msgid "Search"
msgstr ""

@ -62,7 +62,7 @@ msgid "(query)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:46
#: lib/block_scout_web/templates/layout/app.html.eex:35
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
@ -155,7 +155,7 @@ msgid "Block Height: %{height}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:61
#: lib/block_scout_web/templates/layout/app.html.eex:50
msgid "Block Mined, awaiting import..."
msgstr ""
@ -182,7 +182,7 @@ msgid "Blocks"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/templates/layout/app.html.eex:49
msgid "Blocks Indexed"
msgstr ""
@ -389,7 +389,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:13
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16
#: lib/block_scout_web/templates/layout/app.html.eex:66
#: lib/block_scout_web/templates/layout/app.html.eex:55
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:181
@ -472,7 +472,7 @@ msgid "IN"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:62
#: lib/block_scout_web/templates/layout/app.html.eex:51
msgid "Indexing Tokens"
msgstr ""
@ -508,7 +508,7 @@ msgid "Inventory"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:63
#: lib/block_scout_web/templates/layout/app.html.eex:52
msgid "Less than"
msgstr ""
@ -527,7 +527,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:28
#: lib/block_scout_web/templates/layout/app.html.eex:64
#: lib/block_scout_web/templates/layout/app.html.eex:53
#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
@ -679,7 +679,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:21
#: lib/block_scout_web/templates/layout/app.html.eex:65
#: lib/block_scout_web/templates/layout/app.html.eex:54
msgid "Price"
msgstr ""
@ -729,7 +729,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:89
#: lib/block_scout_web/templates/layout/_topnav.html.eex:106
#: lib/block_scout_web/templates/layout/_topnav.html.eex:107
msgid "Search"
msgstr ""

@ -74,7 +74,7 @@ defmodule Explorer.SmartContract.Verifier do
generated_bytecode != blockchain_bytecode_without_whisper ->
{:error, :generated_bytecode}
!ConstructorArguments.verify(address_hash, blockchain_bytecode, arguments_data) ->
!ConstructorArguments.verify(address_hash, arguments_data) ->
{:error, :constructor_arguments}
true ->

@ -5,13 +5,19 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArguments do
alias Explorer.Chain
def verify(address_hash, bytecode, arguments_data) do
def verify(address_hash, arguments_data) do
arguments_data = String.replace(arguments_data, "0x", "")
creation_input_data = Chain.contract_creation_input_data(address_hash)
data_with_swarm =
creation_input_data
|> String.split("0029")
|> List.first()
|> Kernel.<>("0029")
expected_arguments_data =
creation_input_data
|> String.split(bytecode)
|> String.split(data_with_swarm)
|> List.last()
|> String.replace("0x", "")

@ -6,26 +6,7 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArgumentsTest do
alias Explorer.Chain.Data
alias Explorer.SmartContract.Verifier.ConstructorArguments
describe "verify/3" do
test "verifies constructor arguments" do
bytecode = "0x0102030"
constructor_arguments = "0x405"
address = insert(:address)
input = %Data{
bytes: <<1, 2, 3, 4, 5>>
}
:transaction
|> insert(created_contract_address_hash: address.hash, input: input)
|> with_block()
assert ConstructorArguments.verify(address.hash, bytecode, constructor_arguments)
end
end
test "veriies constructor constructor arguments with whisper data" do
bytecode = "0x0102035d943c575be8a2aee2bb7737a765fdd2c6e49b74cd2c92ab0fa8e4282d1a75ae0029"
constructor_arguments = "0x0405"
address = insert(:address)
@ -39,6 +20,6 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArgumentsTest do
|> insert(created_contract_address_hash: address.hash, input: input)
|> with_block()
assert ConstructorArguments.verify(address.hash, bytecode, constructor_arguments)
assert ConstructorArguments.verify(address.hash, constructor_arguments)
end
end

Loading…
Cancel
Save