Fixes after rebase

pull/7584/head
POA 1 year ago
parent bea348df48
commit 07c3dbf42d
  1. 7
      apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex
  2. 38
      apps/explorer/lib/explorer/chain.ex
  3. 5
      apps/explorer/lib/explorer/chain/import/stage/block_referencing.ex

@ -408,6 +408,10 @@ defmodule BlockScoutWeb.API.V2.TransactionView do
"has_error_in_internal_txs" => transaction.has_error_in_internal_txs
}
chain_type_fields(result, transaction, single_tx?, conn)
end
defp chain_type_fields(result, transaction, single_tx?, conn) do
case single_tx? && Application.get_env(:explorer, :chain_type) do
"polygon_edge" ->
result
@ -423,7 +427,8 @@ defmodule BlockScoutWeb.API.V2.TransactionView do
Map.put(extended_result, "zkevm_status", zkevm_status(extended_result))
_ -> result
_ ->
result
end
end

@ -6409,42 +6409,4 @@ defmodule Explorer.Chain do
def default_paging_options do
@default_paging_options
end
def zkevm_batches(options \\ []) do
necessity_by_association = Keyword.get(options, :necessity_by_association, %{})
base_query =
from(tb in TransactionBatch,
order_by: [desc: tb.number]
)
query =
if Keyword.get(options, :confirmed?, false) do
base_query
|> join_associations(necessity_by_association)
|> where([tb], not is_nil(tb.sequence_id) and tb.sequence_id > 0)
|> limit(10)
else
paging_options = Keyword.get(options, :paging_options, @default_paging_options)
base_query
|> join_associations(necessity_by_association)
|> page_zkevm_batches(paging_options)
|> limit(^paging_options.page_size)
end
select_repo(options).all(query)
end
def zkevm_batch_transactions(batch_number, options \\ []) do
query = from(bts in BatchTransaction, where: bts.batch_number == ^batch_number)
select_repo(options).all(query)
end
defp page_zkevm_batches(query, %PagingOptions{key: nil}), do: query
defp page_zkevm_batches(query, %PagingOptions{key: {number}}) do
from(tb in query, where: tb.number < ^number)
end
end

@ -30,6 +30,7 @@ defmodule Explorer.Chain.Import.Stage.BlockReferencing do
Runner.PolygonEdge.Withdrawals,
Runner.PolygonEdge.WithdrawalExits
]
"polygon_zkevm" ->
@default_runners ++
[
@ -37,7 +38,9 @@ defmodule Explorer.Chain.Import.Stage.BlockReferencing do
Runner.Zkevm.TransactionBatches,
Runner.Zkevm.BatchTransactions
]
_ -> @default_runners
_ ->
@default_runners
end
end

Loading…
Cancel
Save