Include input when converting elixir call traces

pull/1094/head
Luke Imhoff 6 years ago
parent ea959d08bb
commit ea00df0cd1
  1. 78
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace.ex

@ -89,38 +89,39 @@ defmodule EthereumJSONRPC.Parity.Trace do
...> "action" => %{ ...> "action" => %{
...> "callType" => "call", ...> "callType" => "call",
...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", ...> "from" => "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca",
...> "to" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> "gas" => 4677320, ...> "gas" => 4677320,
...> "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef", ...> "input" => "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef",
...> "to" => "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> "value" => 0 ...> "value" => 0
...> }, ...> },
...> "blockNumber" => 35, ...> "blockNumber" => 35,
...> "transactionIndex" => 0,
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6",
...> "index" => 0, ...> "index" => 0,
...> "traceAddress" => [],
...> "type" => "call",
...> "result" => %{ ...> "result" => %{
...> "gasUsed" => 27770, ...> "gasUsed" => 27770,
...> "output" => "0x" ...> "output" => "0x"
...> }, ...> },
...> "subtraces" => 0, ...> "subtraces" => 0
...> "traceAddress" => [],
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6",
...> "type" => "call",
...> "transactionIndex" => 0
...> } ...> }
...> ) ...> )
%{ %{
block_number: 35, block_number: 35,
transaction_index: 0,
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6",
index: 0,
trace_address: [],
type: "call",
call_type: "call", call_type: "call",
from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca",
to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
gas: 4677320, gas: 4677320,
gas_used: 27770, gas_used: 27770,
index: 0, input: "0x10855269000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef",
output: "0x", output: "0x",
to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", value: 0
trace_address: [],
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6",
type: "call",
value: 0,
transaction_index: 0
} }
Calls can error and be reverted Calls can error and be reverted
@ -130,34 +131,35 @@ defmodule EthereumJSONRPC.Parity.Trace do
...> "action" => %{ ...> "action" => %{
...> "callType" => "call", ...> "callType" => "call",
...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32", ...> "from" => "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32",
...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527",
...> "gas" => 7578728, ...> "gas" => 7578728,
...> "input" => "0xa6f2ae3a", ...> "input" => "0xa6f2ae3a",
...> "to" => "0xfdca0da4158740a93693441b35809b5bb463e527",
...> "value" => 10000000000000000 ...> "value" => 10000000000000000
...> }, ...> },
...> "blockNumber" => 35, ...> "blockNumber" => 35,
...> "error" => "Reverted", ...> "transactionIndex" => 0,
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b",
...> "index" => 0, ...> "index" => 0,
...> "subtraces" => 7,
...> "traceAddress" => [], ...> "traceAddress" => [],
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b",
...> "type" => "call", ...> "type" => "call",
...> "transactionIndex" => 0 ...> "error" => "Reverted",
...> "subtraces" => 7,
...> } ...> }
...> ) ...> )
%{ %{
block_number: 35, block_number: 35,
call_type: "call", transaction_index: 0,
error: "Reverted", transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b",
from_address_hash: "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32",
gas: 7578728,
index: 0, index: 0,
to_address_hash: "0xfdca0da4158740a93693441b35809b5bb463e527",
trace_address: [], trace_address: [],
transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b",
type: "call", type: "call",
value: 10000000000000000, call_type: "call",
transaction_index: 0 from_address_hash: "0xc9266e6fdf5182dc47d27e0dc32bdff9e4cd2e32",
to_address_hash: "0xfdca0da4158740a93693441b35809b5bb463e527",
input: "0xa6f2ae3a",
error: "Reverted",
gas: 7578728,
value: 10000000000000000
} }
Self-destruct transfer a `"balance"` from `"address"` to `"refundAddress"`. These self-destruct-unique fields can be Self-destruct transfer a `"balance"` from `"address"` to `"refundAddress"`. These self-destruct-unique fields can be
@ -204,30 +206,32 @@ defmodule EthereumJSONRPC.Parity.Trace do
%{ %{
"action" => %{ "action" => %{
"callType" => call_type, "callType" => call_type,
"to" => to_address_hash,
"from" => from_address_hash, "from" => from_address_hash,
"input" => input,
"gas" => gas, "gas" => gas,
"to" => to_address_hash,
"value" => value "value" => value
}, },
"blockNumber" => block_number, "blockNumber" => block_number,
"index" => index, "transactionIndex" => transaction_index,
"traceAddress" => trace_address,
"transactionHash" => transaction_hash, "transactionHash" => transaction_hash,
"transactionIndex" => transaction_index "index" => index,
"traceAddress" => trace_address
} = elixir } = elixir
%{ %{
block_number: block_number, block_number: block_number,
call_type: call_type, transaction_hash: transaction_hash,
from_address_hash: from_address_hash, transaction_index: transaction_index,
gas: gas,
index: index, index: index,
to_address_hash: to_address_hash,
trace_address: trace_address, trace_address: trace_address,
transaction_hash: transaction_hash,
type: type, type: type,
value: value, call_type: call_type,
transaction_index: transaction_index from_address_hash: from_address_hash,
to_address_hash: to_address_hash,
gas: gas,
input: input,
value: value
} }
|> put_call_error_or_result(elixir) |> put_call_error_or_result(elixir)
end end

Loading…
Cancel
Save