Transaction v as integer

Documentation I can find say v should be between 27 and 30 with 29 and
30 being rare, but there are some values of 189 and 190 from Sokol, so
we can't constrain the value now.
pull/186/head
Luke Imhoff 7 years ago
parent 3f7a737238
commit 6749e15cb8
  1. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex
  2. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transactions.ex
  3. 4
      apps/explorer/lib/explorer/chain.ex
  4. 26
      apps/explorer/lib/explorer/chain/transaction.ex
  5. 2
      apps/explorer/priv/repo/migrations/20180117221923_create_transactions.exs
  6. 4
      apps/explorer/test/explorer/chain/transaction_test.exs
  7. 2
      apps/explorer/test/support/factory.ex
  8. 2
      coveralls.json

@ -136,13 +136,12 @@ defmodule EthereumJSONRPC.Transaction do
# double check that no new keys are being missed by requiring explicit match for passthrough
# `t:EthereumJSONRPC.address/0` and `t:EthereumJSONRPC.hash/0` pass through as `Explorer.Chain` can verify correct
# hash format
# v passes through because they exceed postgres integer limits
defp entry_to_elixir({key, value})
when key in ~w(blockHash condition creates from hash input jsonrpc publicKey raw to v),
when key in ~w(blockHash condition creates from hash input jsonrpc publicKey raw to),
do: {key, value}
defp entry_to_elixir({key, quantity})
when key in ~w(blockNumber gas gasPrice nonce r s standardV transactionIndex value) do
when key in ~w(blockNumber gas gasPrice nonce r s standardV transactionIndex v value) do
{key, quantity_to_integer(quantity)}
end

@ -142,7 +142,7 @@ defmodule EthereumJSONRPC.Transactions do
"standardV" => 0,
"to" => nil,
"transactionIndex" => 0,
"v" => "0xbd",
"v" => 189,
"value" => 0
}
]

@ -551,7 +551,7 @@ defmodule Explorer.Chain do
...> s: 0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f,
...> standard_v: 1,
...> to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> v: "0xbe",
...> v: 0xbe,
...> value: 0
...> }
...> ]
@ -725,7 +725,7 @@ defmodule Explorer.Chain do
...> s: 0x1f87a076f13824f4be8963e3dffd7300dae64d5f23c9a062af0c6ead347c135f,
...> standard_v: 1,
...> to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> v: "0xbe",
...> v: 0xbe,
...> value: 0
...> }
...> ]

@ -128,7 +128,7 @@ defmodule Explorer.Chain.Transaction do
field(:r, :decimal)
field(:s, :decimal)
field(:standard_v, :integer)
field(:v, :string)
field(:v, :integer)
field(:value, Wei)
timestamps()
@ -169,8 +169,8 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> v: "0x8d",
...> standard_v: 0x0,
...> v: 0x8d,
...> value: 0
...> }
...> )
@ -191,8 +191,8 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> v: "0x8d",
...> standard_v: 0x0,
...> v: 0x8d,
...> value: 0
...> }
...> )
@ -216,8 +216,8 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> v: "0x8d",
...> standard_v: 0x0,
...> v: 0x8d,
...> value: 0
...> }
...> )
@ -238,8 +238,8 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> v: "0x8d",
...> standard_v: 0x0,
...> v: 0x8d,
...> value: 0
...> }
...> )
@ -281,9 +281,9 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> standard_v: 0x0,
...> to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> v: "0x8d",
...> v: 0x8d,
...> value: 0
...> }
...> )
@ -309,9 +309,9 @@ defmodule Explorer.Chain.Transaction do
...> public_key: "0xe5d196ad4ceada719d9e592f7166d0c75700f6eab2e3c3de34ba751ea786527cb3f6eb96ad9fdfdb9989ff572df50f1c42ef800af9c5207a38b929aff969b5c9",
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> standard_v: "0x0",
...> standard_v: 0x0,
...> to_address_hash: "0x8bf38d4764929064f2d4d3a56520a76ab3df415b",
...> v: "0x8d",
...> v: 0x8d,
...> value: 0
...> }
...> )

@ -16,7 +16,7 @@ defmodule Explorer.Repo.Migrations.CreateTransactions do
add(:r, :numeric, precision: 100, null: false)
add(:s, :numeric, precision: 100, null: false)
add(:standard_v, :smallint, null: false)
add(:v, :string, null: false)
add(:v, :integer, null: false)
add(:value, :numeric, precision: 100, null: false)
timestamps(null: false)

@ -19,9 +19,9 @@ defmodule Explorer.Chain.TransactionTest do
public_key: "0xb39af9cb",
r: 0x9,
s: 0x10,
standard_v: "0x11",
standard_v: 0x1,
transaction_index: "0x12",
v: "0x13"
v: 27
})
end

@ -124,7 +124,7 @@ defmodule Explorer.Factory do
s: sequence(:transaction_s, & &1),
standard_v: Enum.random(0..3),
to_address_hash: insert(:address).hash,
v: sequence("0x"),
v: Enum.random(27..30),
value: Enum.random(1..100_000)
}
end

@ -1,7 +1,7 @@
{
"coverage_options": {
"treat_no_relevant_lines_as_covered": true,
"minimum_coverage": 91.1
"minimum_coverage": 91.6
},
"terminal_options": {
"file_column_width": 120

Loading…
Cancel
Save