|
|
@ -28,7 +28,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
...> "type" => "create" |
|
|
|
...> "type" => "create", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0 |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -43,7 +44,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: [], |
|
|
|
trace_address: [], |
|
|
|
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
type: "create", |
|
|
|
type: "create", |
|
|
|
value: 0 |
|
|
|
value: 0, |
|
|
|
|
|
|
|
transaction_index: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
A create can fail due to a Bad Instruction in the `init` that is meant to form the `code` of the contract |
|
|
|
A create can fail due to a Bad Instruction in the `init` that is meant to form the `code` of the contract |
|
|
@ -62,7 +64,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", |
|
|
|
...> "transactionHash" => "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", |
|
|
|
...> "type" => "create" |
|
|
|
...> "type" => "create", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0 |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -75,7 +78,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: [], |
|
|
|
trace_address: [], |
|
|
|
transaction_hash: "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", |
|
|
|
transaction_hash: "0x3c624bb4852fb5e35a8f45644cec7a486211f6ba89034768a2b763194f22f97d", |
|
|
|
type: "create", |
|
|
|
type: "create", |
|
|
|
value: 0 |
|
|
|
value: 0, |
|
|
|
|
|
|
|
transaction_index: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Call type traces are generated when a method is called. Calls are further divided by call type. |
|
|
|
Call type traces are generated when a method is called. Calls are further divided by call type. |
|
|
@ -99,7 +103,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
...> "type" => "call" |
|
|
|
...> "type" => "call", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0 |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -114,7 +119,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: [], |
|
|
|
trace_address: [], |
|
|
|
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
transaction_hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
type: "call", |
|
|
|
type: "call", |
|
|
|
value: 0 |
|
|
|
value: 0, |
|
|
|
|
|
|
|
transaction_index: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Calls can error and be reverted |
|
|
|
Calls can error and be reverted |
|
|
@ -135,7 +141,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 7, |
|
|
|
...> "subtraces" => 7, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
...> "type" => "call" |
|
|
|
...> "type" => "call", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0 |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -149,7 +156,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: [], |
|
|
|
trace_address: [], |
|
|
|
transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
transaction_hash: "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
type: "call", |
|
|
|
type: "call", |
|
|
|
value: 10000000000000000 |
|
|
|
value: 10000000000000000, |
|
|
|
|
|
|
|
transaction_index: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Suicides transfer a `"balance"` from `"address"` to `"refundAddress"`. These suicide-unique fields can be mapped to |
|
|
|
Suicides transfer a `"balance"` from `"address"` to `"refundAddress"`. These suicide-unique fields can be mapped to |
|
|
@ -174,7 +182,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [0], |
|
|
|
...> "traceAddress" => [0], |
|
|
|
...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
...> "type" => "suicide" |
|
|
|
...> "type" => "suicide", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0 |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -185,7 +194,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: [0], |
|
|
|
trace_address: [0], |
|
|
|
transaction_hash: "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
transaction_hash: "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
type: "suicide", |
|
|
|
type: "suicide", |
|
|
|
value: 0 |
|
|
|
value: 0, |
|
|
|
|
|
|
|
transaction_index: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
@ -202,7 +212,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"blockNumber" => block_number, |
|
|
|
"blockNumber" => block_number, |
|
|
|
"index" => index, |
|
|
|
"index" => index, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"transactionHash" => transaction_hash |
|
|
|
"transactionHash" => transaction_hash, |
|
|
|
|
|
|
|
"transactionIndex" => transaction_index |
|
|
|
} = elixir |
|
|
|
} = elixir |
|
|
|
|
|
|
|
|
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -215,7 +226,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: trace_address, |
|
|
|
trace_address: trace_address, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
type: type, |
|
|
|
type: type, |
|
|
|
value: value |
|
|
|
value: value, |
|
|
|
|
|
|
|
transaction_index: transaction_index |
|
|
|
} |
|
|
|
} |
|
|
|
|> put_call_error_or_result(elixir) |
|
|
|
|> put_call_error_or_result(elixir) |
|
|
|
end |
|
|
|
end |
|
|
@ -226,7 +238,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"blockNumber" => block_number, |
|
|
|
"blockNumber" => block_number, |
|
|
|
"index" => index, |
|
|
|
"index" => index, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"transactionHash" => transaction_hash |
|
|
|
"transactionHash" => transaction_hash, |
|
|
|
|
|
|
|
"transactionIndex" => transaction_index |
|
|
|
} = elixir |
|
|
|
} = elixir |
|
|
|
|
|
|
|
|
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -238,7 +251,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: trace_address, |
|
|
|
trace_address: trace_address, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
type: type, |
|
|
|
type: type, |
|
|
|
value: value |
|
|
|
value: value, |
|
|
|
|
|
|
|
transaction_index: transaction_index |
|
|
|
} |
|
|
|
} |
|
|
|
|> put_create_error_or_result(elixir) |
|
|
|
|> put_create_error_or_result(elixir) |
|
|
|
end |
|
|
|
end |
|
|
@ -253,7 +267,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"blockNumber" => block_number, |
|
|
|
"blockNumber" => block_number, |
|
|
|
"index" => index, |
|
|
|
"index" => index, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"traceAddress" => trace_address, |
|
|
|
"transactionHash" => transaction_hash |
|
|
|
"transactionHash" => transaction_hash, |
|
|
|
|
|
|
|
"transactionIndex" => transaction_index |
|
|
|
} = elixir |
|
|
|
} = elixir |
|
|
|
|
|
|
|
|
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -264,7 +279,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
trace_address: trace_address, |
|
|
|
trace_address: trace_address, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
transaction_hash: transaction_hash, |
|
|
|
type: type, |
|
|
|
type: type, |
|
|
|
value: value |
|
|
|
value: value, |
|
|
|
|
|
|
|
transaction_index: transaction_index |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -289,6 +305,7 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
...> "transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0, |
|
|
|
...> "type" => "create" |
|
|
|
...> "type" => "create" |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
@ -309,6 +326,7 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"subtraces" => 0, |
|
|
|
"subtraces" => 0, |
|
|
|
"traceAddress" => [], |
|
|
|
"traceAddress" => [], |
|
|
|
"transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
"transactionHash" => "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", |
|
|
|
|
|
|
|
"transactionIndex" => 0, |
|
|
|
"type" => "create" |
|
|
|
"type" => "create" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -330,10 +348,11 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> }, |
|
|
|
...> }, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
|
|
|
|
...> "transactionIndex" => 0, |
|
|
|
...> "type" => "create" |
|
|
|
...> "type" => "create" |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
|
** (ArgumentError) Caller must `Map.put/2` `"blockNumber"`, `"index"`, and `"transactionHash"` in trace |
|
|
|
** (ArgumentError) Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace |
|
|
|
|
|
|
|
|
|
|
|
`"suicide"` `"type"` traces are different in that they have a `nil` `"result"`. This is because the `"result"` key |
|
|
|
`"suicide"` `"type"` traces are different in that they have a `nil` `"result"`. This is because the `"result"` key |
|
|
|
is used to indicate success from Parity. |
|
|
|
is used to indicate success from Parity. |
|
|
@ -351,6 +370,7 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "subtraces" => 0, |
|
|
|
...> "traceAddress" => [0], |
|
|
|
...> "traceAddress" => [0], |
|
|
|
...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
...> "transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0, |
|
|
|
...> "type" => "suicide" |
|
|
|
...> "type" => "suicide" |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
@ -366,6 +386,7 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"subtraces" => 0, |
|
|
|
"subtraces" => 0, |
|
|
|
"traceAddress" => [0], |
|
|
|
"traceAddress" => [0], |
|
|
|
"transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
"transactionHash" => "0xb012b8c53498c669d87d85ed90f57385848b86d3f44ed14b2784ec685d6fda98", |
|
|
|
|
|
|
|
"transactionIndex" => 0, |
|
|
|
"type" => "suicide" |
|
|
|
"type" => "suicide" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -387,6 +408,7 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
...> "subtraces" => 7, |
|
|
|
...> "subtraces" => 7, |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "traceAddress" => [], |
|
|
|
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
...> "transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
|
|
|
|
...> "transactionIndex" => 0, |
|
|
|
...> "type" => "call" |
|
|
|
...> "type" => "call" |
|
|
|
...> } |
|
|
|
...> } |
|
|
|
...> ) |
|
|
|
...> ) |
|
|
@ -405,19 +427,20 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
"subtraces" => 7, |
|
|
|
"subtraces" => 7, |
|
|
|
"traceAddress" => [], |
|
|
|
"traceAddress" => [], |
|
|
|
"transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
"transactionHash" => "0xcd7c15dbbc797722bef6e1d551edfd644fc7f4fb2ccd6a7947b2d1ade9ed140b", |
|
|
|
|
|
|
|
"transactionIndex" => 0, |
|
|
|
"type" => "call" |
|
|
|
"type" => "call" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
def to_elixir(%{"blockNumber" => _, "index" => _, "transactionHash" => _} = trace) |
|
|
|
def to_elixir(%{"blockNumber" => _, "index" => _, "transactionHash" => _, "transactionIndex" => _} = trace) |
|
|
|
when is_map(trace) do |
|
|
|
when is_map(trace) do |
|
|
|
Enum.into(trace, %{}, &entry_to_elixir/1) |
|
|
|
Enum.into(trace, %{}, &entry_to_elixir/1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def to_elixir(_) do |
|
|
|
def to_elixir(_) do |
|
|
|
raise ArgumentError, |
|
|
|
raise ArgumentError, |
|
|
|
~S|Caller must `Map.put/2` `"blockNumber"`, `"index"`, and `"transactionHash"` in trace| |
|
|
|
~S|Caller must `Map.put/2` `"blockNumber"`, `"index"`, `"transactionHash"` and `"transactionIndex"` in trace| |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# subtraces is an actual integer in JSON and not hex-encoded |
|
|
|
# subtraces is an actual integer in JSON and not hex-encoded |
|
|
@ -441,6 +464,8 @@ defmodule EthereumJSONRPC.Parity.Trace do |
|
|
|
{key, Result.to_elixir(result)} |
|
|
|
{key, Result.to_elixir(result)} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp entry_to_elixir({"transactionIndex", index} = entry) when is_integer(index), do: entry |
|
|
|
|
|
|
|
|
|
|
|
defp put_call_error_or_result(params, %{ |
|
|
|
defp put_call_error_or_result(params, %{ |
|
|
|
"result" => %{"gasUsed" => gas_used, "output" => output} |
|
|
|
"result" => %{"gasUsed" => gas_used, "output" => output} |
|
|
|
}) do |
|
|
|
}) do |
|
|
|