Small refactoring

pull/7584/head
POA 1 year ago
parent 5e3a8cb5be
commit 2836ccf017
  1. 4
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/transaction_controller.ex
  2. 4
      apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex
  3. 11
      apps/explorer/config/test.exs
  4. 4
      apps/explorer/lib/explorer/chain/transaction.ex

@ -75,8 +75,8 @@ defmodule BlockScoutWeb.API.V2.TransactionController do
if Application.get_env(:explorer, :chain_type) == "polygon_zkevm" do if Application.get_env(:explorer, :chain_type) == "polygon_zkevm" do
necessity_by_association_with_actions necessity_by_association_with_actions
|> Map.put(:zkevm_batch, :optional) |> Map.put(:zkevm_batch, :optional)
|> Map.put(:zkevm_sequence_txn, :optional) |> Map.put(:zkevm_sequence_transaction, :optional)
|> Map.put(:zkevm_verify_txn, :optional) |> Map.put(:zkevm_verify_transaction, :optional)
else else
necessity_by_association_with_actions necessity_by_association_with_actions
end end

@ -428,8 +428,8 @@ defmodule BlockScoutWeb.API.V2.TransactionView do
extended_result = extended_result =
result result
|> add_optional_transaction_field(transaction, "zkevm_batch_number", :zkevm_batch, :number) |> add_optional_transaction_field(transaction, "zkevm_batch_number", :zkevm_batch, :number)
|> add_optional_transaction_field(transaction, "zkevm_sequence_hash", :zkevm_sequence_txn, :hash) |> add_optional_transaction_field(transaction, "zkevm_sequence_hash", :zkevm_sequence_transaction, :hash)
|> add_optional_transaction_field(transaction, "zkevm_verify_hash", :zkevm_verify_txn, :hash) |> add_optional_transaction_field(transaction, "zkevm_verify_hash", :zkevm_verify_transaction, :hash)
Map.put(extended_result, "zkevm_status", zkevm_status(extended_result)) Map.put(extended_result, "zkevm_status", zkevm_status(extended_result))

@ -38,7 +38,7 @@ config :explorer, Explorer.Repo.Account,
timeout: :timer.seconds(60), timeout: :timer.seconds(60),
queue_target: 1000 queue_target: 1000
for repo <- [Explorer.Repo.PolygonEdge, Explorer.Repo.RSK] do for repo <- [Explorer.Repo.PolygonEdge, Explorer.Repo.PolygonZkevm, Explorer.Repo.RSK] do
config :explorer, repo, config :explorer, repo,
database: "explorer_test", database: "explorer_test",
hostname: "localhost", hostname: "localhost",
@ -49,15 +49,6 @@ for repo <- [Explorer.Repo.PolygonEdge, Explorer.Repo.RSK] do
queue_target: 1000 queue_target: 1000
end end
config :explorer, Explorer.Repo.PolygonZkevm,
database: "explorer_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox,
# Default of `5_000` was too low for `BlockFetcher` test
ownership_timeout: :timer.minutes(1),
timeout: :timer.seconds(60),
queue_target: 1000
config :logger, :explorer, config :logger, :explorer,
level: :warn, level: :warn,
path: Path.absname("logs/test/explorer.log") path: Path.absname("logs/test/explorer.log")

@ -278,8 +278,8 @@ defmodule Explorer.Chain.Transaction do
has_one(:zkevm_batch_transaction, BatchTransaction, foreign_key: :hash) has_one(:zkevm_batch_transaction, BatchTransaction, foreign_key: :hash)
has_one(:zkevm_batch, through: [:zkevm_batch_transaction, :batch]) has_one(:zkevm_batch, through: [:zkevm_batch_transaction, :batch])
has_one(:zkevm_sequence_txn, through: [:zkevm_batch, :sequence_transaction]) has_one(:zkevm_sequence_transaction, through: [:zkevm_batch, :sequence_transaction])
has_one(:zkevm_verify_txn, through: [:zkevm_batch, :verify_transaction]) has_one(:zkevm_verify_transaction, through: [:zkevm_batch, :verify_transaction])
belongs_to( belongs_to(
:created_contract_address, :created_contract_address,

Loading…
Cancel
Save