From 8c0c4fdd888206f00b5a6b790f8451c49509e3a0 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 3 Jun 2019 11:00:34 +0300 Subject: [PATCH 01/10] allow totaldifficuly to be nil --- .../lib/ethereum_jsonrpc/block.ex | 2 +- .../test/ethereum_jsonrpc/block_test.exs | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index 116232f999..4ac9b327a0 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -440,7 +440,7 @@ defmodule EthereumJSONRPC.Block do end # Size may be `nil` for uncle blocks - defp entry_to_elixir({key, nil}) when key in ~w(size) do + defp entry_to_elixir({key, nil}) when key in ~w(size totalDifficulty) do {key, nil} end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs index 3075dd4b74..1cf16c6f47 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs @@ -2,4 +2,58 @@ defmodule EthereumJSONRPC.BlockTest do use ExUnit.Case, async: true doctest EthereumJSONRPC.Block + + alias EthereumJSONRPC.Block + + describe "elixir_to_params/1" do + test "sets totalDifficuly to nil if it's empty" do + result = + Block.elixir_to_params(%{ + "difficulty" => 17_561_410_778, + "extraData" => "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32", + "gasLimit" => 5000, + "gasUsed" => 0, + "hash" => "0x4d9423080290a650eaf6db19c87c76dff83d1b4ab64aefe6e5c5aa2d1f4b6623", + "logsBloom" => + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner" => "0xbb7b8287f3f0a933474a79eae42cbca977791171", + "mixHash" => "0xbbb93d610b2b0296a59f18474ac3d6086a9902aa7ca4b9a306692f7c3d496fdf", + "nonce" => 5_539_500_215_739_777_653, + "number" => 59, + "parentHash" => "0xcd5b5c4cecd7f18a13fe974255badffd58e737dc67596d56bc01f063dd282e9e", + "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size" => 542, + "stateRoot" => "0x6fd0a5d82ca77d9f38c3ebbde11b11d304a5fcf3854f291df64395ab38ed43ba", + "timestamp" => Timex.parse!("2015-07-30T15:32:07Z", "{ISO:Extended:Z}"), + "totalDifficulty" => nil, + "transactions" => [], + "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles" => [] + }) + + assert result == %{ + difficulty: 17_561_410_778, + extra_data: "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32", + gas_limit: 5000, + gas_used: 0, + hash: "0x4d9423080290a650eaf6db19c87c76dff83d1b4ab64aefe6e5c5aa2d1f4b6623", + logs_bloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + mix_hash: "0xbbb93d610b2b0296a59f18474ac3d6086a9902aa7ca4b9a306692f7c3d496fdf", + miner_hash: "0xbb7b8287f3f0a933474a79eae42cbca977791171", + nonce: 5_539_500_215_739_777_653, + number: 59, + parent_hash: "0xcd5b5c4cecd7f18a13fe974255badffd58e737dc67596d56bc01f063dd282e9e", + receipts_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + sha3_uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + size: 542, + state_root: "0x6fd0a5d82ca77d9f38c3ebbde11b11d304a5fcf3854f291df64395ab38ed43ba", + timestamp: Timex.parse!("2015-07-30T15:32:07Z", "{ISO:Extended:Z}"), + total_difficulty: nil, + transactions_root: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + uncles: [] + } + end + end end From 11c1b2e02de69fa65ea37cc142eca66ccb72d944 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 3 Jun 2019 11:08:30 +0300 Subject: [PATCH 02/10] add CHANGELOG entry --- CHANGELOG.md | 1 + apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c4a8d1e1e..4d1d757589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ - [#2014](https://github.com/poanetwork/blockscout/pull/2014) - fix: use better queries for listLogs endpoint - [#2027](https://github.com/poanetwork/blockscout/pull/2027) - fix: `BlocksTransactionsMismatch` ignoring blocks without transactions - [#2070](https://github.com/poanetwork/blockscout/pull/2070) - reduce `max_concurrency` of `BlocksTransactionsMismatch` fetcher +- [#2083](https://github.com/poanetwork/blockscout/pull/2083) - allow total_difficuly to be nil ### Chore diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index 4ac9b327a0..6be34eeee1 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -439,7 +439,7 @@ defmodule EthereumJSONRPC.Block do {key, quantity_to_integer(quantity)} end - # Size may be `nil` for uncle blocks + # Size and totalDifficulty may be `nil` for uncle blocks defp entry_to_elixir({key, nil}) when key in ~w(size totalDifficulty) do {key, nil} end From b1530e370948dbf1d8f16669145482740a668fab Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 3 Jun 2019 12:36:48 +0300 Subject: [PATCH 03/10] fix geth's staticcall without output --- .../lib/ethereum_jsonrpc/geth/call.ex | 35 +++++++-------- .../test/ethereum_jsonrpc/geth/call_test.exs | 43 +++++++++++++++++++ 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex index 434cc7b34d..1555ea6c8f 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex @@ -385,22 +385,23 @@ defmodule EthereumJSONRPC.Geth.Call do } end - defp elixir_to_internal_transaction_params(%{ - "blockNumber" => block_number, - "transactionIndex" => transaction_index, - "transactionHash" => transaction_hash, - "index" => index, - "traceAddress" => trace_address, - "type" => "call" = type, - "callType" => "staticcall" = call_type, - "from" => from_address_hash, - "to" => to_address_hash, - "input" => input, - "output" => output, - "gas" => gas, - "gasUsed" => gas_used, - "value" => 0 = value - }) do + defp elixir_to_internal_transaction_params( + %{ + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash, + "index" => index, + "traceAddress" => trace_address, + "type" => "call" = type, + "callType" => "staticcall" = call_type, + "from" => from_address_hash, + "to" => to_address_hash, + "input" => input, + "gas" => gas, + "gasUsed" => gas_used, + "value" => 0 = value + } = params + ) do %{ block_number: block_number, transaction_index: transaction_index, @@ -414,7 +415,7 @@ defmodule EthereumJSONRPC.Geth.Call do gas: gas, gas_used: gas_used, input: input, - output: output, + output: params["output"], value: value } end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs index 69815f203f..f4a97c07de 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs @@ -2,4 +2,47 @@ defmodule EthereumJSONRPC.Geth.CallTest do use ExUnit.Case, async: true doctest EthereumJSONRPC.Geth.Call + + alias EthereumJSONRPC.Geth.Call + + describe "to_internal_transaction_params/1" do + test "does not fail decoding static_call without output" do + result = + Call.to_internal_transaction_params(%{ + "blockNumber" => 584_340, + "callType" => "staticcall", + "error" => "execution reverted", + "from" => "0x3858636f27e269d23db2ef1fcca5f93dcaa564cd", + "gas" => "0x0", + "gasUsed" => "0x0", + "index" => 1, + "input" => + "0x09d10a5e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002", + "to" => "0x79073fc2117dd054fcedacad1e7018c9cbe3ec0b", + "traceAddress" => [1, 3], + "transactionHash" => "0xbc38745b826f058ed2f6c93fa5b145323857f06bbb5230b6a6a50e09e0915857", + "transactionIndex" => 0, + "type" => "call", + "value" => "0x0" + }) + + assert result == %{ + block_number: 584_340, + call_type: "staticcall", + from_address_hash: "0x3858636f27e269d23db2ef1fcca5f93dcaa564cd", + gas: 0, + gas_used: 0, + index: 1, + input: + "0x09d10a5e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002", + output: nil, + to_address_hash: "0x79073fc2117dd054fcedacad1e7018c9cbe3ec0b", + trace_address: [1, 3], + transaction_hash: "0xbc38745b826f058ed2f6c93fa5b145323857f06bbb5230b6a6a50e09e0915857", + transaction_index: 0, + type: "call", + value: 0 + } + end + end end From b869643bfff80f94ca19185e3b5ca45634c41732 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 3 Jun 2019 12:39:20 +0300 Subject: [PATCH 04/10] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3627226570..fc4970ef94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ - [#2014](https://github.com/poanetwork/blockscout/pull/2014) - fix: use better queries for listLogs endpoint - [#2027](https://github.com/poanetwork/blockscout/pull/2027) - fix: `BlocksTransactionsMismatch` ignoring blocks without transactions - [#2070](https://github.com/poanetwork/blockscout/pull/2070) - reduce `max_concurrency` of `BlocksTransactionsMismatch` fetcher +- [#2086](https://github.com/poanetwork/blockscout/pull/2086) - fix geth's staticcall without output ### Chore From 7749705c897f3b551f978e8ce7be7051e2dddd39 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 4 Jun 2019 17:47:10 +0300 Subject: [PATCH 05/10] Update overview.html.eex --- .../lib/block_scout_web/templates/transaction/overview.html.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 7c22762e49..c736a87633 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -51,7 +51,7 @@ - <%# <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", hash: hash(@transaction), type: "tx" %> %> +
From da8ef5df2490adabb34238a290d60aa55eb73159 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 4 Jun 2019 18:56:26 +0300 Subject: [PATCH 06/10] Update _navbar.scss --- apps/block_scout_web/assets/css/components/_navbar.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/assets/css/components/_navbar.scss b/apps/block_scout_web/assets/css/components/_navbar.scss index 0999ef327c..82a18c582c 100644 --- a/apps/block_scout_web/assets/css/components/_navbar.scss +++ b/apps/block_scout_web/assets/css/components/_navbar.scss @@ -10,7 +10,7 @@ $header-textfield-text-color: $header-links-color !default; $header-textfield-background-color: #f5f6fa !default; $header-textfield-magnifier-color: $header-links-color !default; $header-link-horizontal-padding: 0.71rem; -$navbar-logo-height: 1.5em !default; +$navbar-logo-height: 18px !default; $navbar-logo-width: auto !default; .navbar.navbar-primary { @@ -208,7 +208,7 @@ $navbar-logo-width: auto !default; } .navbar-logo { - height: $navbar-logo-height; + max-height: $navbar-logo-height; width: $navbar-logo-width; } From f2d7503604c5686bcba2033e5fc2065ff21d0bcd Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 4 Jun 2019 18:57:10 +0300 Subject: [PATCH 07/10] Update _dropdown.scss --- apps/block_scout_web/assets/css/components/_dropdown.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/block_scout_web/assets/css/components/_dropdown.scss b/apps/block_scout_web/assets/css/components/_dropdown.scss index f0a7e33661..52f12861aa 100644 --- a/apps/block_scout_web/assets/css/components/_dropdown.scss +++ b/apps/block_scout_web/assets/css/components/_dropdown.scss @@ -30,8 +30,10 @@ font-size: 12px; padding: 10px 20px; - &:hover { + &:hover, &.active { color: #fff; + background-color: rgba($primary, .1) !important; + color: $primary; } &:first-child { From 658c471541ac4100545bb1f65fdf72dae9c4b677 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 4 Jun 2019 19:00:34 +0300 Subject: [PATCH 08/10] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 349b3e8ae9..8e0d4d0e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - [#2064](https://github.com/poanetwork/blockscout/pull/2064) - feat: add fields to tx apis, small cleanups ### Fixes +- [#2098](https://github.com/poanetwork/blockscout/pull/2098) - nav dropdown issue, logo size issue - [#2082](https://github.com/poanetwork/blockscout/pull/2082) - dropdown styles, tooltip gap fix, 404 page added - [#2077](https://github.com/poanetwork/blockscout/pull/2077) - ui issues - [#2072](https://github.com/poanetwork/blockscout/pull/2072) - Fixed checkmarks not showing correctly in tabs. From e4c14fdcd00b0f71bb382c1dfe040329ed926ad4 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 4 Jun 2019 19:48:52 +0300 Subject: [PATCH 09/10] Update _log-search.scss --- apps/block_scout_web/assets/css/components/_log-search.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/assets/css/components/_log-search.scss b/apps/block_scout_web/assets/css/components/_log-search.scss index a31de73262..f1c6d145cc 100644 --- a/apps/block_scout_web/assets/css/components/_log-search.scss +++ b/apps/block_scout_web/assets/css/components/_log-search.scss @@ -12,8 +12,10 @@ .logs-search { display: flex; position: relative; + width: 52%; @media (max-width: 599px) { margin-bottom: 30px; + width: 100%; } } @@ -57,8 +59,8 @@ transition: .1s ease-in; position: absolute; top: 0; - left: 136px; + right: 59px; &:hover { color: #333; } -} \ No newline at end of file +} From 004e28b4a25ccc88289213a1c95bd4e1cfa99f78 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 4 Jun 2019 19:52:50 +0300 Subject: [PATCH 10/10] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5494a75d23..998798b2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - [#2064](https://github.com/poanetwork/blockscout/pull/2064) - feat: add fields to tx apis, small cleanups ### Fixes +- [#2099](https://github.com/poanetwork/blockscout/pull/2099) - logs search input width - [#2098](https://github.com/poanetwork/blockscout/pull/2098) - nav dropdown issue, logo size issue - [#2082](https://github.com/poanetwork/blockscout/pull/2082) - dropdown styles, tooltip gap fix, 404 page added - [#2077](https://github.com/poanetwork/blockscout/pull/2077) - ui issues