diff --git a/CHANGELOG.md b/CHANGELOG.md index de13ae4444..e101cc7c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ ### Chore +## 1.3.7-beta + +### Features + +### Fixes + + - [#1615](https://github.com/poanetwork/blockscout/pull/1615) - Add more logging to code fixer process + - [#1613](https://github.com/poanetwork/blockscout/pull/1613) - Fix USD fee value + - [#1577](https://github.com/poanetwork/blockscout/pull/1577) - Add process to fix contract with code + - [#1583](https://github.com/poanetwork/blockscout/pull/1583) - Chunk JSON-RPC batches in case connection times out + +### Chore + + - [#1610](https://github.com/poanetwork/blockscout/pull/1610) - Add PIRL to Readme + ## 1.3.6-beta ### Features diff --git a/apps/indexer/lib/indexer/temporary/addresses_without_code.ex b/apps/indexer/lib/indexer/temporary/addresses_without_code.ex index 265b64b495..23a3f11683 100644 --- a/apps/indexer/lib/indexer/temporary/addresses_without_code.ex +++ b/apps/indexer/lib/indexer/temporary/addresses_without_code.ex @@ -45,6 +45,13 @@ defmodule Indexer.Temporary.AddressesWithoutCode do end def fix_transaction_without_to_address_and_created_contract_address(fetcher) do + Logger.debug( + [ + "Started fix_transaction_without_to_address_and_created_contract_address" + ], + fetcher: :addresses_without_code + ) + query = from(block in Block, left_join: transaction in Transaction, @@ -56,23 +63,23 @@ defmodule Indexer.Temporary.AddressesWithoutCode do ) process_query(query, fetcher) - end - - defp process_query(query, fetcher) do - query_stream = Repo.stream(query, max_rows: @batch_size) - - stream = - TaskSupervisor - |> Task.Supervisor.async_stream_nolink( - query_stream, - fn block -> refetch_block(block, fetcher) end, - @task_options - ) - Repo.transaction(fn -> Stream.run(stream) end) + Logger.debug( + [ + "Started fix_transaction_without_to_address_and_created_contract_address" + ], + fetcher: :addresses_without_code + ) end def fix_addresses_with_creation_transaction_but_without_code(fetcher) do + Logger.debug( + [ + "Started fix_addresses_with_creation_transaction_but_without_code" + ], + fetcher: :addresses_without_code + ) + second_query = from(block in Block, left_join: transaction in Transaction, @@ -87,10 +94,45 @@ defmodule Indexer.Temporary.AddressesWithoutCode do ) process_query(second_query, fetcher) + + Logger.debug( + [ + "Finished fix_addresses_with_creation_transaction_but_without_code" + ], + fetcher: :addresses_without_code + ) + end + + defp process_query(query, fetcher) do + query_stream = Repo.stream(query, max_rows: @batch_size) + + stream = + TaskSupervisor + |> Task.Supervisor.async_stream_nolink( + query_stream, + fn block -> refetch_block(block, fetcher) end, + @task_options + ) + + Repo.transaction(fn -> Stream.run(stream) end) end def refetch_block(block, fetcher) do + Logger.debug( + [ + "Processing block #{to_string(block.hash)} #{block.number}" + ], + fetcher: :addresses_without_code + ) + Fetcher.fetch_and_import_block(block.number, fetcher, false) + + Logger.debug( + [ + "Finished processing block #{to_string(block.hash)} #{block.number}" + ], + fetcher: :addresses_without_code + ) rescue e -> Logger.debug(