Merge branch 'master' into v2.0.0-beta

pull/2099/head
maxgrapps 6 years ago committed by GitHub
commit 7efa27bdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  3. 4
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex
  4. 9
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth/call.ex
  5. 54
      apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs
  6. 43
      apps/ethereum_jsonrpc/test/ethereum_jsonrpc/geth/call_test.exs

@ -66,6 +66,8 @@
- [#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
- [#2086](https://github.com/poanetwork/blockscout/pull/2086) - fix geth's staticcall without output
### Chore

@ -51,7 +51,7 @@
</span>
</div>
<!-- Verify in other explorers -->
<%# <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", hash: hash(@transaction), type: "tx" %> %>
<!-- <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", hash: hash(@transaction), type: "tx" %> -->
<hr>
<!-- Block Hash -->
<dl class="row">

@ -439,8 +439,8 @@ defmodule EthereumJSONRPC.Block do
{key, quantity_to_integer(quantity)}
end
# Size may be `nil` for uncle blocks
defp entry_to_elixir({key, nil}) when key in ~w(size) do
# 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

@ -385,7 +385,8 @@ defmodule EthereumJSONRPC.Geth.Call do
}
end
defp elixir_to_internal_transaction_params(%{
defp elixir_to_internal_transaction_params(
%{
"blockNumber" => block_number,
"transactionIndex" => transaction_index,
"transactionHash" => transaction_hash,
@ -396,11 +397,11 @@ defmodule EthereumJSONRPC.Geth.Call do
"from" => from_address_hash,
"to" => to_address_hash,
"input" => input,
"output" => output,
"gas" => gas,
"gasUsed" => gas_used,
"value" => 0 = value
}) do
} = 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

@ -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

@ -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

Loading…
Cancel
Save