Merge pull request #7872 from blockscout/vb-fix-empty-gas-price-in-pending-tx

Fix gas price in pending tx
pull/7878/head
Victor Baranov 1 year ago committed by GitHub
commit d32810aa7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex
  3. 25
      apps/explorer/lib/explorer/chain/transaction.ex

@ -9,6 +9,7 @@
- [#7811](https://github.com/blockscout/blockscout/pull/7811) - Filter addresses before insertion
### Fixes
- [#7872](https://github.com/blockscout/blockscout/pull/7872) - Fix pending gas price in pending tx
- [#7825](https://github.com/blockscout/blockscout/pull/7825) - Fix nginx config for the new frontend websockets
- [#7772](https://github.com/blockscout/blockscout/pull/7772) - Fix parsing of database password period(s)
- [#7803](https://github.com/blockscout/blockscout/pull/7803) - Fix additional sources and interfaces, save names for vyper contracts

@ -135,6 +135,7 @@ defmodule EthereumJSONRPC.Transaction do
%{
block_hash: nil,
block_number: nil,
gas_price: nil,
from_address_hash: "0x870006d72c247bc1e90983c71b3234ee01d3c9d9",
gas: 182154,
hash: "0x8d2cd1fae48ea0d2a20bb74abbfca05c2d805793e1b42fa844bbdd90f2512f39",
@ -230,6 +231,7 @@ defmodule EthereumJSONRPC.Transaction do
block_number: block_number,
from_address_hash: from_address_hash,
gas: gas,
gas_price: nil,
hash: hash,
index: index,
input: input,

@ -34,9 +34,9 @@ defmodule Explorer.Chain.Transaction do
alias Explorer.SmartContract.SigProviderInterface
@optional_attrs ~w(max_priority_fee_per_gas max_fee_per_gas block_hash block_number created_contract_address_hash cumulative_gas_used earliest_processing_start
error gas_used index created_contract_code_indexed_at status to_address_hash revert_reason type has_error_in_internal_txs)a
error gas_price gas_used index created_contract_code_indexed_at status to_address_hash revert_reason type has_error_in_internal_txs)a
@required_attrs ~w(from_address_hash gas gas_price hash input nonce r s v value)a
@required_attrs ~w(from_address_hash gas hash input nonce r s v value)a
@typedoc """
X coordinate module n in
@ -154,7 +154,7 @@ defmodule Explorer.Chain.Transaction do
from_address: %Ecto.Association.NotLoaded{} | Address.t(),
from_address_hash: Hash.Address.t(),
gas: Gas.t(),
gas_price: wei_per_gas,
gas_price: wei_per_gas | nil,
gas_used: Gas.t() | nil,
hash: Hash.t(),
index: transaction_index | nil,
@ -305,6 +305,25 @@ defmodule Explorer.Chain.Transaction do
iex> changeset.valid?
true
A pending transaction does not have a `gas_price` (Erigon)
iex> changeset = Explorer.Chain.Transaction.changeset(
...> %Transaction{},
...> %{
...> from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca",
...> gas: 4700000,
...> hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6",
...> input: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029",
...> nonce: 0,
...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75,
...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3,
...> v: 0x8d,
...> value: 0
...> }
...> )
iex> changeset.valid?
true
A collated transaction MUST have an `index` so its position in the `block` is known and the `cumulative_gas_used` ane
`gas_used` to know its fees.

Loading…
Cancel
Save