Merge pull request #4992 from blockscout/np-fix-tx-type-1559

Change type field to the optional one
pull/5008/head
Victor Baranov 3 years ago committed by GitHub
commit 5382782dcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 3
      apps/explorer/config/config.exs
  3. 15
      apps/explorer/lib/explorer/chain/transaction.ex
  4. 3
      docker/Makefile

@ -7,6 +7,7 @@
### Fixes ### Fixes
- [#5005](https://github.com/blockscout/blockscout/pull/5005) - Fix falsy appearance `Connection Lost` warning on reload/switch page - [#5005](https://github.com/blockscout/blockscout/pull/5005) - Fix falsy appearance `Connection Lost` warning on reload/switch page
- [#5003](https://github.com/blockscout/blockscout/pull/5003) - API router refactoring - [#5003](https://github.com/blockscout/blockscout/pull/5003) - API router refactoring
- [#4992](https://github.com/blockscout/blockscout/pull/4992) - Fix `type` field in transactions after enabling 1559
- [#4979](https://github.com/blockscout/blockscout/pull/4979), [#4993](https://github.com/blockscout/blockscout/pull/4993) - Store total gas_used in addresses table - [#4979](https://github.com/blockscout/blockscout/pull/4979), [#4993](https://github.com/blockscout/blockscout/pull/4993) - Store total gas_used in addresses table
- [#4977](https://github.com/blockscout/blockscout/pull/4977) - Export token transfers on address: include transfers on contract itself - [#4977](https://github.com/blockscout/blockscout/pull/4977) - Export token transfers on address: include transfers on contract itself
- [#4976](https://github.com/blockscout/blockscout/pull/4976) - Handle :econnrefused in pending transactions fetcher - [#4976](https://github.com/blockscout/blockscout/pull/4976) - Handle :econnrefused in pending transactions fetcher

@ -21,8 +21,7 @@ config :explorer,
if(System.get_env("DISABLE_WEBAPP") != "true", if(System.get_env("DISABLE_WEBAPP") != "true",
do: Explorer.Chain.Events.SimpleSender, do: Explorer.Chain.Events.SimpleSender,
else: Explorer.Chain.Events.DBSender else: Explorer.Chain.Events.DBSender
), )
enabled_1559_support: System.get_env("ENABLE_1559_SUPPORT") == "true"
config :explorer, Explorer.Counters.AverageBlockTime, config :explorer, Explorer.Counters.AverageBlockTime,
enabled: true, enabled: true,

@ -31,12 +31,10 @@ defmodule Explorer.Chain.Transaction do
@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 @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 error gas_used index created_contract_code_indexed_at status
to_address_hash revert_reason)a to_address_hash revert_reason type)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 gas_price hash input nonce r s v value)a
@required_attrs_for_1559 ~w(type)a
@typedoc """ @typedoc """
X coordinate module n in X coordinate module n in
[Elliptic Curve Digital Signature Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) [Elliptic Curve Digital Signature Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm)
@ -409,18 +407,11 @@ defmodule Explorer.Chain.Transaction do
""" """
def changeset(%__MODULE__{} = transaction, attrs \\ %{}) do def changeset(%__MODULE__{} = transaction, attrs \\ %{}) do
enabled_1559 = Application.get_env(:explorer, :enabled_1559_support) attrs_to_cast = @required_attrs ++ @optional_attrs
required_attrs = if enabled_1559, do: @required_attrs ++ @required_attrs_for_1559, else: @required_attrs
attrs_to_cast =
if enabled_1559,
do: @required_attrs ++ @required_attrs_for_1559 ++ @optional_attrs,
else: @required_attrs ++ @optional_attrs
transaction transaction
|> cast(attrs, attrs_to_cast) |> cast(attrs, attrs_to_cast)
|> validate_required(required_attrs) |> validate_required(@required_attrs)
|> validate_collated() |> validate_collated()
|> validate_error() |> validate_error()
|> validate_status() |> validate_status()

@ -326,9 +326,6 @@ endif
ifdef MAX_SIZE_UNLESS_HIDE_ARRAY ifdef MAX_SIZE_UNLESS_HIDE_ARRAY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_SIZE_UNLESS_HIDE_ARRAY=$(MAX_SIZE_UNLESS_HIDE_ARRAY)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_SIZE_UNLESS_HIDE_ARRAY=$(MAX_SIZE_UNLESS_HIDE_ARRAY)'
endif endif
ifdef ENABLE_1559_SUPPORT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_1559_SUPPORT=$(ENABLE_1559_SUPPORT)'
endif
ifdef DISPLAY_TOKEN_ICONS ifdef DISPLAY_TOKEN_ICONS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISPLAY_TOKEN_ICONS=$(DISPLAY_TOKEN_ICONS)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISPLAY_TOKEN_ICONS=$(DISPLAY_TOKEN_ICONS)'
endif endif

Loading…
Cancel
Save