Merge pull request #2196 from poanetwork/ab-fix-response-without-id

Nethermind client fixes
pull/2302/head
Victor Baranov 5 years ago committed by GitHub
commit d4bce47797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex
  3. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex
  4. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex
  5. 4
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex

@ -73,6 +73,7 @@
- [#2173](https://github.com/poanetwork/blockscout/pull/2173) - handle correctly empty transactions
- [#2174](https://github.com/poanetwork/blockscout/pull/2174) - fix reward channel joining
- [#2186](https://github.com/poanetwork/blockscout/pull/2186) - fix net version test
- [#2196](https://github.com/poanetwork/blockscout/pull/2196) - Nethermind client fixes
- [#2237](https://github.com/poanetwork/blockscout/pull/2237) - fix rsk total_supply
- [#2198](https://github.com/poanetwork/blockscout/pull/2198) - reduce transaction status and error constraint
- [#2167](https://github.com/poanetwork/blockscout/pull/2167) - feat: document eth rpc api mimicking endpoints

@ -358,7 +358,9 @@ defmodule EthereumJSONRPC do
String.to_integer(hexadecimal_digits, 16)
end
def quantity_to_integer(string) do
def quantity_to_integer(integer) when is_integer(integer), do: integer
def quantity_to_integer(string) when is_binary(string) do
case Integer.parse(string) do
{integer, ""} -> integer
_ -> :error

@ -7,6 +7,8 @@ defmodule EthereumJSONRPC.HTTP do
require Logger
import EthereumJSONRPC, only: [quantity_to_integer: 1]
@behaviour Transport
@doc """
@ -131,6 +133,9 @@ defmodule EthereumJSONRPC.HTTP do
# restrict response to only those fields supported by the JSON-RPC 2.0 standard, which means that level of keys is
# validated, so we can indicate that with switch to atom keys.
defp standardize_response(%{"jsonrpc" => "2.0" = jsonrpc, "id" => id} = unstandardized) do
# Nethermind return string ids
id = quantity_to_integer(id)
standardized = %{jsonrpc: jsonrpc, id: id}
case unstandardized do

@ -294,6 +294,11 @@ defmodule EthereumJSONRPC.Receipt do
:ignore
end
# Nethermind field
defp entry_to_elixir({"error", _}) do
:ignore
end
defp entry_to_elixir({key, value}) do
{:error, {:unknown_key, %{key: key, value: value}}}
end

@ -322,6 +322,10 @@ defmodule EthereumJSONRPC.Transaction do
when key in ~w(blockHash condition creates from hash input jsonrpc publicKey raw to txType),
do: {key, value}
# specific to Nethermind client
defp entry_to_elixir({"data", value}),
do: {"input", value}
defp entry_to_elixir({key, quantity}) when key in ~w(gas gasPrice nonce r s standardV v value) and quantity != nil do
{key, quantity_to_integer(quantity)}
end

Loading…
Cancel
Save