Fix dialyzer warnings

pull/162/head
Luke Imhoff 7 years ago
parent 2c7a446ab1
commit 35697eef34
  1. 2
      .dialyzer-ignore
  2. 3
      apps/explorer/lib/explorer/chain.ex
  3. 2
      apps/explorer/lib/explorer/chain/hash/truncated.ex
  4. 7
      apps/explorer/lib/explorer/indexer/block_fetcher.ex
  5. 11
      apps/explorer/lib/explorer/jsonrpc/receipt.ex
  6. 4
      apps/explorer/lib/explorer/jsonrpc/transaction.ex

@ -1,3 +1,5 @@
:0: Unknown function 'Elixir.ExUnit.Callbacks':'__merge__'/3
:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2
:0: Unknown type 'Elixir.Map':t/0
apps/explorer/lib/explorer/indexer/block_fetcher.ex:239: The created fun has no local return
apps/explorer/lib/explorer/indexer/block_fetcher.ex:246: The created fun has no local return

@ -234,9 +234,6 @@ defmodule Explorer.Chain do
@doc """
The `t:Explorer.Chain.Transaction.t/0` `gas_price` of the `transaction` in `unit`.
"""
@spec gas_price(Transaction.t(), :wei) :: Wei.t()
@spec gas_price(Transaction.t(), :gwei) :: Wei.gwei()
@spec gas_price(Transaction.t(), :ether) :: Wei.ether()
def gas_price(%Transaction{gas_price: gas_price}, unit) do
Wei.to(gas_price, unit)
end

@ -81,7 +81,7 @@ defmodule Explorer.Chain.Hash.Truncated do
"""
@impl Ecto.Type
@spec cast(term()) :: {:ok, t()} :: :error
@spec cast(term()) :: {:ok, t()} | :error
def cast(term) do
Hash.cast(__MODULE__, term)
end

@ -240,6 +240,13 @@ defmodule Explorer.Indexer.BlockFetcher do
"failed to fetch blocks #{inspect(range)}: #{inspect(reason)}. Retrying"
end)
:ok = Sequence.inject_range(seq, range)
{:error, reason, range} ->
Logger.debug(fn ->
"failed to fetch blocks #{inspect(range)}: #{inspect(reason)}. Retrying"
end)
:ok = Sequence.inject_range(seq, range)
end
end,

@ -6,12 +6,13 @@ defmodule Explorer.JSONRPC.Receipt do
import Explorer.JSONRPC, only: [quantity_to_integer: 1]
alias Explorer.Chain.Receipt.Status
alias Explorer.JSONRPC
alias Explorer.JSONRPC.Logs
# Types
@type elixir :: %{String.t() => nil}
@type elixir :: %{String.t() => String.t() | non_neg_integer}
@typedoc """
* `"contractAddress"` - The contract `t:Explorer.JSONRPC.address/0` created, if the transaction was a contract
@ -65,7 +66,13 @@ defmodule Explorer.JSONRPC.Receipt do
}
"""
@spec elixir_to_params(elixir) :: [map]
@spec elixir_to_params(elixir) :: %{
cumulative_gas_used: non_neg_integer,
gas_used: non_neg_integer,
status: Status.t(),
transaction_hash: String.t(),
transaction_index: non_neg_integer()
}
def elixir_to_params(%{
"cumulativeGasUsed" => cumulative_gas_used,
"gasUsed" => gas_used,

@ -44,16 +44,18 @@ defmodule Explorer.JSONRPC.Transaction do
@type params :: %{
block_hash: JSONRPC.hash(),
from_address_hash: JSONRPC.address(),
gas: non_neg_integer(),
gas_price: non_neg_integer(),
hash: JSONRPC.hash(),
index: non_neg_integer(),
input: String.t(),
nonce: non_neg_integer(),
publicKey: String.t(),
public_key: String.t(),
r: non_neg_integer(),
s: non_neg_integer(),
standard_v: 0 | 1,
to_address_hash: JSONRPC.address(),
v: non_neg_integer(),
value: non_neg_integer()
}

Loading…
Cancel
Save